Skip to content

Commit

Permalink
Merge pull request #386 from pennam/r4-fw
Browse files Browse the repository at this point in the history
UNO R4 WiFi: move firmware check inside begin function
  • Loading branch information
pennam authored Nov 23, 2023
2 parents babad89 + 4a4a174 commit ad862b5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
}
#endif /* BOARD_HAS_OFFLOADED_ECCX08 */

#if defined(ARDUINO_UNOWIFIR4)
if (String(WiFi.firmwareVersion()) < String("0.2.0")) {
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());
}
#endif

/* Since we do not control what code the user inserts
* between ArduinoIoTCloudTCP::begin() and the first
* call to ArduinoIoTCloudTCP::update() it is wise to
Expand Down Expand Up @@ -326,12 +332,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
reconnection_retry_delay = min(reconnection_retry_delay, static_cast<unsigned long>(AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms));
_next_connection_attempt_tick = millis() + reconnection_retry_delay;

#if defined(ARDUINO_UNOWIFIR4)
if (String(WiFi.firmwareVersion()) < String("0.2.0")) {
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());
}
#endif

DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not connect to %s:%d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
DEBUG_ERROR("ArduinoIoTCloudTCP::%s %d connection attempt at tick time %d", __FUNCTION__, _last_connection_attempt_cnt, _next_connection_attempt_tick);
return State::ConnectPhy;
Expand Down

0 comments on commit ad862b5

Please sign in to comment.