possible fix for stuck MQTT handler.

This commit is contained in:
Thomas Göttgens 2022-10-18 21:51:40 +02:00
parent c1381b9ebd
commit ea87193c8f
2 changed files with 4 additions and 4 deletions

View File

@ -253,7 +253,7 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex)
} }
// converts a downstream packet into a json message // converts a downstream packet into a json message
String MQTT::downstreamPacketToJson(MeshPacket *mp) std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
{ {
using namespace json11; using namespace json11;
@ -398,8 +398,8 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
}; };
// serialize and return it // serialize and return it
static std::string jsonStr = jsonObj.dump(); std::string jsonStr = jsonObj.dump();
DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str()); DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str());
return jsonStr.c_str(); return jsonStr;
} }

View File

@ -58,7 +58,7 @@ class MQTT : private concurrency::OSThread
void onPublish(char *topic, byte *payload, unsigned int length); void onPublish(char *topic, byte *payload, unsigned int length);
/// Called when a new publish arrives from the MQTT server /// Called when a new publish arrives from the MQTT server
String downstreamPacketToJson(MeshPacket *mp); std::string downstreamPacketToJson(MeshPacket *mp);
/// Return 0 if sleep is okay, veto sleep if we are connected to pubsub server /// Return 0 if sleep is okay, veto sleep if we are connected to pubsub server
// int preflightSleepCb(void *unused = NULL) { return pubSub.connected() ? 1 : 0; } // int preflightSleepCb(void *unused = NULL) { return pubSub.connected() ? 1 : 0; }