From de116839b4f9a8dad3f0651d37c28ba91f0de470 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 20 Dec 2024 19:19:50 -0600 Subject: [PATCH] Clean up some straggler NRF52 json --- lib/device-ui | 1 + src/mqtt/MQTT.cpp | 8 +++++++- src/mqtt/MQTT.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 160000 lib/device-ui diff --git a/lib/device-ui b/lib/device-ui new file mode 160000 index 0000000000..6b760f5373 --- /dev/null +++ b/lib/device-ui @@ -0,0 +1 @@ +Subproject commit 6b760f5373b91de1d8234922a446f7232d5247d0 diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index ac4e9e786f..e1481d42ce 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -19,8 +19,10 @@ #include #endif #include "Default.h" +#if !defined(ARCH_NRF52) || NRF52_USE_JSON #include "serialization/JSON.h" #include "serialization/MeshPacketSerializer.h" +#endif #include #include #include @@ -119,6 +121,7 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length) router->enqueueReceivedMessage(p.release()); } +#if !defined(ARCH_NRF52) || NRF52_USE_JSON // returns true if this is a valid JSON envelope which we accept on downlink inline bool isValidJsonEnvelope(JSONObject &json) { @@ -204,6 +207,7 @@ inline void onReceiveJson(byte *payload, size_t length) LOG_DEBUG("JSON ignore downlink message with unsupported type"); } } +#endif /// Determines if the given IPAddress is a private IPv4 address, i.e. not routable on the public internet. bool isPrivateIpAddress(const IPAddress &ip) @@ -248,6 +252,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length) // check if this is a json payload message by comparing the topic start if (moduleConfig.mqtt.json_enabled && (strncmp(topic, jsonTopic.c_str(), jsonTopic.length()) == 0)) { +#if !defined(ARCH_NRF52) || NRF52_USE_JSON // parse the channel name from the topic string // the topic has been checked above for having jsonTopic prefix, so just move past it char *channelName = topic + jsonTopic.length(); @@ -261,6 +266,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length) return; } onReceiveJson(payload, length); +#endif return; } @@ -745,4 +751,4 @@ void MQTT::perhapsReportToMap() // Update the last report time last_report_to_map = millis(); -} +} \ No newline at end of file diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 11621c55f3..81892f6f38 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -5,7 +5,9 @@ #include "concurrency/OSThread.h" #include "mesh/Channels.h" #include "mesh/generated/meshtastic/mqtt.pb.h" +#if !defined(ARCH_NRF52) || NRF52_USE_JSON #include "serialization/JSON.h" +#endif #if HAS_WIFI #include #if !defined(ARCH_PORTDUINO) @@ -127,4 +129,4 @@ class MQTT : private concurrency::OSThread void mqttInit(); -extern MQTT *mqtt; +extern MQTT *mqtt; \ No newline at end of file