Zjednoduseni kodu a odstraneni zbytecne promenne

This commit is contained in:
Pavel Brychta 2018-11-11 08:12:36 +01:00
parent be8e0b341e
commit f8bc7a8360
2 changed files with 4 additions and 9 deletions

View File

@ -38,7 +38,6 @@ bool Interval::expired(void)
{
result = true;
_timefrom = millis();
_timeout = _reload;
}
}
else
@ -53,9 +52,8 @@ bool Interval::expired(void)
void Interval::set(uint32_t tmout)
{
_reload = tmout;
_timefrom = millis();
_timeout = _reload;
_timeout = tmout;
_mode = 0;
_done = 0xff;
}
@ -63,9 +61,8 @@ void Interval::set(uint32_t tmout)
void Interval::setOneshot(uint32_t tmout)
{
_reload = tmout;
_timefrom = millis();
_timeout = _reload;
_timeout = tmout;
_mode = 1;
_done = 0xff;
}
@ -73,9 +70,8 @@ void Interval::setOneshot(uint32_t tmout)
void Interval::setPeriodic(uint32_t tmout)
{
_reload = tmout;
_timefrom = millis();
_timeout = _reload;
_timeout = tmout;
_mode = 2;
_done = 0xff;
}
@ -84,5 +80,5 @@ void Interval::reload(void)
{
_timefrom = millis();
_timeout = _reload;
_done = 0xff;
}

View File

@ -15,7 +15,6 @@ class Interval
protected:
uint32_t _timefrom;
uint32_t _timeout;
uint32_t _reload;
uint8_t _mode; // mode of actual operation (compatibility, oneshot, periodic)
uint8_t _done;
public: