Skip to content

OTA logic should be called at start of update #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)

void ArduinoIoTCloudTCP::update()
{
#if OTA_ENABLED
/* If a _ota_logic object has been instantiated then we are spinning its
* 'update' method here in order to process incoming data and generally
* to transition to the OTA logic update states.
*/
OTAError const err = _ota_logic.update();
_ota_error = static_cast<int>(err);
#endif /* OTA_ENABLED */

/* Run through the state machine. */
State next_state = _state;
switch (_state)
Expand All @@ -182,15 +191,6 @@ void ArduinoIoTCloudTCP::update()
/* Check for new data from the MQTT client. */
if (_mqttClient.connected())
_mqttClient.poll();

#if OTA_ENABLED
/* If a _ota_logic object has been instantiated then we are spinning its
* 'update' method here in order to process incoming data and generally
* to transition to the OTA logic update states.
*/
OTAError const err = _ota_logic.update();
_ota_error = static_cast<int>(err);
#endif /* OTA_ENABLED */
}

int ArduinoIoTCloudTCP::connected()
Expand Down