File tree 1 file changed +15
-13
lines changed
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()
319
319
320
320
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected ()
321
321
{
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
325
336
}
337
+ #endif
326
338
327
339
/* Check for new data from the MQTT client. */
328
340
_mqttClient.poll ();
@@ -338,16 +350,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
338
350
/* Call CloudDevice process to get configuration */
339
351
_device.update ();
340
352
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
-
351
353
352
354
if (_device.isAttached ()) {
353
355
/* Call CloudThing process to synchronize properties */
You can’t perform that action at this time.
0 commit comments