MCPcopy Create free account
hub / github.com/FastLED/FastLED / testDriver

Function testDriver

examples/AutoResearch/AutoResearchHelpers.cpp:37–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void testDriver(
38 const char* driver_name,
39 const fl::NamedTimingConfig& timing_config,
40 int pin_data,
41 size_t num_leds,
42 CRGB* leds,
43 EOrder color_order,
44 fl::shared_ptr<fl::RxChannel> rx_channel,
45 fl::span<uint8_t> rx_buffer,
46 int base_strip_size,
47 fl::RxDeviceType rx_type,
48 fl::DriverTestResult& result) {
49
50 // Set this driver as exclusive for testing. AutoResearch resolves driver
51 // names at runtime, so we use the by-name helper (auto-enables all
52 // drivers first to ensure the lookup succeeds).
53 if (!autoResearchSetExclusiveDriverByName(driver_name)) {
54 FL_ERROR("Failed to set " << driver_name << " as exclusive driver");
55 result.skipped = true;
56 return;
57 }
58 FL_WARN(driver_name << " driver enabled exclusively\n");
59
60 FL_WARN("[CONFIG] Driver: " << driver_name << " (physical jumper required)\n");
61
62 // Create TX configuration for autoresearch tests.
63 // Build the ClocklessChipset explicitly so the encoder selector (carried
64 // alongside timing in NamedTimingConfig, #2467) is preserved end-to-end.
65 fl::ClocklessChipset chipset(pin_data, timing_config.timing, timing_config.encoder);
66 fl::ChannelConfig tx_config(chipset, fl::span<CRGB>(leds, num_leds), color_order);
67
68 FL_WARN("[INFO] Testing " << timing_config.name << " timing\n");
69
70 // Create autoresearch configuration with all input parameters
71 fl::AutoResearchConfig autoresearch_config(
72 timing_config.timing,
73 timing_config.name,
74 fl::span<fl::ChannelConfig>(&tx_config, 1),
75 driver_name,
76 rx_channel,
77 rx_buffer,
78 base_strip_size,
79 rx_type,
80 timing_config.encoder
81 );
82
83 // FIRST RUN: Discard results (timing warm-up)
84 // TX channel construction may have extra latency on first run
85 FL_WARN("[INFO] Running warm-up frame (results will be discarded)");
86 int warmup_total = 0, warmup_passed = 0;
87 uint32_t warmup_duration_ms = 0;
88 autoResearchChipsetTiming(autoresearch_config, warmup_total, warmup_passed, warmup_duration_ms);
89 FL_WARN("[INFO] Warm-up complete (" << warmup_passed << "/" << warmup_total << " passed - discarding)");
90
91 // SECOND RUN: Keep results (actual test)
92 FL_WARN("[INFO] Running actual test frame");
93 uint32_t test_duration_ms = 0;
94 autoResearchChipsetTiming(autoresearch_config, result.total_tests, result.passed_tests, test_duration_ms);

Callers

nothing calls this directly

Tested by

no test coverage detected