Skip to content

Commit 01bb11d

Browse files
committed
Formatting sync logic for better readability
1 parent ef5657d commit 01bb11d

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

Diff for: src/ArduinoIoTCloudTCP.cpp

+19-16
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,26 @@ void ArduinoIoTCloudTCP::update()
186186
// MTTQClient connected!, poll() used to retrieve data from MQTT broker
187187
_mqttClient->poll();
188188

189-
switch (_syncStatus) {
190-
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_SYNCHRONIZED: {
191-
sendPropertiesToCloud();
192-
}
193-
break;
194-
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_WAIT_FOR_CLOUD_VALUES: {
195-
if (millis() - _lastSyncRequestTickTime > TIMEOUT_FOR_LASTVALUES_SYNC) {
196-
requestLastValue();
197-
_lastSyncRequestTickTime = millis();
198-
}
199-
}
200-
break;
201-
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_VALUES_PROCESSED: {
202-
execCloudEventCallback(ArduinoIoTCloudEvent::SYNC);
203-
_syncStatus = ArduinoIoTSynchronizationStatus::SYNC_STATUS_SYNCHRONIZED;
189+
switch (_syncStatus)
190+
{
191+
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_SYNCHRONIZED: sendPropertiesToCloud(); break;
192+
193+
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_WAIT_FOR_CLOUD_VALUES:
194+
{
195+
if (millis() - _lastSyncRequestTickTime > TIMEOUT_FOR_LASTVALUES_SYNC)
196+
{
197+
requestLastValue();
198+
_lastSyncRequestTickTime = millis();
204199
}
205-
break;
200+
}
201+
break;
202+
203+
case ArduinoIoTSynchronizationStatus::SYNC_STATUS_VALUES_PROCESSED:
204+
{
205+
execCloudEventCallback(ArduinoIoTCloudEvent::SYNC);
206+
_syncStatus = ArduinoIoTSynchronizationStatus::SYNC_STATUS_SYNCHRONIZED;
207+
}
208+
break;
206209
}
207210
}
208211

0 commit comments

Comments
 (0)