@brief Setup async task for JSON-RPC processing @param remote_control Reference to RemoteControl singleton @param interval_ms Task interval in milliseconds (default: 10ms) @return Task handle (auto-registered with scheduler) This function creates an async task that polls the RPC system at regular intervals, allowing RPC commands to be processed without blocking the main loop. The 10ms default in
| 32 | /// - ESP32 Arduino runs on single core - task switching is atomic |
| 33 | /// - No additional synchronization needed |
| 34 | inline fl::task::Handle setupRpcAsyncTask(AutoResearchRemoteControl& remote_control, int interval_ms = 10) { |
| 35 | return fl::task::every_ms(interval_ms, FL_TRACE) |
| 36 | .then([&remote_control]() { |
| 37 | uint32_t current_time = millis(); |
| 38 | remote_control.tick(current_time); // Calls Remote::update() which does pull + tick + push |
| 39 | }); |
| 40 | } |
| 41 | |
| 42 | /// @brief On FL_IS_STUB: register a one-shot async task that drives autoresearch |
| 43 | /// |