Skip to content

Commit 0ebca4b

Browse files
authored
Merge pull request #734 from recrof/lilygo_techo_refactor
lilygo t-echo enhancements and cleanup
2 parents ec332c4 + 5b2c171 commit 0ebca4b

File tree

8 files changed

+63
-55
lines changed

8 files changed

+63
-55
lines changed

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ class HomeScreen : public UIScreen {
202202
display.print(tmp);
203203
} else if (_page == HomePage::BLUETOOTH) {
204204
display.setColor(DisplayDriver::GREEN);
205-
display.drawXbm((display.width() - 32) / 2, 18,
206-
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off,
205+
display.drawXbm((display.width() - 32) / 2, 18,
206+
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off,
207207
32, 32);
208208
display.setTextSize(1);
209209
display.drawTextCentered(display.width() / 2, 64 - 11, "toggle: " PRESS_LABEL);
@@ -455,8 +455,8 @@ void UITask::setCurrScreen(UIScreen* c) {
455455
_next_refresh = 100;
456456
}
457457

458-
/*
459-
hardware-agnostic pre-shutdown activity should be done here
458+
/*
459+
hardware-agnostic pre-shutdown activity should be done here
460460
*/
461461
void UITask::shutdown(bool restart){
462462

@@ -584,7 +584,7 @@ void UITask::loop() {
584584

585585
// show low battery shutdown alert
586586
// we should only do this for eink displays, which will persist after power loss
587-
#ifdef THINKNODE_M1
587+
#if defined(THINKNODE_M1) || defined(LILYGO_TECHO)
588588
if (_display != NULL) {
589589
_display->startFrame();
590590
_display->setTextSize(2);
File renamed without changes.

src/helpers/nrf52/TechoBoard.h renamed to variants/lilygo_techo/TechoBoard.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
#include <MeshCore.h>
44
#include <Arduino.h>
55

6-
// LoRa radio module pins for LilyGo T-Echo
7-
#define P_LORA_DIO_1 20
8-
#define P_LORA_NSS 24
9-
#define P_LORA_RESET 25
10-
#define P_LORA_BUSY 17
11-
#define P_LORA_SCLK 19
12-
#define P_LORA_MISO 23
13-
#define P_LORA_MOSI 22
14-
#define SX126X_POWER_EN 37
15-
16-
#define SX126X_DIO2_AS_RF_SWITCH true
17-
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
18-
196
// built-ins
207
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
218

variants/techo/platformio.ini renamed to variants/lilygo_techo/platformio.ini

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
[nrf52840_techo]
1+
[LilyGo_T-Echo]
22
extends = nrf52_base
3-
platform_packages = framework-arduinoadafruitnrf52
3+
board = t-echo
4+
board_build.ldscript = boards/nrf52840_s140_v6.ld
45
build_flags = ${nrf52_base.build_flags}
6+
-I variants/lilygo_techo
57
-I src/helpers/nrf52
68
-I lib/nrf52/s140_nrf52_6.1.1_API/include
79
-I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
8-
lib_deps =
9-
${nrf52_base.lib_deps}
10-
rweather/Crypto @ ^0.4.0
11-
12-
[LilyGo_Techo]
13-
extends = nrf52840_techo
14-
board = t-echo
15-
board_build.ldscript = boards/nrf52840_s140_v6.ld
16-
build_flags = ${nrf52840_techo.build_flags}
17-
-I variants/techo
18-
-DLILYGO_TECHO
10+
-D LILYGO_TECHO
1911
-D RADIO_CLASS=CustomSX1262
2012
-D WRAPPER_CLASS=CustomSX1262Wrapper
2113
-D LORA_TX_POWER=22
14+
-D P_LORA_DIO_1=20
15+
-D P_LORA_NSS=24
16+
-D P_LORA_RESET=25
17+
-D P_LORA_BUSY=17
18+
-D P_LORA_SCLK=19
19+
-D P_LORA_MISO=23
20+
-D P_LORA_MOSI=22
21+
-D SX126X_POWER_EN=37
22+
-D SX126X_DIO2_AS_RF_SWITCH=true
23+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
2224
-D SX126X_CURRENT_LIMIT=140
2325
-D SX126X_RX_BOOSTED_GAIN=1
2426
-D P_LORA_TX_LED=LED_GREEN
@@ -28,23 +30,31 @@ build_flags = ${nrf52840_techo.build_flags}
2830
-D GPS_BAUD_RATE=9600
2931
-D PIN_GPS_EN=GPS_EN
3032
-D TELEM_BME280_ADDRESS=0x77
31-
build_src_filter = ${nrf52840_techo.build_src_filter}
33+
-D DISPLAY_CLASS=GxEPDDisplay
34+
-D BACKLIGHT_BTN=PIN_BUTTON2
35+
-D AUTO_OFF_MILLIS=0
36+
build_src_filter = ${nrf52_base.build_src_filter}
3237
+<helpers/*.cpp>
33-
+<helpers/nrf52/TechoBoard.cpp>
38+
+<TechoBoard.cpp>
3439
+<helpers/sensors/EnvironmentSensorManager.cpp>
35-
+<../variants/techo>
40+
+<helpers/ui/GxEPDDisplay.cpp>
41+
+<helpers/ui/MomentaryButton.cpp>
42+
+<../variants/lilygo_techo>
3643
lib_deps =
37-
${nrf52840_techo.lib_deps}
44+
${nrf52_base.lib_deps}
3845
stevemarple/MicroNMEA @ ^2.0.6
3946
adafruit/Adafruit BME280 Library @ ^2.3.0
47+
zinggjm/GxEPD2 @ 1.6.2
48+
bakercp/CRC32 @ ^2.0.0
4049
debug_tool = jlink
4150
upload_protocol = nrfutil
4251

4352
[env:LilyGo_T-Echo_repeater]
44-
extends = LilyGo_Techo
45-
build_src_filter = ${LilyGo_Techo.build_src_filter} +<../examples/simple_repeater/main.cpp>
53+
extends = LilyGo_T-Echo
54+
build_src_filter = ${LilyGo_T-Echo.build_src_filter}
55+
+<../examples/simple_repeater>
4656
build_flags =
47-
${LilyGo_Techo.build_flags}
57+
${LilyGo_T-Echo.build_flags}
4858
-D ADVERT_NAME='"T-Echo Repeater"'
4959
-D ADVERT_LAT=0.0
5060
-D ADVERT_LON=0.0
@@ -54,10 +64,11 @@ build_flags =
5464
; -D MESH_DEBUG=1
5565

5666
[env:LilyGo_T-Echo_room_server]
57-
extends = LilyGo_Techo
58-
build_src_filter = ${LilyGo_Techo.build_src_filter} +<../examples/simple_room_server/main.cpp>
67+
extends = LilyGo_T-Echo
68+
build_src_filter = ${LilyGo_T-Echo.build_src_filter}
69+
+<../examples/simple_room_server>
5970
build_flags =
60-
${LilyGo_Techo.build_flags}
71+
${LilyGo_T-Echo.build_flags}
6172
-D ADVERT_NAME='"T-Echo Room"'
6273
-D ADVERT_LAT=0.0
6374
-D ADVERT_LON=0.0
@@ -66,31 +77,41 @@ build_flags =
6677
; -D MESH_DEBUG=1
6778

6879
[env:LilyGo_T-Echo_companion_radio_ble]
69-
extends = LilyGo_Techo
80+
extends = LilyGo_T-Echo
7081
build_flags =
71-
${LilyGo_Techo.build_flags}
82+
${LilyGo_T-Echo.build_flags}
7283
-I src/helpers/ui
7384
-I examples/companion_radio/ui-new
7485
-D MAX_CONTACTS=100
7586
-D MAX_GROUP_CHANNELS=8
7687
-D BLE_PIN_CODE=123456
7788
; -D BLE_DEBUG_LOGGING=1
78-
-D DISPLAY_CLASS=GxEPDDisplay
7989
-D OFFLINE_QUEUE_SIZE=256
80-
-D UI_RECENT_LIST_SIZE=9
81-
-D BACKLIGHT_BTN=PIN_BUTTON2
82-
-D AUTO_OFF_MILLIS=0
8390
; -D MESH_PACKET_LOGGING=1
8491
; -D MESH_DEBUG=1
85-
build_src_filter = ${LilyGo_Techo.build_src_filter}
86-
+<helpers/nrf52/TechoBoard.cpp>
92+
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
93+
build_src_filter = ${LilyGo_T-Echo.build_src_filter}
8794
+<helpers/nrf52/SerialBLEInterface.cpp>
88-
+<helpers/ui/GxEPDDisplay.cpp>
89-
+<helpers/ui/MomentaryButton.cpp>
9095
+<../examples/companion_radio/*.cpp>
9196
+<../examples/companion_radio/ui-new/*.cpp>
9297
lib_deps =
93-
${LilyGo_Techo.lib_deps}
98+
${LilyGo_T-Echo.lib_deps}
99+
densaugeo/base64 @ ~1.4.0
100+
101+
[env:LilyGo_T-Echo_companion_radio_usb]
102+
extends = LilyGo_T-Echo
103+
build_flags =
104+
${LilyGo_T-Echo.build_flags}
105+
-I src/helpers/ui
106+
-I examples/companion_radio/ui-new
107+
-D MAX_CONTACTS=100
108+
-D MAX_GROUP_CHANNELS=8
109+
-D OFFLINE_QUEUE_SIZE=256
110+
-D UI_RECENT_LIST_SIZE=9
111+
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
112+
build_src_filter = ${LilyGo_T-Echo.build_src_filter}
113+
+<../examples/companion_radio/*.cpp>
114+
+<../examples/companion_radio/ui-new/*.cpp>
115+
lib_deps =
116+
${LilyGo_T-Echo.lib_deps}
94117
densaugeo/base64 @ ~1.4.0
95-
zinggjm/GxEPD2 @ 1.6.2
96-
bakercp/CRC32 @ ^2.0.0
File renamed without changes.

variants/techo/target.h renamed to variants/lilygo_techo/target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
55
#include <helpers/radiolib/RadioLibWrappers.h>
6-
#include <helpers/nrf52/TechoBoard.h>
6+
#include <TechoBoard.h>
77
#include <helpers/radiolib/CustomSX1262Wrapper.h>
88
#include <helpers/AutoDiscoverRTCClock.h>
99
#include <helpers/SensorManager.h>
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)