40#define EDGE_BUFFER_SIZE 100
41#define WAIT_TIMEOUT_MS 100
79 while (!
Serial && millis() < 3000);
80 const char* loop_back_mode =
PIN_TX ==
PIN_RX ?
"INTERNAL" :
"JUMPER WIRE";
82 FL_WARN(
"\n=== FastLED RX Channel Test ===");
87 FL_WARN(
"LOOP BACK MODE: " << loop_back_mode);
92 halt.error(
"Missing jumper wire between TX and RX pins");
96 FL_WARN(
"TX and RX use same pin (" <<
PIN_TX <<
") - no jumper wire needed");
103 FL_WARN(
"Creating RX channel for testing...");
105 auto rx_test =
FastLED.addRx(test_channel_config);
107 halt.error(
"Failed to create RX channel for testing");
114 test_config.
hz = 1000000;
119 if (!rx_test->begin(test_config)) {
120 halt.error(
"Failed to initialize test RX channel");
126 halt.error(
"RX channel sanity check failed - RX not working");
133 FL_WARN(
"Creating main RX channel...");
137 halt.error(
"Failed to create main RX channel");
140 FL_WARN(
"✓ Main RX channel created\n");
147 if (
halt.check())
return;
149 FL_WARN(
"\n╔════════════════════════════════════════════════════════════════╗");
151 FL_WARN(
"╚════════════════════════════════════════════════════════════════╝\n");
162 FL_WARN(
"[TEST] Initializing RX channel and executing toggles...");
164 rx_channel->setConfig(config);
172 FL_ERROR(
"Timeout waiting for data");
174 FL_ERROR(
"Buffer overflow during capture");
176 FL_WARN(
"[TEST] ✓ Data captured successfully");
180 size_t edge_count = rx_channel->getRawEdgeTimes(edge_buffer);
183 const uint32_t TOLERANCE_PERCENT = 15;
187 FL_WARN(
"\n╔════════════════════════════════════════════════════════════════╗");
188 FL_WARN(
"║ TEST COMPLETE - Waiting 5 seconds...");
189 FL_WARN(
"╚════════════════════════════════════════════════════════════════╝\n");
const fl::RxBackend RX_BACKEND
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::shared_ptr< fl::RxChannel > & rxChannelSingleton()
const fl::array< PinToggle, 6 > TEST_PATTERN
Sketch halting mechanism that prevents watchdog timer resets.
A fixed-size array implementation similar to std::array.
@ RMT
ESP32-only RMT capture backend.
@ TIMEOUT
Operation timed out.
@ BUFFER_OVERFLOW
Buffer overflow.
void executeToggles(fl::RxChannel &rx, fl::span< const PinToggle > toggles, int pin_tx, uint32_t wait_ms)
Execute pin toggles and initialize RX channel for capture.
bool testRxChannelSanity(fl::shared_ptr< fl::RxChannel > rx, int pin_tx)
Test RX channel functionality with low-frequency pattern.
bool validateEdgeTiming(fl::span< const fl::EdgeTime > edges, size_t edge_count, fl::span< const PinToggle > expected_pattern, uint32_t tolerance_percent)
Validate captured edge timings against expected pattern.
bool verifyJumperWire(int pin_tx, int pin_rx)
Verify jumper wire connection between TX and RX pins.