@brief Check if sketch is halted and handle periodic message printing @return true if halted (caller should return from loop immediately) This should be the FIRST line in loop(): if (halt.check()) return;
| 30 | /// This should be the FIRST line in loop(): |
| 31 | /// if (halt.check()) return; |
| 32 | bool check() { |
| 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 | } |
| 45 | |
| 46 | /// @brief Halt sketch execution with an error message |
| 47 | void error(const char* message) { |
nothing calls this directly
no test coverage detected