@@ -451,9 +451,10 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
451
451
return State::ConnectPhy;
452
452
}
453
453
454
- unsigned long reconnection_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms;
455
- reconnection_retry_delay = min (reconnection_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
456
- _next_device_subscribe_attempt_tick = millis () + reconnection_retry_delay;
454
+ /* No device configuration reply. Wait: 5s -> 10s -> 20s -> 30s */
455
+ unsigned long subscribe_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms;
456
+ subscribe_retry_delay = min (subscribe_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms));
457
+ _next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
457
458
_last_device_subscribe_cnt++;
458
459
459
460
return State::WaitDeviceConfig;
@@ -491,7 +492,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
491
492
492
493
if (_deviceSubscribedToThing == true )
493
494
{
494
- /* Unsubscribe from old things topics and go oi with a new subsctiption */
495
+ /* Unsubscribe from old things topics and go on with a new subsctiption */
495
496
_mqttClient.unsubscribe (_shadowTopicIn);
496
497
_mqttClient.unsubscribe (_dataTopicIn);
497
498
@@ -502,14 +503,10 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
502
503
503
504
if (deviceNotAttached ())
504
505
{
505
- /* start long timeout counter
506
- * return return State::SubscribeThingTopics
507
- * if long timeout expired unsubscribe and
508
- * return State::SubscribeDeviceTopic
509
- */
510
- unsigned long reconnection_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms * 10000 ;
511
- reconnection_retry_delay = min (reconnection_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
512
- _next_device_subscribe_attempt_tick = millis () + reconnection_retry_delay;
506
+ /* Configuration received but device not attached. Wait: 40s */
507
+ unsigned long subscribe_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms * 10 ;
508
+ subscribe_retry_delay = min (subscribe_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms * 10 ));
509
+ _next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
513
510
_last_device_subscribe_cnt++;
514
511
return State::WaitDeviceConfig;
515
512
}
0 commit comments