Skip to content

Commit da92776

Browse files
committed
Replace 'pow' with bit-shift to save ressources.
1 parent bb70ba5 commit da92776

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
358358
}
359359

360360
_last_connection_attempt_cnt++;
361-
unsigned long reconnection_retry_delay = pow(2, _last_connection_attempt_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms;
361+
unsigned long reconnection_retry_delay = (1 << _last_connection_attempt_cnt) * AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms;
362362
reconnection_retry_delay = std::min(reconnection_retry_delay, static_cast<unsigned long>(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
363363
_next_connection_attempt_tick = millis() + reconnection_retry_delay;
364364

0 commit comments

Comments
 (0)