Selaa lähdekoodia

lilygo t-echo cleanup, add AUTO_SHUTDOWN_MILLIVOLTS

recrof 11 kuukautta sitten
vanhempi
sitoutus
5b2c1715f4

+ 5 - 5
examples/companion_radio/ui-new/UITask.cpp

@@ -202,8 +202,8 @@ public:
       display.print(tmp);
     } else if (_page == HomePage::BLUETOOTH) {
       display.setColor(DisplayDriver::GREEN);
-      display.drawXbm((display.width() - 32) / 2, 18, 
-          _task->isSerialEnabled() ? bluetooth_on : bluetooth_off, 
+      display.drawXbm((display.width() - 32) / 2, 18,
+          _task->isSerialEnabled() ? bluetooth_on : bluetooth_off,
           32, 32);
       display.setTextSize(1);
       display.drawTextCentered(display.width() / 2, 64 - 11, "toggle: " PRESS_LABEL);
@@ -455,8 +455,8 @@ void UITask::setCurrScreen(UIScreen* c) {
   _next_refresh = 100;
 }
 
-/* 
-  hardware-agnostic pre-shutdown activity should be done here 
+/*
+  hardware-agnostic pre-shutdown activity should be done here
 */
 void UITask::shutdown(bool restart){
 
@@ -584,7 +584,7 @@ void UITask::loop() {
 
       // show low battery shutdown alert
       // we should only do this for eink displays, which will persist after power loss
-      #ifdef THINKNODE_M1
+      #if defined(THINKNODE_M1) || defined(LILYGO_TECHO)
       if (_display != NULL) {
         _display->startFrame();
         _display->setTextSize(2);

+ 0 - 0
src/helpers/nrf52/TechoBoard.cpp → variants/lilygo_techo/TechoBoard.cpp


+ 0 - 13
src/helpers/nrf52/TechoBoard.h → variants/lilygo_techo/TechoBoard.h

@@ -3,19 +3,6 @@
 #include <MeshCore.h>
 #include <Arduino.h>
 
-// LoRa radio module pins for LilyGo T-Echo
-#define  P_LORA_DIO_1     20
-#define  P_LORA_NSS       24
-#define  P_LORA_RESET     25
-#define  P_LORA_BUSY      17
-#define  P_LORA_SCLK      19
-#define  P_LORA_MISO      23
-#define  P_LORA_MOSI      22
-#define  SX126X_POWER_EN  37
-
-#define SX126X_DIO2_AS_RF_SWITCH  true
-#define SX126X_DIO3_TCXO_VOLTAGE   1.8
-
 // built-ins
 #define VBAT_MV_PER_LSB   (0.73242188F)   // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
 

+ 57 - 36
variants/techo/platformio.ini → variants/lilygo_techo/platformio.ini

@@ -1,24 +1,26 @@
-[nrf52840_techo]
+[LilyGo_T-Echo]
 extends = nrf52_base
-platform_packages = framework-arduinoadafruitnrf52
+board = t-echo
+board_build.ldscript = boards/nrf52840_s140_v6.ld
 build_flags = ${nrf52_base.build_flags}
+  -I variants/lilygo_techo
   -I src/helpers/nrf52
   -I lib/nrf52/s140_nrf52_6.1.1_API/include
   -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
-lib_deps =
-  ${nrf52_base.lib_deps}
-  rweather/Crypto @ ^0.4.0
-
-[LilyGo_Techo]
-extends = nrf52840_techo
-board = t-echo
-board_build.ldscript = boards/nrf52840_s140_v6.ld
-build_flags = ${nrf52840_techo.build_flags}
-  -I variants/techo
-  -DLILYGO_TECHO
+  -D LILYGO_TECHO
   -D RADIO_CLASS=CustomSX1262
   -D WRAPPER_CLASS=CustomSX1262Wrapper
   -D LORA_TX_POWER=22
+  -D P_LORA_DIO_1=20
+  -D P_LORA_NSS=24
+  -D P_LORA_RESET=25
+  -D P_LORA_BUSY=17
+  -D P_LORA_SCLK=19
+  -D P_LORA_MISO=23
+  -D P_LORA_MOSI=22
+  -D SX126X_POWER_EN=37
+  -D SX126X_DIO2_AS_RF_SWITCH=true
+  -D SX126X_DIO3_TCXO_VOLTAGE=1.8
   -D SX126X_CURRENT_LIMIT=140
   -D SX126X_RX_BOOSTED_GAIN=1
   -D P_LORA_TX_LED=LED_GREEN
@@ -28,23 +30,31 @@ build_flags = ${nrf52840_techo.build_flags}
   -D GPS_BAUD_RATE=9600
   -D PIN_GPS_EN=GPS_EN
   -D TELEM_BME280_ADDRESS=0x77
-build_src_filter = ${nrf52840_techo.build_src_filter}
+  -D DISPLAY_CLASS=GxEPDDisplay
+  -D BACKLIGHT_BTN=PIN_BUTTON2
+  -D AUTO_OFF_MILLIS=0
+build_src_filter = ${nrf52_base.build_src_filter}
   +<helpers/*.cpp>
-  +<helpers/nrf52/TechoBoard.cpp>
+  +<TechoBoard.cpp>
   +<helpers/sensors/EnvironmentSensorManager.cpp>
-  +<../variants/techo>
+  +<helpers/ui/GxEPDDisplay.cpp>
+  +<helpers/ui/MomentaryButton.cpp>
+  +<../variants/lilygo_techo>
 lib_deps =
-  ${nrf52840_techo.lib_deps}
+  ${nrf52_base.lib_deps}
   stevemarple/MicroNMEA @ ^2.0.6
   adafruit/Adafruit BME280 Library @ ^2.3.0
+  zinggjm/GxEPD2 @ 1.6.2
+  bakercp/CRC32 @ ^2.0.0
 debug_tool = jlink
 upload_protocol = nrfutil
 
 [env:LilyGo_T-Echo_repeater]
-extends = LilyGo_Techo
-build_src_filter = ${LilyGo_Techo.build_src_filter} +<../examples/simple_repeater/main.cpp>
+extends = LilyGo_T-Echo
+build_src_filter = ${LilyGo_T-Echo.build_src_filter}
+  +<../examples/simple_repeater>
 build_flags =
-  ${LilyGo_Techo.build_flags}
+  ${LilyGo_T-Echo.build_flags}
   -D ADVERT_NAME='"T-Echo Repeater"'
   -D ADVERT_LAT=0.0
   -D ADVERT_LON=0.0
@@ -54,10 +64,11 @@ build_flags =
 ;  -D MESH_DEBUG=1
 
 [env:LilyGo_T-Echo_room_server]
-extends = LilyGo_Techo
-build_src_filter = ${LilyGo_Techo.build_src_filter} +<../examples/simple_room_server/main.cpp>
+extends = LilyGo_T-Echo
+build_src_filter = ${LilyGo_T-Echo.build_src_filter}
+  +<../examples/simple_room_server>
 build_flags =
-  ${LilyGo_Techo.build_flags}
+  ${LilyGo_T-Echo.build_flags}
   -D ADVERT_NAME='"T-Echo Room"'
   -D ADVERT_LAT=0.0
   -D ADVERT_LON=0.0
@@ -66,31 +77,41 @@ build_flags =
 ;  -D MESH_DEBUG=1
 
 [env:LilyGo_T-Echo_companion_radio_ble]
-extends = LilyGo_Techo
+extends = LilyGo_T-Echo
 build_flags =
-  ${LilyGo_Techo.build_flags}
+  ${LilyGo_T-Echo.build_flags}
   -I src/helpers/ui
   -I examples/companion_radio/ui-new
   -D MAX_CONTACTS=100
   -D MAX_GROUP_CHANNELS=8
   -D BLE_PIN_CODE=123456
 ;  -D BLE_DEBUG_LOGGING=1
-  -D DISPLAY_CLASS=GxEPDDisplay
   -D OFFLINE_QUEUE_SIZE=256
-  -D UI_RECENT_LIST_SIZE=9
-  -D BACKLIGHT_BTN=PIN_BUTTON2
-  -D AUTO_OFF_MILLIS=0
 ;  -D MESH_PACKET_LOGGING=1
 ;  -D MESH_DEBUG=1
-build_src_filter = ${LilyGo_Techo.build_src_filter}
-  +<helpers/nrf52/TechoBoard.cpp>
+  -D AUTO_SHUTDOWN_MILLIVOLTS=3300
+build_src_filter = ${LilyGo_T-Echo.build_src_filter}
   +<helpers/nrf52/SerialBLEInterface.cpp>
-  +<helpers/ui/GxEPDDisplay.cpp>
-  +<helpers/ui/MomentaryButton.cpp>
   +<../examples/companion_radio/*.cpp>
   +<../examples/companion_radio/ui-new/*.cpp>
 lib_deps =
-  ${LilyGo_Techo.lib_deps}
+  ${LilyGo_T-Echo.lib_deps}
+  densaugeo/base64 @ ~1.4.0
+
+[env:LilyGo_T-Echo_companion_radio_usb]
+extends = LilyGo_T-Echo
+build_flags =
+  ${LilyGo_T-Echo.build_flags}
+  -I src/helpers/ui
+  -I examples/companion_radio/ui-new
+  -D MAX_CONTACTS=100
+  -D MAX_GROUP_CHANNELS=8
+  -D OFFLINE_QUEUE_SIZE=256
+  -D UI_RECENT_LIST_SIZE=9
+  -D AUTO_SHUTDOWN_MILLIVOLTS=3300
+build_src_filter = ${LilyGo_T-Echo.build_src_filter}
+  +<../examples/companion_radio/*.cpp>
+  +<../examples/companion_radio/ui-new/*.cpp>
+lib_deps =
+  ${LilyGo_T-Echo.lib_deps}
   densaugeo/base64 @ ~1.4.0
-  zinggjm/GxEPD2 @ 1.6.2
-  bakercp/CRC32 @ ^2.0.0

+ 0 - 0
variants/techo/target.cpp → variants/lilygo_techo/target.cpp


+ 1 - 1
variants/techo/target.h → variants/lilygo_techo/target.h

@@ -3,7 +3,7 @@
 #define RADIOLIB_STATIC_ONLY 1
 #include <RadioLib.h>
 #include <helpers/radiolib/RadioLibWrappers.h>
-#include <helpers/nrf52/TechoBoard.h>
+#include <TechoBoard.h>
 #include <helpers/radiolib/CustomSX1262Wrapper.h>
 #include <helpers/AutoDiscoverRTCClock.h>
 #include <helpers/SensorManager.h>

+ 0 - 0
variants/techo/variant.cpp → variants/lilygo_techo/variant.cpp


+ 0 - 0
variants/techo/variant.h → variants/lilygo_techo/variant.h