[BT] Fix crash when sending multiple BT commands at the same time (#2059)

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2024-09-17 07:29:36 -05:00
1 parent eab1354d7a
commit 776ed6568d
1 file changed
+8 -2
+8 -2
View File
@@ -1551,8 +1551,14 @@ void MQTTtoBT(char* topicOri, JsonObject& BTdata) { // json object decoding
BTConfig_fromJson(BTdata);
} else if (cmpToMainTopic(topicOri, subjectMQTTtoBT)) {
KnownBTActions(BTdata);
MQTTtoBTAction(BTdata);
if (xSemaphoreTake(semaphoreBLEOperation, pdMS_TO_TICKS(5000)) == pdTRUE) {
KnownBTActions(BTdata);
MQTTtoBTAction(BTdata);
xSemaphoreGive(semaphoreBLEOperation);
} else {
Log.error(F("BLE busy - command not sent" CR));
gatewayState = GatewayState::ERROR;
}
}
}
#endif