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

Function measureTightTiming

examples/AutoResearch/AutoResearchRemote.cpp:147–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145};
146
147fl::json measureTightTiming(const fl::string& driver_name,
148 const fl::ChipsetTimingConfig& timing,
149 const fl::vector<fl::ChannelConfig>& tx_configs,
150 int iterations,
151 uint32_t max_allowed_overhead_us,
152 bool& out_passed) {
153 fl::json metric = fl::json::object();
154 out_passed = false;
155
156 metric.set("requested", true);
157 metric.set("supported", false);
158 metric.set("driver", driver_name.c_str());
159
160 if (iterations < 1) {
161 metric.set("message", "iterations must be >= 1");
162 return metric;
163 }
164 if (tx_configs.empty()) {
165 metric.set("message", "no channel configs");
166 return metric;
167 }
168 for (fl::size i = 0; i < tx_configs.size(); i++) {
169 if (tx_configs[i].isSpi()) {
170 metric.set("message", "clocked SPI timing metric is not supported");
171 return metric;
172 }
173 }
174
175 fl::vector<fl::ChannelConfig> sample_configs = tx_configs;
176 fl::vector<fl::shared_ptr<fl::Channel>> channels;
177 for (fl::size i = 0; i < sample_configs.size(); i++) {
178 fl::ChannelConfig channel_config(
179 sample_configs[i].getDataPin(),
180 timing,
181 sample_configs[i].mLeds,
182 sample_configs[i].rgb_order);
183 fl::shared_ptr<fl::Channel> channel = FastLED.add(channel_config);
184 if (!channel) {
185 FastLED.clear(ClearFlags::CHANNELS);
186 metric.set("message", "failed to create channel");
187 return metric;
188 }
189 channels.push_back(channel);
190 }
191
192 ScopedFastLedBrightness scoped_brightness(255);
193 for (fl::size lane = 0; lane < sample_configs.size(); lane++) {
194 fill_solid(sample_configs[lane].mLeds.data(),
195 sample_configs[lane].mLeds.size(),
196 CRGB::Black);
197 }
198 FastLED.show();
199 if (!FastLED.wait(1000)) {
200 FastLED.clear(ClearFlags::CHANNELS);
201 metric.set("message", "warmup wait timeout");
202 return metric;
203 }
204 delay(2);

Callers 1

runSingleTestImplMethod · 0.85

Calls 15

expectedClocklessWireUsFunction · 0.85
maxLaneLedsFunction · 0.85
getDataPinMethod · 0.80
fill_solidFunction · 0.50
delayFunction · 0.50
CRGBClass · 0.50
microsFunction · 0.50
setMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
isSpiMethod · 0.45

Tested by

no test coverage detected