Skip to content

Commit 2522492

Browse files
authored
Merge pull request #2436 from chrisdavis2110/rak3401-comp-ana-button
feat: Add support for PIN_USER_BTN_ANA on rak3401 companion usb and companion ble envs
2 parents 2f6ca73 + 5fbd473 commit 2522492

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class HomeScreen : public UIScreen {
154154
bool sensors_scroll = false;
155155
int sensors_scroll_offset = 0;
156156
int next_sensors_refresh = 0;
157-
157+
158158
void refresh_sensors() {
159159
if (millis() > next_sensors_refresh) {
160160
sensors_lpp.reset();
@@ -178,7 +178,7 @@ class HomeScreen : public UIScreen {
178178

179179
public:
180180
HomeScreen(UITask* task, mesh::RTCClock* rtc, SensorManager* sensors, NodePrefs* node_prefs)
181-
: _task(task), _rtc(rtc), _sensors(sensors), _node_prefs(node_prefs), _page(0),
181+
: _task(task), _rtc(rtc), _sensors(sensors), _node_prefs(node_prefs), _page(0),
182182
_shutdown_init(false), sensors_lpp(200) { }
183183

184184
void poll() override {
@@ -221,7 +221,7 @@ class HomeScreen : public UIScreen {
221221
IPAddress ip = WiFi.localIP();
222222
snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
223223
display.setTextSize(1);
224-
display.drawTextCentered(display.width() / 2, 54, tmp);
224+
display.drawTextCentered(display.width() / 2, 54, tmp);
225225
#endif
226226
if (_task->hasConnection()) {
227227
display.setColor(DisplayDriver::GREEN);
@@ -249,10 +249,10 @@ class HomeScreen : public UIScreen {
249249
} else {
250250
sprintf(tmp, "%dh", secs / (60*60));
251251
}
252-
252+
253253
int timestamp_width = display.getTextWidth(tmp);
254254
int max_name_width = display.width() - timestamp_width - 1;
255-
255+
256256
char filtered_recent_name[sizeof(a->name)];
257257
display.translateUTF8ToBlocks(filtered_recent_name, a->name, sizeof(filtered_recent_name));
258258
display.drawTextEllipsized(0, y, max_name_width, filtered_recent_name);
@@ -318,7 +318,7 @@ class HomeScreen : public UIScreen {
318318
display.drawTextRightAlign(display.width()-1, y, buf);
319319
y = y + 12;
320320
display.drawTextLeftAlign(0, y, "pos");
321-
sprintf(buf, "%.4f %.4f",
321+
sprintf(buf, "%.4f %.4f",
322322
nmea->getLatitude()/1000000., nmea->getLongitude()/1000000.);
323323
display.drawTextRightAlign(display.width()-1, y, buf);
324324
y = y + 12;
@@ -749,7 +749,7 @@ void UITask::loop() {
749749
#endif
750750
#if defined(PIN_USER_BTN_ANA)
751751
if (abs(millis() - _analogue_pin_read_millis) > 10) {
752-
ev = analog_btn.check();
752+
int ev = analog_btn.check();
753753
if (ev == BUTTON_EVENT_CLICK) {
754754
c = checkDisplayOn(KEY_NEXT);
755755
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
@@ -886,7 +886,7 @@ bool UITask::getGPSState() {
886886
return !strcmp(_sensors->getSettingValue(i), "1");
887887
}
888888
}
889-
}
889+
}
890890
return false;
891891
}
892892

variants/rak3401/platformio.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ board_upload.maximum_size = 712704
6464
build_flags =
6565
${rak3401.build_flags}
6666
-I examples/companion_radio/ui-new
67+
-D PIN_USER_BTN_ANA=31
68+
-D PIN_GPS_EN=-1
6769
-D DISPLAY_CLASS=SSD1306Display
6870
-D MAX_CONTACTS=350
6971
-D MAX_GROUP_CHANNELS=40
@@ -83,6 +85,7 @@ board_upload.maximum_size = 712704
8385
build_flags =
8486
${rak3401.build_flags}
8587
-I examples/companion_radio/ui-new
88+
-D PIN_USER_BTN_ANA=31
8689
-D PIN_GPS_EN=-1
8790
-D DISPLAY_CLASS=SSD1306Display
8891
-D MAX_CONTACTS=350

0 commit comments

Comments
 (0)