From 8345c21effe958588ccca3906a24104fd4f476ac Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 20 Jul 2025 20:02:32 -0500 Subject: [PATCH 1/2] STM32 doesn't play --- src/Power.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Power.cpp b/src/Power.cpp index 385cc1a65..ee97eda6e 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -687,7 +687,9 @@ void Power::shutdown() screen->showSimpleBanner("Shutting Down...", 0); // stays on screen } #endif +#ifndef ARCH_STM32 playShutdownMelody(); +#endif nodeDB->saveToDisk(); #if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040) From 8aef3c44f4f060c2008d3c950981d85af3bb5e92 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 20 Jul 2025 20:12:10 -0500 Subject: [PATCH 2/2] Text message rate limiting should return routing error instead (#7365) * Text message rate limiting should return routing error instead * Proper rooting * Update PhoneAPI.cpp * Update PhoneAPI.cpp --- src/mesh/MeshService.cpp | 16 ++++++++++++++++ src/mesh/MeshService.h | 3 +++ src/mesh/PhoneAPI.cpp | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 297c7b2ed..2cc4197c1 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -16,6 +16,7 @@ #include "meshUtils.h" #include "modules/NodeInfoModule.h" #include "modules/PositionModule.h" +#include "modules/RoutingModule.h" #include "power.h" #include #include @@ -333,6 +334,21 @@ void MeshService::sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage fromNum++; } +void MeshService::sendRoutingErrorResponse(meshtastic_Routing_Error error, const meshtastic_MeshPacket *mp) +{ + if (!mp) { + LOG_WARN("Cannot send routing error response: null packet"); + return; + } + + // Use the routing module to send the error response + if (routingModule) { + routingModule->sendAckNak(error, mp->from, mp->id, mp->channel); + } else { + LOG_ERROR("Cannot send routing error response: no routing module"); + } +} + void MeshService::sendClientNotification(meshtastic_ClientNotification *n) { LOG_DEBUG("Send client notification to phone"); diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index e2e430c03..89d3b15d0 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -148,6 +148,9 @@ class MeshService /// Send a ClientNotification to the phone void sendClientNotification(meshtastic_ClientNotification *cn); + /// Send an error response to the phone + void sendRoutingErrorResponse(meshtastic_Routing_Error error, const meshtastic_MeshPacket *mp); + bool isToPhoneQueueEmpty(); ErrorCode sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id); diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 287de38fa..e0b81bedd 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -686,7 +686,8 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p) LOG_WARN("Rate limit portnum %d", p.decoded.portnum); meshtastic_QueueStatus qs = router->getQueueStatus(); service->sendQueueStatusToPhone(qs, 0, p.id); - sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Text messages can only be sent once every 2 seconds"); + service->sendRoutingErrorResponse(meshtastic_Routing_Error_RATE_LIMIT_EXCEEDED, &p); + // sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Text messages can only be sent once every 2 seconds"); return false; } lastPortNumToRadio[p.decoded.portnum] = millis();