Skip to content

Commit ad862b5

Browse files
authored
Merge pull request #386 from pennam/r4-fw
UNO R4 WiFi: move firmware check inside begin function
2 parents babad89 + 4a4a174 commit ad862b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ArduinoIoTCloudTCP.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
218218
}
219219
#endif /* BOARD_HAS_OFFLOADED_ECCX08 */
220220

221+
#if defined(ARDUINO_UNOWIFIR4)
222+
if (String(WiFi.firmwareVersion()) < String("0.2.0")) {
223+
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to connect to Arduino IoT Cloud, WiFi firmware needs to be >= 0.2.0, current %s", __FUNCTION__, WiFi.firmwareVersion());
224+
}
225+
#endif
226+
221227
/* Since we do not control what code the user inserts
222228
* between ArduinoIoTCloudTCP::begin() and the first
223229
* call to ArduinoIoTCloudTCP::update() it is wise to
@@ -326,12 +332,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
326332
reconnection_retry_delay = min(reconnection_retry_delay, static_cast<unsigned long>(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
327333
_next_connection_attempt_tick = millis() + reconnection_retry_delay;
328334

329-
#if defined(ARDUINO_UNOWIFIR4)
330-
if (String(WiFi.firmwareVersion()) < String("0.2.0")) {
331-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to connect to Arduino IoT Cloud, WiFi firmware needs to be >= 0.2.0, current %s", __FUNCTION__, WiFi.firmwareVersion());
332-
}
333-
#endif
334-
335335
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not connect to %s:%d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
336336
DEBUG_ERROR("ArduinoIoTCloudTCP::%s %d connection attempt at tick time %d", __FUNCTION__, _last_connection_attempt_cnt, _next_connection_attempt_tick);
337337
return State::ConnectPhy;

0 commit comments

Comments
 (0)