ソースを参照

Merge branch 'dev' into esp32_c3_c6_s3_max_contacts_300

Liam Cottle 11 ヶ月 前
コミット
f5c7d3dd80

+ 15 - 0
examples/companion_radio/ui-new/UITask.cpp

@@ -551,7 +551,22 @@ void UITask::loop() {
   if (millis() > next_batt_chck) {
     uint16_t milliVolts = getBattMilliVolts();
     if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) {
+
+      // show low battery shutdown alert
+      // we should only do this for eink displays, which will persist after power loss
+      #ifdef THINKNODE_M1
+      if (_display != NULL) {
+        _display->startFrame();
+        _display->setTextSize(2);
+        _display->setColor(DisplayDriver::RED);
+        _display->drawTextCentered(_display->width() / 2, 20, "Low Battery.");
+        _display->drawTextCentered(_display->width() / 2, 40, "Shutting Down!");
+        _display->endFrame();
+      }
+      #endif
+
       shutdown();
+
     }
     next_batt_chck = millis() + 8000;
   }

+ 8 - 0
src/helpers/nrf52/ThinkNodeM1Board.h

@@ -57,6 +57,14 @@ public:
   }
 
   void powerOff() override {
+
+    // turn off all leds, sd_power_system_off will not do this for us
+    #ifdef P_LORA_TX_LED
+    digitalWrite(P_LORA_TX_LED, LOW);
+    #endif
+
+    // power off board
     sd_power_system_off();
+
   }
 };

+ 10 - 0
variants/meshadventurer/platformio.ini

@@ -82,6 +82,7 @@ build_src_filter = ${Meshadventurer.build_src_filter}
   +<helpers/ui/SSD1306Display.cpp>
 build_flags =
   ${Meshadventurer.build_flags}
+  -I examples/companion_radio/ui-new
   -D RADIO_CLASS=CustomSX1262
   -D WRAPPER_CLASS=CustomSX1262Wrapper
   -D LORA_TX_POWER=22
@@ -99,8 +100,11 @@ build_src_filter = ${Meshadventurer.build_src_filter}
   +<../examples/companion_radio/*.cpp>
   +<helpers/esp32/*.cpp>
   +<helpers/ui/SSD1306Display.cpp>
+  +<../examples/companion_radio/*.cpp>
+  +<../examples/companion_radio/ui-new/*.cpp>
 build_flags =
   ${Meshadventurer.build_flags}
+  -I examples/companion_radio/ui-new
   -D RADIO_CLASS=CustomSX1262
   -D WRAPPER_CLASS=CustomSX1262Wrapper
   -D LORA_TX_POWER=22
@@ -159,8 +163,11 @@ extends = Meshadventurer
 build_src_filter = ${Meshadventurer.build_src_filter}
   +<../examples/companion_radio/*.cpp>
   +<helpers/ui/SSD1306Display.cpp>
+  +<../examples/companion_radio/*.cpp>
+  +<../examples/companion_radio/ui-new/*.cpp>
 build_flags =
   ${Meshadventurer.build_flags}
+  -I examples/companion_radio/ui-new
   -D RADIO_CLASS=CustomSX1268
   -D WRAPPER_CLASS=CustomSX1268Wrapper
   -D LORA_TX_POWER=22
@@ -178,8 +185,11 @@ build_src_filter = ${Meshadventurer.build_src_filter}
   +<../examples/companion_radio/*.cpp>
   +<helpers/esp32/*.cpp>
   +<helpers/ui/SSD1306Display.cpp>
+  +<../examples/companion_radio/*.cpp>
+  +<../examples/companion_radio/ui-new/*.cpp>
 build_flags =
   ${Meshadventurer.build_flags}
+  -I examples/companion_radio/ui-new
   -D RADIO_CLASS=CustomSX1268
   -D WRAPPER_CLASS=CustomSX1268Wrapper
   -D LORA_TX_POWER=22

+ 0 - 4
variants/meshadventurer/target.cpp

@@ -18,10 +18,6 @@ MASensorManager sensors = MASensorManager(nmea);
   DISPLAY_CLASS display;
 #endif
 
-#ifndef LORA_CR
-  #define LORA_CR      5
-#endif
-
 bool radio_init() {
   fallback_clock.begin();
   rtc_clock.begin(Wire);

+ 1 - 0
variants/thinknode_m1/platformio.ini

@@ -77,6 +77,7 @@ build_flags =
   -D DISPLAY_CLASS=GxEPDDisplay
   -D OFFLINE_QUEUE_SIZE=256
   -D PIN_BUZZER=6
+  -D AUTO_SHUTDOWN_MILLIVOLTS=3300
 ;  -D MESH_PACKET_LOGGING=1
 ;  -D MESH_DEBUG=1
 build_src_filter = ${ThinkNode_M1.build_src_filter}

+ 6 - 0
variants/xiao_s3_wio/platformio.ini

@@ -103,15 +103,21 @@ lib_deps =
 extends = Xiao_S3_WIO
 build_flags =
   ${Xiao_S3_WIO.build_flags}
+  -I examples/companion_radio/ui-new
   -D MAX_CONTACTS=300
   -D MAX_GROUP_CHANNELS=8
+  -D DISPLAY_CLASS=SSD1306Display
   -D SERIAL_TX=D6
   -D SERIAL_RX=D7
 ;  -D MESH_PACKET_LOGGING=1
 ;  -D MESH_DEBUG=1
 build_src_filter = ${Xiao_S3_WIO.build_src_filter}
+  +<helpers/ui/SSD1306Display.cpp>
   +<helpers/esp32/*.cpp>
+  +<helpers/ui/MomentaryButton.cpp>
   +<../examples/companion_radio/*.cpp>
+  +<../examples/companion_radio/ui-new/*.cpp>
 lib_deps =
   ${Xiao_S3_WIO.lib_deps}
   densaugeo/base64 @ ~1.4.0
+  adafruit/Adafruit SSD1306 @ ^2.5.13