FastLED 3.10.10
Loading...
Searching...
No Matches
AutoResearchRemoteSystemMethods.cpp
Go to the documentation of this file.
1// System control RPC bindings: device status, debug toggles, driver
2// inventory, RPC ack/health (ping, testNoSerial), and the user-facing
3// runSingleTest/runParallelTest dispatchers. "System" = device control,
4// not feature exercise (those live in the math/network/async/driver bins).
5// Extracted from AutoResearchRemote.cpp as part of #3132 / meta #3127.
6
8#if FL_PLATFORM_HAS_LARGE_MEMORY
9
10// Legacy debug macros (no-ops, kept for debugTest RPC function)
11#define DEBUG_PRINT(x) do {} while(0)
12#define DEBUG_PRINTLN(x) do {} while(0)
13
14#include "AutoResearchRemote.h"
15#include "AutoResearchBle.h"
16#include "AutoResearchNet.h"
17#include "AutoResearchOta.h"
19#include "fl/system/heap.h"
20#include "Common.h"
21#include "AutoResearchTest.h"
22#include "AutoResearchHelpers.h"
28#include "fl/wdt/watchdog.h"
29#include "fl/stl/sstream.h"
30#include "fl/stl/unique_ptr.h"
31#include "fl/stl/singleton.h"
32#include "platforms/is_platform.h"
33#ifdef FL_IS_ESP32
34#include "platforms/esp/32/feature_flags/enabled.h"
35#if FASTLED_ESP32_HAS_PARLIO
36#include "platforms/esp/32/drivers/parlio/parlio_engine.h"
38// IWYU pragma: begin_keep
39#include "driver/parlio_tx.h" // ok platform headers - parlioRawTest RPC
40// IWYU pragma: end_keep
42#endif
44// IWYU pragma: begin_keep
45#include "esp_heap_caps.h" // ok platform headers - heapCheck RPC
46#include "freertos/FreeRTOS.h" // ok platform headers - heapCheck RPC
47#include "freertos/task.h" // ok platform headers - heapCheck RPC
48// IWYU pragma: end_keep
50#endif
51#include "fl/stl/optional.h"
52#include "fl/stl/json.h"
53#include "fl/task/task.h"
54#include "fl/task/executor.h"
56#include "fl/stl/atomic.h"
57#include "fl/task/promise.h"
58#include "fl/math/simd.h"
59#include "AutoResearchSimd.h"
65#include "fl/chipsets/spi.h"
67#include "fl/channels/config.h"
68#include <Arduino.h>
69
70#include "fl/net/ble.h"
71
72#include "fl/codec/h264.h"
73#include "fl/codec/mp4_parser.h"
75#include "fl/fx/frame.h"
76
77namespace {
78
79#if defined(FL_IS_ESP32) && FASTLED_ESP32_HAS_PARLIO
80struct ParlioRawTestState {
81 uint8_t buffer[512];
82};
83
84ParlioRawTestState& parlioRawTestState() {
86}
87
88// The TX clock edge field was renamed within IDF 5.5: 5.5.1 has only
89// `sample_edge`; 5.5.5 has `shift_edge` and keeps `sample_edge` as a
90// deprecated alias. Which one exists is detected here rather than guessed
91// from a version number. The two enums are ordered differently
92// (PARLIO_SAMPLE_EDGE_POS == 1, PARLIO_SHIFT_EDGE_POS == 0), and the newer
93// enumerator is not declared on older IDFs, so the new branch names the
94// member's own type and the value's meaning is in the comment.
95template <typename Cfg>
96auto setParlioRawTxEdge(Cfg& cfg, int) -> decltype(cfg.shift_edge, void()) {
97 cfg.shift_edge = static_cast<decltype(cfg.shift_edge)>(0); // PARLIO_SHIFT_EDGE_POS
98}
99template <typename Cfg>
100void setParlioRawTxEdge(Cfg& cfg, long) {
101 cfg.sample_edge = PARLIO_SAMPLE_EDGE_POS; // IDF before the rename
102}
103#endif
104
105fl::json autoResearchDeviceJson(const fl::string& name) {
106 if (name == "RMT") return fl::deviceJson<fl::Bus::RMT>();
107 if (name == "SPI" || name == "SPI_UNIFIED") return fl::deviceJson<fl::Bus::SPI>();
108 // RP registers its two fixed PL022 blocks under the concrete names
109 // "SPI0"/"SPI1". Without these they fell through to the generic tail
110 // below, which hardcodes which=0 and echoes the driver name into
111 // bus_name/vendor_name/device_name -- so `drivers` reported SPI1 with
112 // which=0 and no real bus metadata, unlike UART0/UART1 and PIO0/1/2.
113 // RP-only. SAMD21 (spi_hw_manager_samd21.cpp.hpp:38-39) and nRF52
114 // (init_channel_driver_nrf52.cpp.hpp:49) also register drivers called
115 // "SPI0"/"SPI1", but DeviceInfoResolver<Bus::SPI, 0|1> is specialized
116 // only in the RP branch of bus_info.h. Routing those platforms here
117 // would hand them the unspecialized no-op resolver and report
118 // is_noop=true / available=false -- the very regression this mapping
119 // was added to fix, just moved to a different chip.
120#if defined(FL_IS_RP)
121 if (name == "SPI0") return fl::deviceJson<fl::Bus::SPI, 0>();
122 if (name == "SPI1") return fl::deviceJson<fl::Bus::SPI, 1>();
123#endif
124 if (name == "UART" || name == "LPUART" || name == "UART0") {
126 }
127 if (name == "UART1") return fl::deviceJson<fl::Bus::UART, 1>();
128 if (name == "BIT_BANG" || name == "STUB") return fl::deviceJson<fl::Bus::BIT_BANG>();
129
130 if (name == "FLEX_IO" || name == "LCD_RGB") {
132 }
133 if (name == "OBJECT_FLED" || name == "PARLIO" || name == "LCD_SPI" ||
134 name == "LCD_CLOCKLESS" || name == "I2S" || name == "I2S_SPI") {
136 }
137 if (name == "PIO0") return fl::deviceJson<fl::Bus::FLEX_IO, 0>();
138 if (name == "PIO1") return fl::deviceJson<fl::Bus::FLEX_IO, 1>();
139 if (name == "PIO2") return fl::deviceJson<fl::Bus::FLEX_IO, 2>();
140
141 fl::json info = fl::json::object();
142 info.set("bus", static_cast<int64_t>(0));
143 info.set("bus_name", name.c_str());
144 info.set("vendor_name", name.c_str());
145 info.set("device_name", name.c_str());
146 info.set("which", static_cast<int64_t>(0));
147 info.set("is_noop", false);
148 info.set("notes", "registered runtime driver");
149 fl::json runtime = fl::json::object();
150 runtime.set("available", true);
151 runtime.set("initialized", false);
152 runtime.set("ready", true);
153 runtime.set("busy", false);
154 runtime.set("error", "");
155 info.set("runtime", runtime);
156 return info;
157}
158
159} // namespace
160
161
163
164 // Register "status" function - device readiness check
165 remote.bind("status", [this](const fl::json& args) -> fl::json {
166 fl::json status = fl::json::object();
167 status.set("ready", true);
168 status.set("platform", autoresearch::chipName());
169 status.set("rpcReady", true);
170 status.set("ledRxAvailable", mState->led_rx_available);
171 status.set("pinTx", static_cast<int64_t>(mState->pin_tx));
172 status.set("pinRx", static_cast<int64_t>(mState->pin_rx));
173 return status;
174 });
175
176 // NOTE: getSchema is no longer needed - use built-in "rpc.discover" instead
177 // The rpc.discover method is automatically available via Remote->Rpc and returns
178 // the full OpenRPC schema. Our custom getSchema was causing stack overflow on ESP32-C6.
179
180 // Register "debugTest" function - test RPC argument passing
181 remote.bind("debugTest", [](const fl::json& args) -> fl::json {
182 fl::json response = fl::json::object();
183 response.set("success", true);
184 response.set("received", args);
185 return response;
186 });
187
188 // Register "deliberateHang" - force an infinite loop with interrupts
189 // disabled to validate the unified Watchdog implementation (#2731).
190 // The watchdog should fire within its configured timeout, reset the
191 // device, and let the bootloader become reachable again.
192 // Returns success BEFORE hanging so the caller sees the ACK; the hang
193 // begins in the next iteration of the loop.
194 remote.bind("deliberateHang", [this](const fl::json& args) -> fl::json {
195 (void)args;
196 mState->deliberate_hang_requested = true;
197 fl::json response = fl::json::object();
198 response.set("success", true);
199 response.set("message", "device will hang after RPC returns; watchdog should reset within configured timeout");
200 response.set("hangDelayMs", static_cast<int64_t>(200));
201 response.set("watchdogExpected", true);
202 return response;
204
205 // Register "drivers" function - list available drivers
206 remote.bind("drivers", [this](const fl::json& args) -> fl::json {
207 fl::json drivers = fl::json::array();
208 for (fl::size i = 0; i < mState->drivers_available.size(); i++) {
209 fl::json driver = fl::json::object();
210 driver.set("name", mState->drivers_available[i].name.c_str());
211 driver.set("priority", static_cast<int64_t>(mState->drivers_available[i].priority));
212 driver.set("enabled", mState->drivers_available[i].enabled);
213 fl::json device = autoResearchDeviceJson(mState->drivers_available[i].name);
214 driver.set("bus_name", device["bus_name"]);
215 driver.set("vendor_name", device["vendor_name"]);
216 driver.set("device_name", device["device_name"]);
217 driver.set("which", device["which"]);
218 driver.set("is_noop", device["is_noop"]);
219 driver.set("runtime", device["runtime"]);
220 drivers.push_back(driver);
221 }
222 return drivers;
223 });
224
225 // Returns: {success, passed, totalTests, passedTests, duration_ms, driver,
226 // laneCount, laneSizes, pattern, firstFailure?}
227 // ASYNC: Sends ACK immediately, final response sent via sendAsyncResponse()
228 // Optional workerCore ("auto", "0", "1", "any", "calling") validates LCD worker
229 // affinity and returns workerCore/workerObservedCore/workerPriority plus
230 // competingTaskPasses/competingTaskMaxPassUs for a priority-5 Core-0 load.
231 // Optional lanePins is the exact TX GPIO per lane (unique, excluding RX,
232 // lane 0 matches pinTx). The response echoes the applied map; RX captures
233 // only lane 0 even when multiple lanes transmit in parallel.
234 // NOTE: runSingleTestImpl() may return early (error cases) without calling
235 // sendAsyncResponse(). This wrapper ensures a response is ALWAYS sent so
236 // the Python client never times out waiting 120s for a missing response.
237 remote.bind("runSingleTest", [this](const fl::json& args) -> fl::json {
238 fl::json result = this->runSingleTestImpl(args);
239 // If runSingleTestImpl returned a non-null response, it exited early without
240 // calling sendAsyncResponse(). Send it now so the client gets a response.
241 if (!result.is_null()) {
242 mRemote->sendAsyncResponse("runSingleTest", result);
243 }
244 return fl::json(nullptr);
246
247 // Register "runParallelTest" - test multiple drivers simultaneously
248 // Args: {drivers: [{driver: "PARLIO", laneSizes: [100]}, {driver: "LCD_RGB", laneSizes: [100]}],
249 // pattern?: "MSB_LSB_A", iterations?: 1, timing?: "WS2812B-V5"}
250 // Returns: {success, passed, duration_ms, show_duration_us, drivers: [...],
251 // rx_validation_attempted, rx_validation_passed}
252 remote.bind("runParallelTest", [this](const fl::json& args) -> fl::json {
253 fl::json result = this->runParallelTestImpl(args);
254 if (!result.is_null()) {
255 mRemote->sendAsyncResponse("runParallelTest", result);
256 }
257 return fl::json(nullptr);
259
260 // ========================================================================
261 // Phase 4 Functions: Utility and Control
262 // ========================================================================
263
264 // Register "ping" function - health check with timestamp
265 remote.bind("ping", [](const fl::json& args) -> fl::json {
266 uint32_t now = millis();
267 const fl::ResetCause reset_cause = FastLED.watchdog().lastResetCause();
268
269 fl::json response = fl::json::object();
270 response.set("success", true);
271 response.set("message", "pong");
272 response.set("timestamp", static_cast<int64_t>(now));
273 response.set("uptimeMs", static_cast<int64_t>(now));
274 response.set("lastResetCause", fl::resetCauseName(reset_cause).data());
275 response.set("lastResetWasWatchdog", reset_cause == fl::ResetCause::WATCHDOG);
276 return response;
277 });
278
279 // TEST: Simple RPC without Serial to verify task context works
280 remote.bind("testNoSerial", [](const fl::json& args) -> fl::json {
281 fl::json response = fl::json::object();
282 response.set("success", true);
283 response.set("message", "RPC works from task context");
284 response.set("serial_safe", false);
285 return response;
286 });
287
288 remote.bind("testRpConcurrency", [this](const fl::json& args) -> fl::json {
289 (void)args;
290 mRemote->sendAsyncResponse("testRpConcurrency",
292 return fl::json(nullptr);
294
295 // FastLED#1471: starve the PIO block the way TinyUSB does, then check
296 // that the clockless driver declines instead of stealing a state machine.
297 remote.bind("testRpPioContention", [this](const fl::json& args) -> fl::json {
298 (void)args;
299 mRemote->sendAsyncResponse("testRpPioContention",
301 return fl::json(nullptr);
303
304 // FastLED#3899: PIO0+PIO1 simultaneous operation, asserted at the resource
305 // level. runParallelTest only proves show() returned for this pair.
306 remote.bind("testRpPioParallelResources", [this](const fl::json& args) -> fl::json {
307 mRemote->sendAsyncResponse("testRpPioParallelResources",
309 return fl::json(nullptr);
311
312 // "parlioMetrics" — PARLIO engine ISR/DMA counters (C6 bring-up,
313 // FastLED#3576 Phase 7). Reads the engine's debug metrics AFTER a
314 // test to see whether the TX ISRs ever fired.
315#if defined(FL_IS_ESP32) && FASTLED_ESP32_HAS_PARLIO
316 remote.bind("parlioMetrics", [](const fl::json& args) -> fl::json {
317 fl::json response = fl::json::object();
318 const auto m = fl::detail::ParlioEngine::getInstance().getDebugMetrics();
319 response.set("success", true);
320 response.set("isrCount", static_cast<int64_t>(m.mIsrCount));
321 response.set("txDoneCount", static_cast<int64_t>(m.mTxDoneCount));
322 response.set("chunksQueued", static_cast<int64_t>(m.mChunksQueued));
323 response.set("chunksCompleted", static_cast<int64_t>(m.mChunksCompleted));
324 response.set("bytesTotal", static_cast<int64_t>(m.mBytesTotal));
325 response.set("bytesTransmitted", static_cast<int64_t>(m.mBytesTransmitted));
326 response.set("underruns", static_cast<int64_t>(m.mUnderrunCount));
327 response.set("errorCode", static_cast<int64_t>(m.mErrorCode));
328 response.set("hardwareIdle", m.mHardwareIdle);
329 response.set("transmissionActive", m.mTransmissionActive);
330 return response;
331 });
332#endif
333
334 // FastLED#3569 bench diagnostic — read up to 16 u32 words of
335 // memory-mapped register space without resetting the chip (esptool
336 // pokes force a reset, wiping the very peripheral state under
337 // investigation). Params: [{addr: <u32>, count?: 1-16}]. The caller
338 // is expected to pass valid peripheral/SRAM addresses; an unmapped
339 // address faults exactly as it would from any other code.
340 // "parlioRawTest" — minimal IDF parlio TX (FastLED#3586): 1-bit
341 // unit @ requested clock on a pin, transmit an alternating pattern.
342 // Bypasses the FastLED engine completely to split engine bugs from
343 // IDF-driver/silicon behavior.
344#if defined(FL_IS_ESP32) && FASTLED_ESP32_HAS_PARLIO
345 remote.bind("parlioRawTest", [](const fl::json& args) -> fl::json {
346 fl::json response = fl::json::object();
347 int pin = 1;
348 int hz = 8000000;
349 int width = 1;
350 int pattern = 0xAA;
351 int qnb = 0;
352 int mts = 1024;
353 int burst = 0;
354 int depth = 4;
355 int chunks = 1;
356 if (args.is_object()) {
357 if (args.contains("pin") && args["pin"].is_int()) pin = (int)args["pin"].as_int().value();
358 if (args.contains("hz") && args["hz"].is_int()) hz = (int)args["hz"].as_int().value();
359 if (args.contains("width") && args["width"].is_int()) width = (int)args["width"].as_int().value();
360 if (args.contains("pattern") && args["pattern"].is_int()) pattern = (int)args["pattern"].as_int().value();
361 if (args.contains("qnb") && args["qnb"].is_int()) qnb = (int)args["qnb"].as_int().value();
362 if (args.contains("mts") && args["mts"].is_int()) mts = (int)args["mts"].as_int().value();
363 if (args.contains("burst") && args["burst"].is_int()) burst = (int)args["burst"].as_int().value();
364 if (args.contains("depth") && args["depth"].is_int()) depth = (int)args["depth"].as_int().value();
365 if (args.contains("chunks") && args["chunks"].is_int()) chunks = (int)args["chunks"].as_int().value();
366 }
367 parlio_tx_unit_config_t cfg = {};
368 cfg.clk_src = PARLIO_CLK_SRC_DEFAULT;
369 cfg.data_width = (size_t)width;
370 cfg.clk_in_gpio_num = (gpio_num_t)-1;
371 cfg.clk_out_gpio_num = (gpio_num_t)-1;
372 cfg.valid_gpio_num = (gpio_num_t)-1;
373 cfg.trans_queue_depth = (size_t)depth;
374 cfg.max_transfer_size = (size_t)mts;
375 cfg.output_clk_freq_hz = (uint32_t)hz;
376 setParlioRawTxEdge(cfg, 0); // shift_edge where it exists, sample_edge before
377 cfg.bit_pack_order = PARLIO_BIT_PACK_ORDER_MSB;
378 if (burst > 0) cfg.dma_burst_size = (size_t)burst;
379 for (int i = 0; i < 16; ++i) cfg.data_gpio_nums[i] = (gpio_num_t)-1;
380 cfg.data_gpio_nums[0] = (gpio_num_t)pin;
381 parlio_tx_unit_handle_t unit = nullptr;
382 esp_err_t err = parlio_new_tx_unit(&cfg, &unit);
383 if (err != ESP_OK) {
384 response.set("success", false);
385 response.set("error", esp_err_to_name(err));
386 return response;
387 }
388 err = parlio_tx_unit_enable(unit);
389 uint8_t* buf = parlioRawTestState().buffer;
390 for (int i = 0; i < 512; ++i) buf[i] = (uint8_t)pattern;
391 parlio_transmit_config_t tcfg = {};
392 tcfg.idle_value = 0;
393 tcfg.flags.queue_nonblocking = qnb ? 1 : 0;
394 if (burst > 0) {
395 // dma_burst_size is a unit-config field; already applied below via cfg2 hack? No —
396 // it must be set before creation; handled via the 'burst' arg at cfg time.
397 }
398 esp_err_t terr = ESP_OK;
399 const size_t chunk_bytes = 512 / (chunks > 0 ? chunks : 1);
400 // Repeat for ~3 s so the edge-probe task (which re-arms 150 ms
401 // after the RPC) always overlaps live transmissions.
402 for (int rep = 0; rep < 300 && terr == ESP_OK; ++rep) {
403 for (int c = 0; c < chunks && terr == ESP_OK; ++c) {
404 terr = parlio_tx_unit_transmit(unit, buf + c * chunk_bytes, chunk_bytes * 8, &tcfg);
405 }
406 if (terr == ESP_OK) {
407 (void)parlio_tx_unit_wait_all_done(unit, 100);
408 }
409 vTaskDelay(pdMS_TO_TICKS(10));
410 }
411 esp_err_t werr = parlio_tx_unit_wait_all_done(unit, 1000);
412 parlio_tx_unit_disable(unit);
413 parlio_del_tx_unit(unit);
414 response.set("success", true);
415 response.set("enableErr", esp_err_to_name(err));
416 response.set("txErr", esp_err_to_name(terr));
417 response.set("waitErr", esp_err_to_name(werr));
418 return response;
419 });
420#endif
421
422 // "edgeProbe" / "edgeProbeRead" — ISR-based edge recorder
423 // (FastLED#3586 bring-up): arms a GPIO any-edge interrupt that
424 // timestamps up to 200 edges with the cycle counter. Arm it, run a
425 // test, then read back exact pulse widths — a 6-ns logic probe for
426 // "transmits but capture sees nothing" investigations.
427#if defined(FL_IS_ESP32)
428 remote.bind("edgeProbe", [](const fl::json& args) -> fl::json {
429 fl::json response = fl::json::object();
430 int pin = 0;
431 bool passive = false;
432 if (args.is_object() && args.contains("pin") && args["pin"].is_int()) {
433 pin = static_cast<int>(args["pin"].as_int().value());
434 }
435 if (args.is_object() && args.contains("passive") && args["passive"].is_bool()) {
436 passive = args["passive"].as_bool().value();
437 }
438 edgeProbeArmMode(pin, passive);
439 response.set("success", true);
440 response.set("pin", static_cast<int64_t>(pin));
441 response.set("selfTestEdges", static_cast<int64_t>(edgeProbeSelfTestEdges()));
442 return response;
443 });
444
445 remote.bind("edgeProbeRead", [](const fl::json& args) -> fl::json {
446 fl::json response = fl::json::object();
447 response.set("success", true);
448 fl::u32 count = 0;
449 const fl::u32 *stamps = edgeProbeStamps(count);
450 response.set("edges", static_cast<int64_t>(count));
451 response.set("probeState", static_cast<int64_t>(edgeProbeState()));
452 {
453 const fl::u32 *rl = edgeProbeRmtLive();
454 fl::json live = fl::json::array();
455 for (int k = 0; k < 8; ++k) live.push_back(static_cast<int64_t>(rl[k]));
456 response.set("rmtLive", live);
457 }
458 fl::json runs = fl::json::array();
459 // Convert consecutive timestamps to durations in ns. Entry i
460 // encodes (level << 31) | cycle_stamp.
461 for (fl::u32 i = 1; i < count && i < 200; ++i) {
462 const fl::u32 prev = stamps[i - 1];
463 const fl::u32 cur = stamps[i];
464 const fl::u32 d_cycles = (cur & 0x7FFFFFFFu) - (prev & 0x7FFFFFFFu);
465 const fl::u32 level = prev >> 31;
466 // cycles -> ns via configured CPU MHz
467 const fl::u64 ns = (static_cast<fl::u64>(d_cycles) * 1000u) / edgeProbeCpuMhz();
468 fl::json e = fl::json::object();
469 e.set("level", static_cast<int64_t>(level));
470 e.set("ns", static_cast<int64_t>(ns));
471 runs.push_back(e);
472 }
473 response.set("runs", runs);
474 return response;
475 });
476#endif
477
478 // "heapCheck" — heap integrity + stats (FastLED#3588 corruption
479 // bisect). heap_caps_check_integrity_all walks every block; with
480 // poisoning configured in the IDF libs it also validates canaries.
481#if defined(FL_IS_ESP32)
482 remote.bind("heapCheck", [](const fl::json& args) -> fl::json {
483 fl::json response = fl::json::object();
484 const bool intact = heap_caps_check_integrity_all(true);
485 response.set("success", true);
486 response.set("intact", intact);
487 response.set("free", static_cast<int64_t>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
488 response.set("minFree", static_cast<int64_t>(heap_caps_get_minimum_free_size(MALLOC_CAP_8BIT)));
489 response.set("largest", static_cast<int64_t>(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT)));
490 response.set("loopStackHighWater", static_cast<int64_t>(uxTaskGetStackHighWaterMark(nullptr)));
491#if configUSE_TRACE_FACILITY
492 {
493 // Per-task stack headroom (words): a near-zero value means
494 // that task is about to overflow into adjacent heap
495 // (FastLED#3588 candidate mechanism).
496 TaskStatus_t statuses[16];
497 const UBaseType_t n = uxTaskGetSystemState(statuses, 16, nullptr);
498 fl::json tasks = fl::json::array();
499 for (UBaseType_t i = 0; i < n; ++i) {
500 fl::json t = fl::json::object();
501 t.set("name", statuses[i].pcTaskName);
502 t.set("hw", static_cast<int64_t>(statuses[i].usStackHighWaterMark));
503 tasks.push_back(t);
504 }
505 response.set("tasks", tasks);
506 }
507#endif
508 return response;
509 });
510#endif
511
512 remote.bind("peekMem", [](const fl::json& args) -> fl::json {
513 fl::json response = fl::json::object();
514 if (!args.is_object() || !args.contains("addr") ||
515 !args["addr"].is_int()) {
516 response.set("success", false);
517 response.set("error", "InvalidArgs");
518 response.set("message", "Expected {addr: u32, count?: 1-16}");
519 return response;
520 }
521 const uint32_t addr =
522 static_cast<uint32_t>(args["addr"].as_int().value());
523 int count = 1;
524 if (args.contains("count") && args["count"].is_int()) {
525 count = static_cast<int>(args["count"].as_int().value());
526 }
527 if (count < 1 || count > 16 || (addr & 3u) != 0) {
528 response.set("success", false);
529 response.set("error", "InvalidArgs");
530 response.set("message", "count must be 1-16, addr 4-byte aligned");
531 return response;
532 }
533 fl::json values = fl::json::array();
534 const volatile uint32_t* p =
535 reinterpret_cast<const volatile uint32_t*>(addr); // ok reinterpret cast - caller-supplied MMIO/SRAM address, bench diagnostic
536 for (int i = 0; i < count; ++i) {
537 values.push_back(static_cast<int64_t>(p[i]));
538 }
539 response.set("success", true);
540 response.set("addr", static_cast<int64_t>(addr));
541 response.set("values", values);
542 return response;
543 });
544}
545
546#endif // FL_PLATFORM_HAS_LARGE_MEMORY
const fl::u32 * edgeProbeStamps(fl::u32 &count)
Timestamp buffer: entry = (level_before_edge << 31) | cycle_count.
fl::u32 edgeProbeState()
Probe task progress: 0=not started 1=started 2=triggered 3=sampled.
const fl::u32 * edgeProbeRmtLive()
RMT registers snapshotted at trigger time (INT_RAW, CH2STATUS, CH3STATUS, CH2_RX_CONF1).
fl::u32 edgeProbeSelfTestEdges()
Edges recorded by the arm-time pull-toggle self-test.
void edgeProbeArmMode(int pin, bool passive)
Passive variant: no pinMode/attachInterrupt/pull toggles — only the triggered tight-loop sampler task...
fl::u32 edgeProbeCpuMhz()
CPU frequency in MHz for cycle→ns conversion.
Full PARLIO encode bench for ESP32-P4 (post-byte-LUT, #2526 landed).
PARLIO ISR-streaming functional validation (#2548 deep-dive follow-up).
Issue #2994 repro: compounded per-sequence timing drift vs 3.10.3.
Wave8 expansion micro-benchmark for #2526.
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::unique_ptr< fl::Remote > remote
Definition RpcClient.ino:43
fl::net::ble — BLE GATT transport layer for JSON-RPC
JSON adapter for bus_info.h.
SPI encoder configuration for clocked LED chipsets.
fl::json runParallelTestImpl(const fl::json &args)
fl::json runSingleTestImpl(const fl::json &args)
void bindSystemMethods(fl::Remote &remote)
fl::shared_ptr< AutoResearchState > mState
fl::unique_ptr< fl::Remote > mRemote
static fl::Watchdog & watchdog() FL_NO_EXCEPT
Access the unified cross-platform watchdog timer.
JSON-RPC server with scheduling support.
Definition remote.h:42
static T & instance() FL_NO_EXCEPT
Definition singleton.h:41
ResetCause lastResetCause() const FL_NO_EXCEPT
const char * c_str() const FL_NO_EXCEPT
void set(const fl::string &key, const json &value) FL_NO_EXCEPT
Definition json.h:873
void push_back(const json &value) FL_NO_EXCEPT
Definition json.h:925
static json object() FL_NO_EXCEPT
Definition json.h:864
static json array() FL_NO_EXCEPT
Definition json.h:860
static uint32_t t
Definition Luminova.h:55
Task executor — runs registered task runners and manages the run loop.
Platform-abstracted heap memory query functions.
FastLED's Elegant JSON Library: fl::json
fl::json runRpPioParallelResourceTest(const fl::json &args)
Prove PIO0 + PIO1 simultaneous operation at the resource level (#3899).
fl::json runRpPioContentionTest()
Reproduce FastLED#1471's PIO state-machine contention on real RP silicon.
fl::json runRpConcurrencyTest()
Exercise the RP dual-core mutex and semaphore backends from both cores.
constexpr const char * chipName()
::size_t size_t
Definition s16x16x4.h:21
Status status() FL_NO_EXCEPT
Current connection state.
Definition wifi.cpp.hpp:43
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
ResetCause
Cause of the previous boot. Call once early in setup().
Definition watchdog.h:43
u8 width
Definition blur.h:186
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
fl::string_view resetCauseName(ResetCause c) FL_NO_EXCEPT
Return a static-lifetime name for c — zero-cost, no allocation.
Definition watchdog.h:61
fl::json deviceJson()
fl::u64 u64
Definition s16x16x4.h:221
unsigned char uint8_t
Definition s16x16x4.h:209
corkscrew_args args
Definition old.h:149
Promise-based fluent API for FastLED - standalone async primitives.
#define FL_EXTERN_C_BEGIN
#define FL_EXTERN_C_END
Umbrella header for SIMD subsystem.
Unified cross-platform Watchdog Timer API for FastLED.