From 9eb9c473db7f83bf97bcc381794beee8c513744e Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 11:43:28 +0800 Subject: [PATCH 1/6] add note about credit! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c33d0f45..7bbed4283 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ We'd love to have you join us on this merry little project. Please see our [deve # Credits -This project is run by volunteers. Past contributors include: +This project is run by volunteers. We are a friendly group and welcome any contribution (code fixes, documentation, features, bug reports etc...). We try to be good about listing contributor names in release notes, but it has become unwieldy for the main-devs to keep updating the list below and we've neglected it too long. If you'd like your name included in this list please send a pull request to edit this README and simply add your line yourself. Thank you very much for your help! - @astro-arphid: Added support for 433MHz radios in europe. - @claesg: Various documentation fixes and 3D print enclosures From 4e87c4411c836fc26c68f64cbc23409471faa9e9 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 11:44:19 +0800 Subject: [PATCH 2/6] fix serious nak bug reported by @havealoha and @luxoon --- src/mesh/MeshPlugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/MeshPlugin.cpp b/src/mesh/MeshPlugin.cpp index 2081def6e..e97836c09 100644 --- a/src/mesh/MeshPlugin.cpp +++ b/src/mesh/MeshPlugin.cpp @@ -36,6 +36,7 @@ MeshPacket *MeshPlugin::allocAckNak(Routing_Error err, NodeNum to, PacketId idFr Routing c = Routing_init_default; c.error_reason = err; + c.which_variant = Routing_error_reason_tag; // Now that we have moded sendAckNak up one level into the class heirarchy we can no longer assume we are a RoutingPlugin // So we manually call pb_encode_to_bytes and specify routing port number From fc965003296788501c98826cabbc90bdd6b2f9c0 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 12:06:16 +0800 Subject: [PATCH 3/6] fix unused prefs field --- src/mesh/http/ContentHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 6bd7b8dd9..9f55e9c36 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -840,7 +840,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res) Preferences preferences; preferences.begin("meshtastic", false); - uint32_t rebootCounter = preferences.getUInt("rebootCounter", 0); + // uint32_t rebootCounter = preferences.getUInt("rebootCounter", 0); if (!params->getQueryParameter("content", content)) { content = "json"; From c7f411fc7c5cbd2e5e90d384c87308b5571d53ce Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 12:07:43 +0800 Subject: [PATCH 4/6] remove unused Preferences code (cc @mc-hamster for review) (noticed because of a compiler warning) --- src/mesh/http/ContentHandler.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 9f55e9c36..851f06abe 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #ifndef NO_ESP32 @@ -837,11 +836,6 @@ void handleReport(HTTPRequest *req, HTTPResponse *res) ResourceParameters *params = req->getParams(); std::string content; - Preferences preferences; - preferences.begin("meshtastic", false); - - // uint32_t rebootCounter = preferences.getUInt("rebootCounter", 0); - if (!params->getQueryParameter("content", content)) { content = "json"; } From 525fe9b96cd527f109c256d26e438c234775ec59 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 12:16:37 +0800 Subject: [PATCH 5/6] dramatically speed up message RX in some cases (we were sleeping much too long) --- docs/software/TODO.md | 1 + src/concurrency/NotifiedWorkerThread.cpp | 2 ++ src/graphics/Screen.cpp | 2 ++ src/main.cpp | 9 ++++++++- src/main.h | 4 ++++ src/mesh/ReliableRouter.h | 6 +++--- src/mesh/Router.cpp | 5 +++++ 7 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 5c09e9b54..828f4f933 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,6 +4,7 @@ You probably don't care about this section - skip to the next one. ## before next release +* DONE naks are being dropped (though enqueuedLocal) sometimes before phone/PC gets them * DONE have android fill in if local GPS has poor signal * fix heltec battery scaling * add reference counting to mesh packets diff --git a/src/concurrency/NotifiedWorkerThread.cpp b/src/concurrency/NotifiedWorkerThread.cpp index aaac07f59..78c15a6d0 100644 --- a/src/concurrency/NotifiedWorkerThread.cpp +++ b/src/concurrency/NotifiedWorkerThread.cpp @@ -1,5 +1,6 @@ #include "NotifiedWorkerThread.h" #include "configuration.h" +#include "main.h" #include namespace concurrency @@ -28,6 +29,7 @@ IRAM_ATTR bool NotifiedWorkerThread::notifyCommon(uint32_t v, bool overwrite) if (overwrite || notification == 0) { enabled = true; setInterval(0); // Run ASAP + runASAP = true; notification = v; if (debugNotification) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 9698f41b1..c7580f02d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -717,6 +717,7 @@ void Screen::handleSetOn(bool on) dispdev.displayOn(); enabled = true; setInterval(0); // Draw ASAP + runASAP = true; } else { DEBUG_MSG("Turning off screen\n"); dispdev.displayOff(); @@ -1053,6 +1054,7 @@ void Screen::setFastFramerate() targetFramerate = SCREEN_TRANSITION_FRAMERATE; ui.setTargetFPS(targetFramerate); setInterval(0); // redraw ASAP + runASAP = true; } void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) diff --git a/src/main.cpp b/src/main.cpp index 7ce86ffc0..ba99c88aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -590,8 +590,14 @@ void rebootCheck() } } +// If a thread does something that might need for it to be rescheduled ASAP it can set this flag +// This will supress the current delay and instead try to run ASAP. +bool runASAP; + void loop() { + runASAP = false; + // axpDebugOutput.loop(); // heap_caps_check_integrity_all(true); // FIXME - disable this expensive check @@ -627,6 +633,7 @@ void loop() mainController.nextThread->tillRun(millis())); */ // We want to sleep as long as possible here - because it saves power - mainDelay.delay(delayMsec); + if (!runASAP) + mainDelay.delay(delayMsec); // if (didWake) DEBUG_MSG("wake!\n"); } diff --git a/src/main.h b/src/main.h index 1a6dfe439..0c5cb349c 100644 --- a/src/main.h +++ b/src/main.h @@ -22,4 +22,8 @@ const char *getDeviceName(); extern uint32_t rebootAtMsec; +// If a thread does something that might need for it to be rescheduled ASAP it can set this flag +// This will supress the current delay and instead try to run ASAP. +extern bool runASAP; + void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(); diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index db161b984..7299d1c18 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -79,9 +79,10 @@ class ReliableRouter : public FloodingRouter /** Do our retransmission handling */ virtual int32_t runOnce() { - auto d = FloodingRouter::runOnce(); + // Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation + auto d = doRetransmissions(); - int32_t r = doRetransmissions(); + int32_t r = FloodingRouter::runOnce(); return min(d, r); } @@ -109,7 +110,6 @@ class ReliableRouter : public FloodingRouter PendingPacket *startRetransmission(MeshPacket *p); private: - /** * Stop any retransmissions we are doing of the specified node/packet ID pair * diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index fe207de1e..5582b77d3 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -4,6 +4,7 @@ #include "NodeDB.h" #include "RTC.h" #include "configuration.h" +#include "main.h" #include "mesh-pb-constants.h" #include "plugins/RoutingPlugin.h" @@ -55,9 +56,11 @@ int32_t Router::runOnce() { MeshPacket *mp; while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { + // printPacket("handle fromRadioQ", mp); perhapsHandleReceived(mp); } + // DEBUG_MSG("sleeping forever!\n"); return INT32_MAX; // Wait a long time - until we get woken for the message queue } @@ -117,7 +120,9 @@ void Router::abortSendAndNak(Routing_Error err, MeshPacket *p) void Router::setReceivedMessage() { + // DEBUG_MSG("set interval to ASAP\n"); setInterval(0); // Run ASAP, so we can figure out our correct sleep time + runASAP = true; } ErrorCode Router::sendLocal(MeshPacket *p) From 7e600787912a714d4b258da92e509b3189866613 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 28 Mar 2021 12:19:49 +0800 Subject: [PATCH 6/6] 1.2.17 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 71cb4d0eb..6a086e6a3 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 16 +build = 17