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

◆ check()

bool SketchHalt::check ( )
inline

Check if sketch is halted and handle periodic message printing.

Returns
true if halted (caller should return from loop immediately)

This should be the FIRST line in loop(): if (halt.check()) return;

Definition at line 32 of file SketchHalt.h.

32 {
33 if (!mHalted) {
34 return false;
35 }
36
37 fl::u32 current_time = fl::millis();
38 if (mLastPrintTime == 0 || (current_time - mLastPrintTime) >= 5000) {
39 fl::cout << "ERROR: HALT: " << mMessage.c_str() << "\n";
40 mLastPrintTime = current_time;
41 }
42 fl::delayMillis(100);
43 return true;
44 }
bool mHalted
Definition SketchHalt.h:55
fl::u32 mLastPrintTime
Definition SketchHalt.h:57
fl::string mMessage
Definition SketchHalt.h:56
ostream cout
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
void delayMillis(u32 ms) FL_NOEXCEPT
Delay for a given number of milliseconds (legacy - no async pumping)

References fl::cout, fl::delayMillis(), mHalted, fl::millis(), mLastPrintTime, and mMessage.

+ Here is the call graph for this function: