From c0fdf227b72076569860961725afd9bfed260182 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Feb 2020 16:27:29 -0800 Subject: [PATCH] properly show plaintext msgs on oled --- .vscode/extensions.json | 12 ++++++------ src/NodeDB.cpp | 4 +++- src/configuration.h | 4 ++-- src/main.ino | 2 ++ src/screen.cpp | 7 ++++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8281e64cc..0f0d7401d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,7 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ] -} \ No newline at end of file + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} diff --git a/src/NodeDB.cpp b/src/NodeDB.cpp index 91f359f04..312976bc3 100644 --- a/src/NodeDB.cpp +++ b/src/NodeDB.cpp @@ -250,6 +250,7 @@ void NodeDB::updateFrom(const MeshPacket &mp) case SubPacket_data_tag: { // Keep a copy of the most recent text message. if(p.variant.data.typ == Data_Type_CLEAR_TEXT) { + DEBUG_MSG("Received text msg from=0%0x, msg=%.*s\n", mp.from, p.variant.data.payload.size, p.variant.data.payload.bytes); devicestate.rx_text_message = mp; devicestate.has_rx_text_message = true; updateTextMessage = true; @@ -271,8 +272,9 @@ void NodeDB::updateFrom(const MeshPacket &mp) { updateGUIforNode = info; + // Not really needed - we will save anyways when we go to sleep // We just changed something important about the user, store our DB - saveToDisk(); + // saveToDisk(); } break; } diff --git a/src/configuration.h b/src/configuration.h index 36171b9ce..783b9044f 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -41,8 +41,8 @@ along with this program. If not, see . // Select which board is being used. If the outside build environment has sent a choice, just use that #if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32) -#define T_BEAM_V10 // AKA Rev1 (second board released) -//#define HELTEC_LORA32 +//#define T_BEAM_V10 // AKA Rev1 (second board released) +#define HELTEC_LORA32 #endif // If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled) diff --git a/src/main.ino b/src/main.ino index d74689ee6..caf3f53e7 100644 --- a/src/main.ino +++ b/src/main.ino @@ -422,11 +422,13 @@ uint32_t ledBlinker() digitalWrite(LED_PIN, ledOn); #endif +#ifdef T_BEAM_V10 if (axp192_found) { // blink the axp led axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF); } +#endif // have a very sparse duty cycle of LED being on, unless charging, then blink 0.5Hz square wave rate to indicate that return isCharging ? 1000 : (ledOn ? 2 : 1000); diff --git a/src/screen.cpp b/src/screen.cpp index 0a3f87fc9..3d5023fd5 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -542,7 +542,7 @@ uint32_t screen_loop() if (!disp) // If we don't have a screen, don't ever spend any CPU for us return UINT32_MAX; - if (wakeScreen) + if (wakeScreen || nodeDB.updateTextMessage) // If a new text message arrived, turn the screen on immedately { screen_on(); // make sure the screen is not asleep wakeScreen = false; @@ -570,10 +570,11 @@ uint32_t screen_loop() else // standard screen loop handling ehre { // If the # nodes changes, we need to regen our list of screens - if (nodeDB.updateGUI) + if (nodeDB.updateGUI || nodeDB.updateTextMessage) { - nodeDB.updateGUI = false; screen_set_frames(); + nodeDB.updateGUI = false; + nodeDB.updateTextMessage = false; } if (millis() - lastPressMs > SCREEN_SLEEP_MS)