tryfix - no mqtt if no mqtt wanted...

This commit is contained in:
Thomas Göttgens 2022-12-30 14:51:00 +01:00
parent 115cb05d3b
commit 65aad62702

View File

@ -222,6 +222,7 @@ ErrorCode Router::send(MeshPacket *p)
ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it
#if HAS_WIFI || HAS_ETHERNET #if HAS_WIFI || HAS_ETHERNET
if(moduleConfig.mqtt.enabled) {
// check if we should send decrypted packets to mqtt // check if we should send decrypted packets to mqtt
// truth table: // truth table:
@ -244,6 +245,7 @@ ErrorCode Router::send(MeshPacket *p)
// the packet is currently in a decrypted state. send it now if they want decrypted packets // the packet is currently in a decrypted state. send it now if they want decrypted packets
if (mqtt && !shouldActuallyEncrypt) if (mqtt && !shouldActuallyEncrypt)
mqtt->onSend(*p, chIndex); mqtt->onSend(*p, chIndex);
}
#endif #endif
auto encodeResult = perhapsEncode(p); auto encodeResult = perhapsEncode(p);
@ -253,10 +255,12 @@ ErrorCode Router::send(MeshPacket *p)
} }
#if HAS_WIFI || HAS_ETHERNET #if HAS_WIFI || HAS_ETHERNET
if(moduleConfig.mqtt.enabled) {
// the packet is now encrypted. // the packet is now encrypted.
// check if we should send encrypted packets to mqtt // check if we should send encrypted packets to mqtt
if (mqtt && shouldActuallyEncrypt) if (mqtt && shouldActuallyEncrypt)
mqtt->onSend(*p, chIndex); mqtt->onSend(*p, chIndex);
}
#endif #endif
} }