375 {
376
377
380#if defined(ARDUINO_USB_CDC_ON_BOOT) && ARDUINO_USB_CDC_ON_BOOT
381
382
383
384
385
386
388#endif
391
392 FL_WARN(
"[SETUP] AutoResearch sketch starting - serial output active");
393
394
395
396
397
398
399
400
401
402
404
405
413
414 const char* loop_back_mode =
PIN_TX ==
PIN_RX ?
"INTERNAL" :
"JUMPER WIRE";
415
416
418 ss << "\n╔════════════════════════════════════════════════════════════════╗\n";
419 ss << "║ FastLED AutoResearch - Test Matrix Configuration ║\n";
420 ss << "╚════════════════════════════════════════════════════════════════╝\n";
421
422
423 ss << "\n[PLATFORM]\n";
425
426
427 ss << "\n[HARDWARE]\n";
428 ss <<
" TX Pin: " <<
PIN_TX <<
"\n";
429 ss <<
" RX Pin: " <<
PIN_RX <<
"\n";
431 ss << " Loopback Mode: " << loop_back_mode << "\n";
432 ss << " Color Order: RGB\n";
435
436
437
438
439
440
441
442
443
444
445
447 ss << "\n[RX SETUP] Creating RX channel for LED autoresearch\n";
448 ss <<
"[RX CREATE] Creating RX channel on PIN " <<
PIN_RX
449 <<
" (" << (40000000 / 1000000) <<
"MHz, " <<
RX_BUFFER_SIZE <<
" symbols)";
451
453
456 ss << "[RX SETUP]: Failed to create RX channel\n";
457 ss << "[RX SETUP]: Check that RMT peripheral is available and not in use";
459 FL_ERROR(
"Sanity check failed - RX channel creation failed");
460 return;
461 }
462
464 ss << "[RX CREATE] ✓ RX channel created successfully (will be initialized with config in begin())\n";
465 ss << "[RX SETUP] ✓ RX channel ready for LED autoresearch";
467
468
469
470
471
472
473
474
475
476
477
479 ss << "\n[REMOTE RPC] Registering JSON RPC functions for dynamic control";
481
482
484
485 FL_PRINT(
"[REMOTE RPC] ✓ RPC system initialized (testGpioConnection available)");
486
487
488
489
490 FL_PRINT(
"[ASYNC] Setting up JSON-RPC async task (10ms interval)");
492 FL_PRINT(
"[ASYNC] ✓ JSON-RPC task registered with scheduler");
493
494
497
498
499
500
502 ss <<
"\n[GPIO BASELINE TEST] Testing GPIO " <<
PIN_TX <<
" → GPIO " <<
PIN_RX <<
" connectivity";
504
505
506
507 FL_WARN(
"[GPIO BASELINE TEST] Deferred to loop() - waiting for RPC start signal");
508
509
510
511
513
514
517 ss << "\n[DRIVER DISCOVERY]\n";
522 <<
", enabled: " << (
g_autoresearch_state->drivers_available[i].enabled ?
"yes" :
"no") <<
")\n";
523 }
525
526
528
529
531 readyData.
set(
"ready",
true);
532 readyData.
set(
"setupTimeMs",
static_cast<int64_t
>(
millis()));
534 readyData.
set(
"pinTx",
static_cast<int64_t
>(
PIN_TX));
535 readyData.
set(
"pinRx",
static_cast<int64_t
>(
PIN_RX));
537
538
539 FL_PRINT(
"\n[SETUP COMPLETE] AutoResearch ready - awaiting JSON-RPC commands");
541}
fl::shared_ptr< AutoResearchState > g_autoresearch_state
constexpr int DEFAULT_PIN_RX
constexpr int RX_BUFFER_SIZE
const fl::RxBackend RX_BACKEND
constexpr int DEFAULT_PIN_TX
fl::vector_psram< uint8_t > g_rx_buffer_storage
void init_serial_buffers()
static constexpr uint32_t AUTORESEARCH_SERIAL_WAIT_MS
fl::shared_ptr< fl::RxChannel > createRxDevice(int pin)
void autoResearchExpectedEngines()
AutoResearch that expected engines are available for this platform Prints ERROR if any expected engin...
void printStreamRaw(const char *messageType, const fl::json &data)
Print JSONL stream message directly to Serial, bypassing fl::println.
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
void registerFunctions(fl::shared_ptr< AutoResearchState > state)
Register all RPC functions with shared autoresearch state.
static AutoResearchRemoteControl & instance() FL_NOEXCEPT
void set(const fl::string &key, const json &value) FL_NOEXCEPT
static json object() FL_NOEXCEPT
string str() const FL_NOEXCEPT
#define FL_PRINT(X)
Print without prefix (like FL_WARN but without "WARN: " prefix) Uses sstream for dynamic formatting (...
fl::task::Handle setupRpcAsyncTask(AutoResearchRemoteControl &remote_control, int interval_ms=10)
Setup async task for JSON-RPC processing.
void maybeRegisterStubAutorun(AutoResearchRemoteControl &, fl::shared_ptr< AutoResearchState > state)
On FL_IS_STUB: register a one-shot async task that drives autoresearch.
constexpr const char * chipName()
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
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...
void serial_begin(u32 baudRate)
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
const char * toString(RxDeviceType type) FL_NOEXCEPT
Convert RxDeviceType to human-readable string.