Skip to content

Commit 55e8d3a

Browse files
authored
OTA logic should be called at start of update (#178)
1 parent 11d96e8 commit 55e8d3a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/ArduinoIoTCloudTCP.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
166166

167167
void ArduinoIoTCloudTCP::update()
168168
{
169+
#if OTA_ENABLED
170+
/* If a _ota_logic object has been instantiated then we are spinning its
171+
* 'update' method here in order to process incoming data and generally
172+
* to transition to the OTA logic update states.
173+
*/
174+
OTAError const err = _ota_logic.update();
175+
_ota_error = static_cast<int>(err);
176+
#endif /* OTA_ENABLED */
177+
169178
/* Run through the state machine. */
170179
State next_state = _state;
171180
switch (_state)
@@ -182,15 +191,6 @@ void ArduinoIoTCloudTCP::update()
182191
/* Check for new data from the MQTT client. */
183192
if (_mqttClient.connected())
184193
_mqttClient.poll();
185-
186-
#if OTA_ENABLED
187-
/* If a _ota_logic object has been instantiated then we are spinning its
188-
* 'update' method here in order to process incoming data and generally
189-
* to transition to the OTA logic update states.
190-
*/
191-
OTAError const err = _ota_logic.update();
192-
_ota_error = static_cast<int>(err);
193-
#endif /* OTA_ENABLED */
194194
}
195195

196196
int ArduinoIoTCloudTCP::connected()

0 commit comments

Comments
 (0)