mirror of
https://github.com/pelgraine/Meck.git
synced 2026-05-02 03:22:38 +02:00
fix mqttsubscribe
This commit is contained in:
@@ -792,8 +792,20 @@ restart:
|
||||
goto restart;
|
||||
}
|
||||
|
||||
mqttSubscribe(_topicCmd);
|
||||
mqttSubscribe(_topicOta);
|
||||
// Allow MQTT session to stabilise before subscribing
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
|
||||
// Subscribe with retry — the modem sometimes misses the first prompt
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mqttSubscribe(_topicCmd)) break;
|
||||
Serial.printf("[Cell] Subscribe retry %d for cmd topic\n", i + 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mqttSubscribe(_topicOta)) break;
|
||||
Serial.printf("[Cell] Subscribe retry %d for ota topic\n", i + 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
|
||||
_state = CellState::CONNECTED;
|
||||
_reconnectDelay = MQTT_RECONNECT_MIN;
|
||||
|
||||
Reference in New Issue
Block a user