MCPcopy Create free account
hub / github.com/arkhipenko/TaskScheduler / waitForCondition

Function waitForCondition

tests/Arduino.h:85–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83// Helper function to wait for condition with timeout
84template<typename Condition>
85inline bool waitForCondition(Condition condition, unsigned long timeout_ms) {
86 unsigned long start_time = millis();
87 while (millis() - start_time < timeout_ms) {
88 if (condition()) {
89 return true;
90 }
91 delay(1); // Use 1ms delay for better timing precision
92 }
93 return false;
94}
95
96#endif // MOCK_ARDUINO_H

Callers 4

runSchedulerUntilMethod · 0.85
runSchedulerUntilMethod · 0.85

Calls 2

millisFunction · 0.85
delayFunction · 0.85

Tested by 4

runSchedulerUntilMethod · 0.68
runSchedulerUntilMethod · 0.68