From aca5249fd16b4ae4cd0e842d3a605eb0b0d40ec9 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 18 May 2025 18:26:58 +0200 Subject: [PATCH] Trunk formating --- src/Power.cpp | 70 ++++++++++++++++++++---------------------- src/detect/ScanI2C.cpp | 1 - src/detect/ScanI2C.h | 2 +- src/main.cpp | 3 +- src/main.h | 2 +- 5 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index afc1dcd6b..3a41966b8 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -76,7 +76,6 @@ static const uint8_t ext_chrg_detect_value = EXT_CHRG_DETECT_VALUE; #endif #endif - #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #include "main.h"; uint8_t INA_ADDR_LOCAL; @@ -507,7 +506,6 @@ class AnalogBatteryLevel : public HasBatteryLevel } #endif - #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL) /* Read Voltage from INA using autodetect of addr first else use addr in config.power.device_battery_ina_address @@ -517,18 +515,18 @@ class AnalogBatteryLevel : public HasBatteryLevel if (!config.power.device_battery_ina_address) { if (ina_found.type != ScanI2C::DeviceType::NONE) { switch (ina_found.type) { - case ScanI2C::DeviceType::INA219: - return ina219Sensor.getBusVoltageMv(); - break; - case ScanI2C::DeviceType::INA226: - return ina226Sensor.getBusVoltageMv(); - break; - case ScanI2C::DeviceType::INA260: - return ina260Sensor.getBusVoltageMv(); - break; - case ScanI2C::DeviceType::INA3221: - return ina3221Sensor.getBusVoltageMv(); - break; + case ScanI2C::DeviceType::INA219: + return ina219Sensor.getBusVoltageMv(); + break; + case ScanI2C::DeviceType::INA226: + return ina226Sensor.getBusVoltageMv(); + break; + case ScanI2C::DeviceType::INA260: + return ina260Sensor.getBusVoltageMv(); + break; + case ScanI2C::DeviceType::INA3221: + return ina3221Sensor.getBusVoltageMv(); + break; } } } else if (config.power.device_battery_ina_address) { @@ -556,14 +554,14 @@ class AnalogBatteryLevel : public HasBatteryLevel if (!config.power.device_battery_ina_address) { if (ina_found.type != ScanI2C::DeviceType::NONE) { switch (ina_found.type) { - case ScanI2C::DeviceType::INA219: - return ina219Sensor.getCurrentMa(); + case ScanI2C::DeviceType::INA219: + return ina219Sensor.getCurrentMa(); - case ScanI2C::DeviceType::INA226: - return ina226Sensor.getCurrentMa(); + case ScanI2C::DeviceType::INA226: + return ina226Sensor.getCurrentMa(); - case ScanI2C::DeviceType::INA3221: - return ina3221Sensor.getCurrentMa(); + case ScanI2C::DeviceType::INA3221: + return ina3221Sensor.getCurrentMa(); } } } else if (config.power.device_battery_ina_address) { @@ -590,25 +588,25 @@ class AnalogBatteryLevel : public HasBatteryLevel if (ina_found.type != ScanI2C::DeviceType::NONE) { INA_ADDR_LOCAL = ina_found.address.address; switch (ina_found.type) { - case ScanI2C::DeviceType::INA219: - if (!ina219Sensor.isInitialized()) - return ina219Sensor.runOnce() > 0; - return ina219Sensor.isRunning(); + case ScanI2C::DeviceType::INA219: + if (!ina219Sensor.isInitialized()) + return ina219Sensor.runOnce() > 0; + return ina219Sensor.isRunning(); - case ScanI2C::DeviceType::INA226: - if (!ina226Sensor.isInitialized()) - return ina226Sensor.runOnce() > 0; - return ina226Sensor.isRunning(); + case ScanI2C::DeviceType::INA226: + if (!ina226Sensor.isInitialized()) + return ina226Sensor.runOnce() > 0; + return ina226Sensor.isRunning(); - case ScanI2C::DeviceType::INA260: - if (!ina260Sensor.isInitialized()) - return ina260Sensor.runOnce() > 0; - return ina260Sensor.isRunning(); + case ScanI2C::DeviceType::INA260: + if (!ina260Sensor.isInitialized()) + return ina260Sensor.runOnce() > 0; + return ina260Sensor.isRunning(); - case ScanI2C::DeviceType::INA3221: - if (!ina3221Sensor.isInitialized()) - return ina3221Sensor.runOnce() > 0; - return ina3221Sensor.isRunning(); + case ScanI2C::DeviceType::INA3221: + if (!ina3221Sensor.isInitialized()) + return ina3221Sensor.runOnce() > 0; + return ina3221Sensor.isRunning(); } } } else if (config.power.device_battery_ina_address) { diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index ea64a98aa..e107c0779 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -41,7 +41,6 @@ ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const return firstOfOrNONE(8, types); } - ScanI2C::FoundDevice ScanI2C::firstINA() const { ScanI2C::DeviceType types[] = {INA219, INA226, INA260, INA3221}; diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 9d35d1bf3..91dd7c82a 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -122,7 +122,7 @@ class ScanI2C FoundDevice firstKeyboard() const; FoundDevice firstAccelerometer() const; - + FoundDevice firstINA() const; FoundDevice firstRGBLED() const; diff --git a/src/main.cpp b/src/main.cpp index 54c057447..66a0c9179 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -180,7 +180,6 @@ ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::FoundDevice ina_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE); ScanI2C::DeviceAddress ina_Address = ScanI2C::ADDRESS_NONE; - #ifdef T_WATCH_S3 Adafruit_DRV2605 drv; #endif @@ -704,7 +703,7 @@ void setup() #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) auto ina_Info = i2cScanner->firstINA(); -// ina_Address = ina_Info.type != ScanI2C::DeviceType::NONE ? ina_Info.address : ina_Address; + // ina_Address = ina_Info.type != ScanI2C::DeviceType::NONE ? ina_Info.address : ina_Address; LOG_DEBUG("ina_info = %i", ina_Info.type); #endif diff --git a/src/main.h b/src/main.h index fa9f230b1..c0bb818a4 100644 --- a/src/main.h +++ b/src/main.h @@ -34,7 +34,7 @@ extern uint8_t kb_model; extern ScanI2C::DeviceAddress rtc_found; extern ScanI2C::DeviceAddress accelerometer_found; extern ScanI2C::FoundDevice rgb_found; -//extern ScanI2C::DeviceAddress ina_Address; +// extern ScanI2C::DeviceAddress ina_Address; extern ScanI2C::FoundDevice ina_found; extern bool eink_found;