From a5ed6072612fae716336024d0b75ad46b89870de Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 13 Mar 2021 08:29:32 +0800 Subject: [PATCH 1/5] fix memory corruption in storeandforward --- src/plugins/esp32/StoreForwardPlugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index 897a2c94a..7cb2862eb 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -227,14 +227,14 @@ void StoreForwardPlugin::sawNodeReport() MeshPacket *StoreForwardPluginRadio::allocReply() { - //auto reply = allocDataPacket(); // Allocate a packet for sending - //return reply; + auto reply = allocDataPacket(); // Allocate a packet for sending + return reply; // attn @mc-hamster this code was commented out and was causing memory corruption } void StoreForwardPluginRadio::sendPayload(NodeNum dest, bool wantReplies) { - MeshPacket *p = this->allocReply(); /* + MeshPacket *p = this->allocReply(); // attn @mc-hamster, I moved inside the commented block to prevent leaking memory p->to = dest; p->decoded.want_response = wantReplies; From 3e6817cd18f0a4b745e48d1f2f4d937acaa5e232 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 13 Mar 2021 08:29:58 +0800 Subject: [PATCH 2/5] fix board reboot due to forwarding packets we don't have keys for --- src/mesh/ReliableRouter.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 4d4845949..28ad65bfa 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -34,11 +34,19 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) // We are seeing someone rebroadcast one of our broadcast attempts. // If this is the first time we saw this, cancel any retransmissions we have queued up and generate an internal ack for // the original sending process. - if (stopRetransmission(getFrom(p), p->id)) { + + // FIXME - we might want to turn off this "optimization", it does save lots of airtime but it assumes that once we've heard one + // one adjacent node hear our packet that a) probably other adjacent nodes heard it and b) we can trust those nodes to reach + // our destination. Both of which might be incorrect. + auto key = GlobalPacketId(getFrom(p), p->id); + auto old = findPendingPacket(key); + if (old) { DEBUG_MSG("generating implicit ack\n"); // NOTE: we do NOT check p->wantAck here because p is the INCOMING rebroadcast and that packet is not expected to be // marked as wantAck - sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel); + sendAckNak(Routing_Error_NONE, getFrom(p), p->id, old->packet->channel); + + stopRetransmission(key); } } From cdd696c1ff78b0280e45a8c71f4a4681ccbfc016 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 13 Mar 2021 08:30:07 +0800 Subject: [PATCH 3/5] todo updates --- docs/software/TODO.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 9b1e77f69..3a768e68f 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,6 +4,9 @@ You probably don't care about this section - skip to the next one. ## 1.2 cleanup & multichannel support: +* timestamps on oled screen are wrong - don't seem to be updating based on message rx +* luxon bug report - seeing rx acks for nodes that are not on the network +* channel hash suffixes are wrong on android * cdcacm bug on nrf52: emittx thinks it emitted but client sees nothing. works again later * nrf52: segger logs have errors in formatting that should be impossible (because not going through serial, try stalling on segger) * DONE call RouterPlugin for *all* packets - not just Router packets From c227143b5385faac629cb7bbd47a9efc5f336641 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 13 Mar 2021 08:41:50 +0800 Subject: [PATCH 4/5] @mc-hamster, I think storeandforward was accidentally wrong (no worries though) --- proto | 2 +- src/mesh/generated/radioconfig.pb.h | 12 ++++++------ src/plugins/esp32/StoreForwardPlugin.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/proto b/proto index e63f9713f..bf8ac6718 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit e63f9713f73ea5c9308b7822602ea75f506b6b00 +Subproject commit bf8ac6718c08fe7c94a9896d91ef85572694f7b0 diff --git a/src/mesh/generated/radioconfig.pb.h b/src/mesh/generated/radioconfig.pb.h index 9ea021f13..12224b99b 100644 --- a/src/mesh/generated/radioconfig.pb.h +++ b/src/mesh/generated/radioconfig.pb.h @@ -104,7 +104,6 @@ typedef struct _RadioConfig_UserPreferences { bool range_test_plugin_enabled; uint32_t range_test_plugin_sender; bool range_test_plugin_save; - bool store_forward_plugin_enabled; uint32_t store_forward_plugin_records; bool environmental_measurement_plugin_measurement_enabled; bool environmental_measurement_plugin_screen_enabled; @@ -114,6 +113,7 @@ typedef struct _RadioConfig_UserPreferences { bool environmental_measurement_plugin_display_farenheit; RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType environmental_measurement_plugin_sensor_type; uint32_t environmental_measurement_plugin_sensor_pin; + bool store_forward_plugin_enabled; } RadioConfig_UserPreferences; typedef struct _RadioConfig { @@ -150,9 +150,9 @@ extern "C" { /* Initializer values for message structs */ #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default} -#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0} +#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero} -#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0} +#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define RadioConfig_UserPreferences_position_broadcast_secs_tag 1 @@ -195,7 +195,6 @@ extern "C" { #define RadioConfig_UserPreferences_range_test_plugin_enabled_tag 132 #define RadioConfig_UserPreferences_range_test_plugin_sender_tag 133 #define RadioConfig_UserPreferences_range_test_plugin_save_tag 134 -#define RadioConfig_UserPreferences_store_forward_plugin_enabled_tag 136 #define RadioConfig_UserPreferences_store_forward_plugin_records_tag 137 #define RadioConfig_UserPreferences_environmental_measurement_plugin_measurement_enabled_tag 140 #define RadioConfig_UserPreferences_environmental_measurement_plugin_screen_enabled_tag 141 @@ -205,6 +204,7 @@ extern "C" { #define RadioConfig_UserPreferences_environmental_measurement_plugin_display_farenheit_tag 145 #define RadioConfig_UserPreferences_environmental_measurement_plugin_sensor_type_tag 146 #define RadioConfig_UserPreferences_environmental_measurement_plugin_sensor_pin_tag 147 +#define RadioConfig_UserPreferences_store_forward_plugin_enabled_tag 148 #define RadioConfig_preferences_tag 1 /* Struct field encoding specification for nanopb */ @@ -255,7 +255,6 @@ X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_bell, 131) \ X(a, STATIC, SINGULAR, BOOL, range_test_plugin_enabled, 132) \ X(a, STATIC, SINGULAR, UINT32, range_test_plugin_sender, 133) \ X(a, STATIC, SINGULAR, BOOL, range_test_plugin_save, 134) \ -X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_enabled, 136) \ X(a, STATIC, SINGULAR, UINT32, store_forward_plugin_records, 137) \ X(a, STATIC, SINGULAR, BOOL, environmental_measurement_plugin_measurement_enabled, 140) \ X(a, STATIC, SINGULAR, BOOL, environmental_measurement_plugin_screen_enabled, 141) \ @@ -264,7 +263,8 @@ X(a, STATIC, SINGULAR, UINT32, environmental_measurement_plugin_update_inter X(a, STATIC, SINGULAR, UINT32, environmental_measurement_plugin_recovery_interval, 144) \ X(a, STATIC, SINGULAR, BOOL, environmental_measurement_plugin_display_farenheit, 145) \ X(a, STATIC, SINGULAR, UENUM, environmental_measurement_plugin_sensor_type, 146) \ -X(a, STATIC, SINGULAR, UINT32, environmental_measurement_plugin_sensor_pin, 147) +X(a, STATIC, SINGULAR, UINT32, environmental_measurement_plugin_sensor_pin, 147) \ +X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_enabled, 148) #define RadioConfig_UserPreferences_CALLBACK NULL #define RadioConfig_UserPreferences_DEFAULT NULL diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index 7cb2862eb..28f1c6738 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -24,10 +24,13 @@ int32_t StoreForwardPlugin::runOnce() /* Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. - */ + attn @mc-hamster I moved this back inside the comment because I don't think it was intended to checkin. It was forcing all + nodes to be running this and turning off is_router. + radioConfig.preferences.store_forward_plugin_enabled = 1; - radioConfig.preferences.is_router = 0; + radioConfig.preferences.is_router = 0; + */ if (radioConfig.preferences.store_forward_plugin_enabled) { From 6dd65adebd42045ff304fc93207a5ebcf9b92a40 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 13 Mar 2021 08:54:02 +0800 Subject: [PATCH 5/5] 1.2.10 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 8f23a55a3..e615e8b4b 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 9 +build = 10