@@ -333,6 +333,11 @@ void ArduinoIoTCloudTCP::update()
333
333
_next_state = State::Invalid;
334
334
}
335
335
336
+ if (getThingIdOutdatedFlag ()) {
337
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Thing id outdated, reconfiguring..." , __FUNCTION__);
338
+ _state = State::CheckDeviceConfig;
339
+ }
340
+
336
341
/* Run through the state machine. */
337
342
State next_state = _state;
338
343
switch (_state)
@@ -483,7 +488,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
483
488
return State::SubscribeDeviceTopic;
484
489
}
485
490
}
486
-
487
491
return State::WaitDeviceConfig;
488
492
}
489
493
@@ -497,16 +501,13 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
497
501
return State::ConnectPhy;
498
502
}
499
503
500
- if (getThingIdOutdatedFlag () )
504
+ if (_deviceSubscribedToThing == true )
501
505
{
502
- if (_deviceSubscribedToThing == true )
503
- {
504
- /* Unsubscribe from old things topics and go oi with a new subsctiption */
505
- _mqttClient.unsubscribe (_shadowTopicIn);
506
- _mqttClient.unsubscribe (_dataTopicIn);
506
+ /* Unsubscribe from old things topics and go oi with a new subsctiption */
507
+ _mqttClient.unsubscribe (_shadowTopicIn);
508
+ _mqttClient.unsubscribe (_dataTopicIn);
507
509
508
- _deviceSubscribedToThing = false ;
509
- }
510
+ _deviceSubscribedToThing = false ;
510
511
}
511
512
512
513
updateThingTopics ();
@@ -723,7 +724,6 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
723
724
CBORDecoder::decode (_device_property_container, (uint8_t *)bytes, length);
724
725
_last_device_subscribe_cnt = 0 ;
725
726
_next_device_subscribe_attempt_tick = 0 ;
726
- _next_state = State::CheckDeviceConfig;
727
727
}
728
728
729
729
/* Topic for user input data */
0 commit comments