FastLED 3.9.15
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 267 of file RpcClient.ino.

267 {
268 uint32_t now = millis();
269
270 // Update transport (handles heartbeat, reconnection, etc.)
271 transport->update(now);
272
273 // Update remote (processes incoming responses)
274 remote->update(now);
275
276 // Process any responses
278 if (response) {
279 handleResponse(*response);
280 }
281
282 // Send requests periodically (only when not waiting for response)
283 if (!waitingForResponse && (now - lastCallTime >= CALL_INTERVAL)) {
284 lastCallTime = now;
285
286 // Cycle through test modes
287 switch (currentMode) {
288 case TEST_SYNC:
290 currentMode = TEST_ASYNC; // Next mode
291 break;
292
293 case TEST_ASYNC:
295 currentMode = TEST_ASYNC_STREAM; // Next mode
296 break;
297
300 currentMode = TEST_SYNC; // Cycle back to start
301 Serial.println("\n--- Cycle complete, starting over ---\n");
302 break;
303 }
304 }
305
306 // Small delay to prevent busy-waiting
307 delay(10);
308}
@ TEST_ASYNC_STREAM
@ TEST_ASYNC
@ TEST_SYNC
TestMode currentMode
bool waitingForResponse
fl::unique_ptr< fl::Remote > remote
Definition RpcClient.ino:43
uint32_t lastCallTime
Definition RpcClient.ino:49
void handleResponse(const fl::json &response)
fl::unique_ptr< fl::net::http::HttpStreamClient > transport
Definition RpcClient.ino:42
void sendAsyncRequest()
void sendSyncRequest()
const uint32_t CALL_INTERVAL
Definition RpcClient.ino:50
void sendAsyncStreamRequest()
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
Optional< T > optional
Definition optional.h:16
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
#define Serial
Definition serial.h:304

References CALL_INTERVAL, currentMode, handleResponse(), lastCallTime, remote, sendAsyncRequest(), sendAsyncStreamRequest(), sendSyncRequest(), Serial, TEST_ASYNC, TEST_ASYNC_STREAM, TEST_SYNC, transport, and waitingForResponse.

+ Here is the call graph for this function: