Skip to content

Commit 1b93cea

Browse files
authored
Merge pull request #588 from liamcottle/feature/new-companion-ui-thinknode-m1
add support for new companion ui on thinknode m1
2 parents 4b95c98 + 8d7a498 commit 1b93cea

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

examples/companion_radio/UITask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class MsgPreviewScreen : public UIScreen {
305305
} else {
306306
sprintf(tmp, "%dh", secs / (60*60));
307307
}
308-
display.setCursor(display.width() - display.getTextWidth(tmp), 0);
308+
display.setCursor(display.width() - display.getTextWidth(tmp) - 2, 0);
309309
display.print(tmp);
310310

311311
display.drawRect(0, 11, display.width(), 1); // horiz line

src/helpers/ui/GxEPDDisplay.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ void GxEPDDisplay::setTextSize(int sz) {
6868
}
6969

7070
void GxEPDDisplay::setColor(Color c) {
71+
// colours need to be inverted for epaper displays
7172
if (c == DARK) {
72-
display.setTextColor(_curr_color = GxEPD_BLACK);
73-
} else {
7473
display.setTextColor(_curr_color = GxEPD_WHITE);
74+
} else {
75+
display.setTextColor(_curr_color = GxEPD_BLACK);
7576
}
7677
}
7778

variants/thinknode_m1/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ build_src_filter = ${ThinkNode_M1.build_src_filter}
8383
+<helpers/nrf52/SerialBLEInterface.cpp>
8484
+<helpers/ui/GxEPDDisplay.cpp>
8585
+<helpers/ui/buzzer.cpp>
86+
+<helpers/ui/MomentaryButton.cpp>
8687
+<../examples/companion_radio>
8788
lib_deps =
8889
${ThinkNode_M1.lib_deps}

variants/thinknode_m1/target.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ThinkNodeM1SensorManager sensors = ThinkNodeM1SensorManager(nmea);
1616

1717
#ifdef DISPLAY_CLASS
1818
DISPLAY_CLASS display;
19+
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
1920
#endif
2021

2122
bool radio_init() {

variants/thinknode_m1/target.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <helpers/sensors/LocationProvider.h>
1111
#ifdef DISPLAY_CLASS
1212
#include <helpers/ui/GxEPDDisplay.h>
13+
#include <helpers/ui/MomentaryButton.h>
1314
#endif
1415

1516
class ThinkNodeM1SensorManager : public SensorManager {
@@ -37,6 +38,7 @@ extern ThinkNodeM1SensorManager sensors;
3738

3839
#ifdef DISPLAY_CLASS
3940
extern DISPLAY_CLASS display;
41+
extern MomentaryButton user_btn;
4042
#endif
4143

4244
bool radio_init();

0 commit comments

Comments
 (0)