From 0265851621b3c0a821a99eaf4d5ab05e811bc623 Mon Sep 17 00:00:00 2001 From: chrisdavis2110 Date: Tue, 28 Apr 2026 21:26:56 -0700 Subject: [PATCH 1/2] added PIN_USER_BTN_ANA for rak3401 companion usb and companion ble --- examples/companion_radio/ui-new/UITask.cpp | 16 ++++++++-------- variants/rak3401/platformio.ini | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 94a8ee3ef..e06a6ecc3 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -146,7 +146,7 @@ class HomeScreen : public UIScreen { bool sensors_scroll = false; int sensors_scroll_offset = 0; int next_sensors_refresh = 0; - + void refresh_sensors() { if (millis() > next_sensors_refresh) { sensors_lpp.reset(); @@ -170,7 +170,7 @@ class HomeScreen : public UIScreen { public: HomeScreen(UITask* task, mesh::RTCClock* rtc, SensorManager* sensors, NodePrefs* node_prefs) - : _task(task), _rtc(rtc), _sensors(sensors), _node_prefs(node_prefs), _page(0), + : _task(task), _rtc(rtc), _sensors(sensors), _node_prefs(node_prefs), _page(0), _shutdown_init(false), sensors_lpp(200) { } void poll() override { @@ -213,7 +213,7 @@ class HomeScreen : public UIScreen { IPAddress ip = WiFi.localIP(); snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); display.setTextSize(1); - display.drawTextCentered(display.width() / 2, 54, tmp); + display.drawTextCentered(display.width() / 2, 54, tmp); #endif if (_task->hasConnection()) { display.setColor(DisplayDriver::GREEN); @@ -241,10 +241,10 @@ class HomeScreen : public UIScreen { } else { sprintf(tmp, "%dh", secs / (60*60)); } - + int timestamp_width = display.getTextWidth(tmp); int max_name_width = display.width() - timestamp_width - 1; - + char filtered_recent_name[sizeof(a->name)]; display.translateUTF8ToBlocks(filtered_recent_name, a->name, sizeof(filtered_recent_name)); display.drawTextEllipsized(0, y, max_name_width, filtered_recent_name); @@ -310,7 +310,7 @@ class HomeScreen : public UIScreen { display.drawTextRightAlign(display.width()-1, y, buf); y = y + 12; display.drawTextLeftAlign(0, y, "pos"); - sprintf(buf, "%.4f %.4f", + sprintf(buf, "%.4f %.4f", nmea->getLatitude()/1000000., nmea->getLongitude()/1000000.); display.drawTextRightAlign(display.width()-1, y, buf); y = y + 12; @@ -741,7 +741,7 @@ void UITask::loop() { #endif #if defined(PIN_USER_BTN_ANA) if (abs(millis() - _analogue_pin_read_millis) > 10) { - ev = analog_btn.check(); + int ev = analog_btn.check(); if (ev == BUTTON_EVENT_CLICK) { c = checkDisplayOn(KEY_NEXT); } else if (ev == BUTTON_EVENT_LONG_PRESS) { @@ -878,7 +878,7 @@ bool UITask::getGPSState() { return !strcmp(_sensors->getSettingValue(i), "1"); } } - } + } return false; } diff --git a/variants/rak3401/platformio.ini b/variants/rak3401/platformio.ini index b3693a58b..1246b7258 100644 --- a/variants/rak3401/platformio.ini +++ b/variants/rak3401/platformio.ini @@ -64,6 +64,7 @@ board_upload.maximum_size = 712704 build_flags = ${rak3401.build_flags} -I examples/companion_radio/ui-new + -D PIN_USER_BTN_ANA=31 -D DISPLAY_CLASS=SSD1306Display -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 @@ -83,6 +84,7 @@ board_upload.maximum_size = 712704 build_flags = ${rak3401.build_flags} -I examples/companion_radio/ui-new + -D PIN_USER_BTN_ANA=31 -D PIN_GPS_EN=-1 -D DISPLAY_CLASS=SSD1306Display -D MAX_CONTACTS=350 From 5fbd473298f0e365e0add4df0c9ff8db5083138c Mon Sep 17 00:00:00 2001 From: chrisdavis2110 Date: Tue, 28 Apr 2026 21:59:10 -0700 Subject: [PATCH 2/2] added PIN_GPS_EN=-1 to rak3401 companion usb --- variants/rak3401/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/rak3401/platformio.ini b/variants/rak3401/platformio.ini index 1246b7258..d94db6a59 100644 --- a/variants/rak3401/platformio.ini +++ b/variants/rak3401/platformio.ini @@ -65,6 +65,7 @@ build_flags = ${rak3401.build_flags} -I examples/companion_radio/ui-new -D PIN_USER_BTN_ANA=31 + -D PIN_GPS_EN=-1 -D DISPLAY_CLASS=SSD1306Display -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40