FastLED 3.9.15
Loading...
Searching...
No Matches

◆ validateExpectedDrivers()

void DriverTestRunner::validateExpectedDrivers ( )
inlineprivate

Validate that all expected drivers are present.

Definition at line 153 of file TestRunner.h.

153 {
154 fl::vector<const char*> expected;
155 getExpectedDrivers(expected);
156
157 if (expected.empty()) {
158 Serial.println("\n[WARNING] Unknown platform - skipping driver validation");
159 return;
160 }
161
162 fl::sstream ss;
163 ss << BOX_TOP;
164 ss << "| DRIVER VALIDATION FOR " << getPlatformName() << "\n";
165 ss << BOX_BOTTOM;
166 Serial.print(ss.str().c_str());
167
168 // Get available drivers from FastLED
169 auto drivers = FastLED.getDriverInfos();
170
171 // Print expected drivers
172 ss.clear();
173 ss << "\nExpected drivers (" << expected.size() << "):\n";
174 for (fl::size i = 0; i < expected.size(); i++) {
175 ss << " - " << expected[i] << "\n";
176 }
177 Serial.print(ss.str().c_str());
178
179 // Print available drivers with details
180 ss.clear();
181 ss << "\nAvailable drivers (" << drivers.size() << "):\n";
182 for (fl::size i = 0; i < drivers.size(); i++) {
183 ss << " - " << drivers[i].name.c_str()
184 << " (priority: " << drivers[i].priority
185 << ", enabled: " << (drivers[i].enabled ? "yes" : "no") << ")\n";
186 }
187 Serial.print(ss.str().c_str());
188
189 // Check each expected driver is present
190 Serial.println("\nValidation results:");
191 for (fl::size i = 0; i < expected.size(); i++) {
192 const char* expName = expected[i];
193 bool found = false;
194
195 for (fl::size j = 0; j < drivers.size(); j++) {
196 if (fl::strcmp(drivers[j].name.c_str(), expName) == 0) {
197 found = true;
198 break;
199 }
200 }
201
202 fl::sstream resultMsg;
203 resultMsg << expName << " driver " << (found ? "found" : "MISSING!");
204 recordResult(resultMsg.str().c_str(), found);
205 }
206 }
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
const char * getPlatformName()
Get a human-readable name for the current platform.
void getExpectedDrivers(fl::vector< const char * > &expected)
Populate a vector with the expected drivers for this platform.
#define BOX_TOP
Definition TestRunner.h:27
#define BOX_BOTTOM
Definition TestRunner.h:29
fl::span< const fl::DriverInfo > getDriverInfos() const
Get full state of all registered channel drivers.
void recordResult(const char *name, bool passed)
Record a test result.
Definition TestRunner.h:136
const char * c_str() const FL_NOEXCEPT
string str() const FL_NOEXCEPT
Definition strstream.h:43
void clear() FL_NOEXCEPT
Definition strstream.h:358
const char * c_str() const FL_NOEXCEPT
Definition strstream.h:44
fl::size size() const FL_NOEXCEPT
bool empty() const FL_NOEXCEPT
int strcmp(const char *s1, const char *s2) FL_NOEXCEPT
#define Serial
Definition serial.h:304

References BOX_BOTTOM, BOX_TOP, fl::basic_string::c_str(), fl::sstream::c_str(), fl::sstream::clear(), fl::vector_basic::empty(), FastLED, getExpectedDrivers(), getPlatformName(), recordResult(), Serial, fl::vector_basic::size(), fl::sstream::str(), and fl::strcmp().

Referenced by runAllTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: