Skip to content

Commit f39a9c5

Browse files
authored
Clean up some straggler NRF52 json (#5628)
1 parent 398d290 commit f39a9c5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/mqtt/MQTT.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
#include <WiFi.h>
2020
#endif
2121
#include "Default.h"
22+
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
2223
#include "serialization/JSON.h"
2324
#include "serialization/MeshPacketSerializer.h"
25+
#endif
2426
#include <Throttle.h>
2527
#include <assert.h>
2628
#include <pb_decode.h>
@@ -119,6 +121,7 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length)
119121
router->enqueueReceivedMessage(p.release());
120122
}
121123

124+
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
122125
// returns true if this is a valid JSON envelope which we accept on downlink
123126
inline bool isValidJsonEnvelope(JSONObject &json)
124127
{
@@ -204,6 +207,7 @@ inline void onReceiveJson(byte *payload, size_t length)
204207
LOG_DEBUG("JSON ignore downlink message with unsupported type");
205208
}
206209
}
210+
#endif
207211

208212
/// Determines if the given IPAddress is a private IPv4 address, i.e. not routable on the public internet.
209213
bool isPrivateIpAddress(const IPAddress &ip)
@@ -258,6 +262,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
258262

259263
// check if this is a json payload message by comparing the topic start
260264
if (moduleConfig.mqtt.json_enabled && (strncmp(topic, jsonTopic.c_str(), jsonTopic.length()) == 0)) {
265+
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
261266
// parse the channel name from the topic string
262267
// the topic has been checked above for having jsonTopic prefix, so just move past it
263268
char *channelName = topic + jsonTopic.length();
@@ -271,6 +276,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
271276
return;
272277
}
273278
onReceiveJson(payload, length);
279+
#endif
274280
return;
275281
}
276282

@@ -754,4 +760,4 @@ void MQTT::perhapsReportToMap()
754760

755761
// Update the last report time
756762
last_report_to_map = millis();
757-
}
763+
}

src/mqtt/MQTT.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include "concurrency/OSThread.h"
66
#include "mesh/Channels.h"
77
#include "mesh/generated/meshtastic/mqtt.pb.h"
8+
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
89
#include "serialization/JSON.h"
10+
#endif
911
#if HAS_WIFI
1012
#include <WiFiClient.h>
1113
#if !defined(ARCH_PORTDUINO)
@@ -127,4 +129,4 @@ class MQTT : private concurrency::OSThread
127129

128130
void mqttInit();
129131

130-
extern MQTT *mqtt;
132+
extern MQTT *mqtt;

0 commit comments

Comments
 (0)