File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -319,10 +319,22 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
319319
320320ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected ()
321321{
322- if (!_mqttClient.connected () || !_thing.connected () || !_device.connected ())
323- {
324- return State::Disconnect;
322+ #if OTA_ENABLED
323+ if (_get_ota_confirmation != nullptr &&
324+ _ota.getState () == OTACloudProcessInterface::State::OtaAvailable &&
325+ _get_ota_confirmation ()) {
326+ _ota.approveOta ();
327+ }
328+ _ota.update ();
329+
330+ if (!_otaClient.connected ()) {
331+ #endif
332+ if (!_mqttClient.connected () || !_thing.connected () || !_device.connected ()) {
333+ return State::Disconnect;
334+ }
335+ #if OTA_ENABLED
325336 }
337+ #endif
326338
327339 /* Check for new data from the MQTT client. */
328340 _mqttClient.poll ();
@@ -338,16 +350,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
338350 /* Call CloudDevice process to get configuration */
339351 _device.update ();
340352
341- #if OTA_ENABLED
342- if (_get_ota_confirmation != nullptr &&
343- _ota.getState () == OTACloudProcessInterface::State::OtaAvailable &&
344- _get_ota_confirmation ()) {
345- _ota.approveOta ();
346- }
347-
348- _ota.update ();
349- #endif // OTA_ENABLED
350-
351353
352354 if (_device.isAttached ()) {
353355 /* Call CloudThing process to synchronize properties */
You can’t perform that action at this time.
0 commit comments