Skip to content

Commit 17b709c

Browse files
committed
T1000-E: switch to ui-new
The compiler is switched from `examples/companion_radio/ui-orig` to `examples/companion_radio/ui-new`. The handling of the momentary button was switched from `T1000eBoard::buttonStateChanged()` to a `MomentaryButton` in `variants/t1000-e/target.cpp`. Everything still seems to work properly. I briefly tested the room server and repeater modes, and did a bit more testing of the companion (USB & BLE) modes.
1 parent 3a4e9e7 commit 17b709c

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

variants/t1000-e/T1000eBoard.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
void T1000eBoard::begin() {
77
NRF52BoardDCDC::begin();
8-
btn_prev_state = HIGH;
98

109
#ifdef BUTTON_PIN
1110
pinMode(BATTERY_PIN, INPUT);
12-
pinMode(BUTTON_PIN, INPUT);
1311
pinMode(LED_PIN, OUTPUT);
1412
#endif
1513

variants/t1000-e/T1000eBoard.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class T1000eBoard : public NRF52BoardDCDC {
88
protected:
9-
uint8_t btn_prev_state;
109

1110
public:
1211
T1000eBoard() : NRF52Board("T1000E_OTA") {}
@@ -38,17 +37,6 @@ class T1000eBoard : public NRF52BoardDCDC {
3837
return "Seeed Tracker T1000-E";
3938
}
4039

41-
int buttonStateChanged() {
42-
#ifdef BUTTON_PIN
43-
uint8_t v = digitalRead(BUTTON_PIN);
44-
if (v != btn_prev_state) {
45-
btn_prev_state = v;
46-
return (v == LOW) ? 1 : -1;
47-
}
48-
#endif
49-
return 0;
50-
}
51-
5240
void powerOff() override {
5341
#ifdef HAS_GPS
5442
digitalWrite(GPS_VRTC_EN, LOW);

variants/t1000-e/platformio.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ upload_protocol = nrfutil
3737
[env:t1000e_repeater]
3838
extends = t1000-e
3939
build_flags = ${t1000-e.build_flags}
40-
-I examples/companion_radio/ui-orig
40+
-I examples/companion_radio/ui-new
4141
-D ADVERT_NAME='"t1000-e Repeater"'
4242
-D ADVERT_LAT=0.0
4343
-D ADVERT_LON=0.0
@@ -53,7 +53,7 @@ lib_deps = ${t1000-e.lib_deps}
5353
[env:t1000e_room_server]
5454
extends = t1000-e
5555
build_flags = ${t1000-e.build_flags}
56-
-I examples/companion_radio/ui-orig
56+
-I examples/companion_radio/ui-new
5757
-D ADVERT_NAME='"t1000-e Room"'
5858
-D ADVERT_LAT=0.0
5959
-D ADVERT_LON=0.0
@@ -72,7 +72,7 @@ extends = t1000-e
7272
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
7373
board_upload.maximum_size = 708608
7474
build_flags = ${t1000-e.build_flags}
75-
-I examples/companion_radio/ui-orig
75+
-I examples/companion_radio/ui-new
7676
-D MAX_CONTACTS=350
7777
-D MAX_GROUP_CHANNELS=40
7878
; -D MESH_PACKET_LOGGING=1
@@ -84,7 +84,7 @@ build_flags = ${t1000-e.build_flags}
8484
build_src_filter = ${t1000-e.build_src_filter}
8585
+<helpers/ui/buzzer.cpp>
8686
+<../examples/companion_radio/*.cpp>
87-
+<../examples/companion_radio/ui-orig/*.cpp>
87+
+<../examples/companion_radio/ui-new/*.cpp>
8888
lib_deps = ${t1000-e.lib_deps}
8989
densaugeo/base64 @ ~1.4.0
9090
stevemarple/MicroNMEA @ ^2.0.6
@@ -95,7 +95,7 @@ extends = t1000-e
9595
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
9696
board_upload.maximum_size = 708608
9797
build_flags = ${t1000-e.build_flags}
98-
-I examples/companion_radio/ui-orig
98+
-I examples/companion_radio/ui-new
9999
-D MAX_CONTACTS=350
100100
-D MAX_GROUP_CHANNELS=40
101101
-D BLE_PIN_CODE=123456
@@ -112,7 +112,7 @@ build_src_filter = ${t1000-e.build_src_filter}
112112
+<helpers/nrf52/SerialBLEInterface.cpp>
113113
+<helpers/ui/buzzer.cpp>
114114
+<../examples/companion_radio/*.cpp>
115-
+<../examples/companion_radio/ui-orig/*.cpp>
115+
+<../examples/companion_radio/ui-new/*.cpp>
116116
lib_deps = ${t1000-e.lib_deps}
117117
densaugeo/base64 @ ~1.4.0
118118
stevemarple/MicroNMEA @ ^2.0.6

variants/t1000-e/target.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ T1000SensorManager sensors = T1000SensorManager(nmea);
1717
DISPLAY_CLASS display;
1818
#endif
1919

20+
#ifdef PIN_USER_BTN
21+
MomentaryButton user_btn(PIN_USER_BTN,
22+
/*long_press_mills=*/1000,
23+
/*reverse=*/(USER_BTN_PRESSED==LOW),
24+
/*pulldownup=*/false,
25+
/*multiclick=*/true);
26+
#endif
27+
2028
#ifndef LORA_CR
2129
#define LORA_CR 5
2230
#endif

variants/t1000-e/target.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#ifdef DISPLAY_CLASS
1212
#include "NullDisplayDriver.h"
1313
#endif
14+
#ifdef PIN_USER_BTN
15+
#include <helpers/ui/MomentaryButton.h>
16+
#endif
1417

1518
class T1000SensorManager: public SensorManager {
1619
bool gps_active = false;
@@ -35,6 +38,10 @@ class T1000SensorManager: public SensorManager {
3538
extern NullDisplayDriver display;
3639
#endif
3740

41+
#ifdef PIN_USER_BTN
42+
extern MomentaryButton user_btn;
43+
#endif
44+
3845
extern T1000eBoard board;
3946
extern WRAPPER_CLASS radio_driver;
4047
extern VolatileRTCClock rtc_clock;

0 commit comments

Comments
 (0)