use my Timer class on all platforms, it works better than the freertos version

This commit is contained in:
geeksville
2020-05-25 07:48:36 -07:00
parent 2770cc7de3
commit 1656c8d0cb
8 changed files with 48 additions and 56 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "lock.h"
#include <Arduino.h>
#include <cstdint>
#include <unordered_set>
@@ -66,7 +67,13 @@ class PeriodicTask
* Set a new period in msecs (can be called from doTask or elsewhere and the scheduler will cope)
* While zero this task is disabled and will not run
*/
void setPeriod(uint32_t p) { period = p; }
void setPeriod(uint32_t p)
{
lastMsec = millis(); // reset starting from now
period = p;
}
uint32_t getPeriod() const { return period; }
/**
* Syntatic sugar for suspending tasks