@@ -445,9 +445,10 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
445
445
return State::ConnectPhy;
446
446
}
447
447
448
- unsigned long reconnection_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms;
449
- reconnection_retry_delay = min (reconnection_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
450
- _next_device_subscribe_attempt_tick = millis () + reconnection_retry_delay;
448
+ /* No device configuration reply. Wait: 5s -> 10s -> 20s -> 30s */
449
+ unsigned long subscribe_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms;
450
+ subscribe_retry_delay = min (subscribe_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms));
451
+ _next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
451
452
_last_device_subscribe_cnt++;
452
453
453
454
return State::WaitDeviceConfig;
@@ -496,14 +497,10 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
496
497
497
498
if (deviceNotAttached ())
498
499
{
499
- /* start long timeout counter
500
- * return return State::SubscribeThingTopics
501
- * if long timeout expired unsubscribe and
502
- * return State::SubscribeDeviceTopic
503
- */
504
- unsigned long reconnection_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms * 10000 ;
505
- reconnection_retry_delay = min (reconnection_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
506
- _next_device_subscribe_attempt_tick = millis () + reconnection_retry_delay;
500
+ /* Configuration received but device not attached. Wait: 40s */
501
+ unsigned long subscribe_retry_delay = (1 << _last_device_subscribe_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms * 10 ;
502
+ subscribe_retry_delay = min (subscribe_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms * 10 ));
503
+ _next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
507
504
_last_device_subscribe_cnt++;
508
505
return State::WaitDeviceConfig;
509
506
}
0 commit comments