mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-05-04 21:26:04 +02:00
Cleaned up code and added ESP32 support for AdcSampler-based BatteryMonitor and current monitoring
This commit is contained in:
@@ -1,32 +1,53 @@
|
||||
# Architecture:
|
||||
# +-----------------------+
|
||||
# | MonitoringManager | ← High-level coordinator
|
||||
# +-----------------------+
|
||||
# | BatteryMonitor | ← Battery logic (platform-independent)
|
||||
# | CurrentMonitor | ← Current logic (platform-independent)
|
||||
# +-----------------------+
|
||||
# | AdcSampler | ← BSP: Unified ADC sampling interface
|
||||
# +-----------------------+
|
||||
# | ESP-IDF ADC HAL | ← Espressif official driver
|
||||
# +-----------------------+
|
||||
|
||||
set(
|
||||
requires
|
||||
Helpers
|
||||
)
|
||||
|
||||
if ("$ENV{IDF_TARGET}" STREQUAL "esp32s3")
|
||||
# Platform-specific dependencies
|
||||
if ("$ENV{IDF_TARGET}" STREQUAL "esp32s3" OR "$ENV{IDF_TARGET}" STREQUAL "esp32")
|
||||
list(APPEND requires
|
||||
driver
|
||||
esp_adc
|
||||
)
|
||||
endif()
|
||||
|
||||
# Common source files (platform-independent business logic)
|
||||
set(
|
||||
source_files
|
||||
""
|
||||
"Monitoring/MonitoringManager.cpp"
|
||||
"Monitoring/BatteryMonitor.cpp"
|
||||
"Monitoring/CurrentMonitor.cpp"
|
||||
)
|
||||
|
||||
# BSP Layer: ADC sampler implementation
|
||||
if ("$ENV{IDF_TARGET}" STREQUAL "esp32s3" OR "$ENV{IDF_TARGET}" STREQUAL "esp32")
|
||||
# Common ADC implementation
|
||||
list(APPEND source_files
|
||||
"Monitoring/AdcSampler.cpp"
|
||||
)
|
||||
|
||||
# Platform-specific GPIO-to-channel mapping
|
||||
if ("$ENV{IDF_TARGET}" STREQUAL "esp32s3")
|
||||
list(APPEND source_files
|
||||
"Monitoring/AdcSampler.cpp"
|
||||
"Monitoring/BatteryMonitor.cpp"
|
||||
"Monitoring/CurrentMonitor_esp32s3.cpp"
|
||||
"Monitoring/MonitoringManager_esp32s3.cpp"
|
||||
)
|
||||
else()
|
||||
list(APPEND source_files
|
||||
"Monitoring/CurrentMonitor_esp32.cpp"
|
||||
"Monitoring/MonitoringManager_esp32.cpp"
|
||||
)
|
||||
list(APPEND source_files
|
||||
"Monitoring/AdcSampler_esp32s3.cpp"
|
||||
)
|
||||
elseif ("$ENV{IDF_TARGET}" STREQUAL "esp32")
|
||||
list(APPEND source_files
|
||||
"Monitoring/AdcSampler_esp32.cpp"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user