ESP_IOT v2.5
IOT ESP Coding
TimerDelayClass.cpp
Go to the documentation of this file.
1//
2// TimerDelayClass.cpp
3//
4//
5// Created by Scott Moody on 3/25/25.
6//
7
8#include "TimerDelayClass.h"
9
10//! delay seconds
11//! constructor
12TimerDelayClass::TimerDelayClass(float defaultDelayAmountSeconds)
13{
14 _defaultDelayAmountSeconds = defaultDelayAmountSeconds;
15 _delayRunning = false;
16}
17
18//! stops delay
20{
21 SerialLots.println("stopDelay _delayRunning=false");
22
23 _delayRunning = false;
24}
25
26
27//! whether the currently delay is finished, false if not running at all
29{
30 if (_delayRunning && ((millis() - _delayStart) >= (_delaySeconds * 1000)))
31 {
32 _delayRunning = false;
33 SerialLots.println("delayFinished..");
34 return true;
35 }
36 return false;
37}
38
39//!starts delay calculation
40void TimerDelayClass::startDelay(float seconds)
41{
42 SerialLots.printf("startDelay: %f\n", seconds);
43
44 _delayStart = millis(); // start delay
45 _delayRunning = true; // not finished yet
46 _delaySeconds = seconds;
47
48}
unsigned long millis()
Definition: TinyGPS.cpp:35
void startDelay(float delayAmountSeconds)
starts delay calculation
boolean delayFinished()
whether the currently delay is finished, false if not running at all
TimerDelayClass(float defaultDelayAmountSeconds)
constructor
void stopDelay()
stops delay