diff --git a/docs/solarxiao_power.md b/docs/solarxiao_power.md index df1ca7fcb..7057b047b 100644 --- a/docs/solarxiao_power.md +++ b/docs/solarxiao_power.md @@ -1,8 +1,8 @@ # SolarXiao MPPT and battery controls -SolarXiao firmware includes a native INA260 battery monitor and LTC4162 charger -interface in Full and Reduced Repeater, Room Server and Companion builds. Use -USB CLI or the role's authenticated administrator CLI over LoRa. Ship mode and +SolarXiao Repeater firmware includes a native INA260 battery monitor and LTC4162 +charger interface in Full and Reduced builds. Use USB CLI or the authenticated +administrator CLI over LoRa. Ship mode and saved-policy reset require local USB. Commands do not change RF settings. Start with: diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 2dbae74f2..803cf8197 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #if defined(OLED_AUTO_DETECT) && OLED_AUTO_DETECT && defined(DISPLAY_CLASS) @@ -10772,9 +10771,6 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, } if (mesh::power::handleRegulatorCommand(command, reply, reply_capacity)) return true; -#if defined(MESH_SOLARXIAO_POWER) && MESH_SOLARXIAO_POWER - if (mesh::solar::handleCommand(command, reply, reply_capacity, sender_timestamp == 0)) return true; -#endif #if defined(WIO_E5_MINI_HEADLESS_COMPANION_UI) if (handleCompactLedCommand(command, reply, reply_capacity)) return true; #else diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 7b2e457e7..eaa85937a 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include // needed for PlatformIO #include @@ -3641,9 +3640,6 @@ void setup() { #endif #if !defined(WIO_E5_MINI_HEADLESS_COMPANION_UI) mesh::leds::beginSettings(board, regulator_prefs_fs); -#if defined(MESH_SOLARXIAO_POWER) && MESH_SOLARXIAO_POWER - mesh::solar::beginSettings(regulator_prefs_fs); -#endif #endif if (!mesh::power::beginRegulatorSettings(board, radio_driver, regulator_prefs_fs)) { MESH_DEBUG_PRINTLN("Regulator selection could not be applied"); @@ -4273,9 +4269,6 @@ void loop() { #endif rtc_clock.tick(); mesh::power::serviceRegulatorSettings(); -#if defined(MESH_SOLARXIAO_POWER) && MESH_SOLARXIAO_POWER - mesh::solar::service(); -#endif board.loop(); if (mesh::serviceUsbLoggingWatchdog(usbLoggingRecoverySafe)) board.reboot(); #ifdef TBEAM_1W diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 3f3657f88..d7393bed6 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include // needed for PlatformIO #include @@ -148,9 +147,6 @@ void setup() { if (volatile_primary_fs) regulator_prefs_fs = nullptr; #endif mesh::leds::beginSettings(board, regulator_prefs_fs); -#if defined(MESH_SOLARXIAO_POWER) && MESH_SOLARXIAO_POWER - mesh::solar::beginSettings(regulator_prefs_fs); -#endif if (!mesh::power::beginRegulatorSettings(board, radio_driver, regulator_prefs_fs)) { MESH_DEBUG_PRINTLN("Regulator selection could not be applied"); } @@ -411,9 +407,6 @@ void loop() { #endif rtc_clock.tick(); mesh::power::serviceRegulatorSettings(); -#if defined(MESH_SOLARXIAO_POWER) && MESH_SOLARXIAO_POWER - mesh::solar::service(); -#endif board.loop(); if (mesh::serviceUsbLoggingWatchdog(usbLoggingRecoverySafe)) board.reboot(); #if MESH_USB_CONSOLE_COOPERATIVE diff --git a/src/helpers/sensors/SolarXiaoPower.cpp b/src/helpers/sensors/SolarXiaoPower.cpp index 4b2c834be..0bec32dbe 100644 --- a/src/helpers/sensors/SolarXiaoPower.cpp +++ b/src/helpers/sensors/SolarXiaoPower.cpp @@ -23,7 +23,8 @@ public: while (Wire.available()) Wire.read(); return false; } - const uint8_t first=Wire.read(), second=Wire.read(); + const int first=Wire.read(), second=Wire.read(); + if (first<0 || second<0) return false; // LTC4162 SMBus words are little endian; INA260 registers are big endian. value=address==0x68 ? uint16_t(first)|(uint16_t(second)<<8) : (uint16_t(first)<<8)|second; diff --git a/variants/xiao_nrf52/platformio.ini b/variants/xiao_nrf52/platformio.ini index 06ac9c1fd..d4fd249bf 100644 --- a/variants/xiao_nrf52/platformio.ini +++ b/variants/xiao_nrf52/platformio.ini @@ -180,7 +180,6 @@ build_flags = ${Xiao_nrf52.build_flags} -D PIN_BOARD_SDA=PIN_NFC1 -D PIN_BOARD_SCL=PIN_NFC2 -D TELEM_INA260_ADDRESS=0x40 - -D MESH_SOLARXIAO_POWER=1 -D MANUFACTURER_STRING='"SolarXiao 30S"' [env:solarxiao_30S_companion_radio_ble] @@ -248,6 +247,7 @@ board_build.ldscript = boards/nrf52840_s140_v7_xiao_bootloader_ota.ld board_upload.maximum_size = 757760 build_flags = ${solarxiao.build_flags} + -D MESH_SOLARXIAO_POWER=1 ${nrf52_qspi_ota.build_flags} -D OTA_QSPI_BOOTLOADER_UPDATE=1 -D ADVERT_NAME='"SolarXiao 30S Repeater"'