system: refactoring & delays clean-up

- BREAKING replace loadavg and system check from millis to seconds
- implement all available system clocks, make sure it is correctly
  scaled with the origin type
- fix duration::{millis(),ccount(),seconds()} and return a respective
  clock's time_point instead of duration. just like led sources, make
  sure every module stores timestamps as time_point and intervals as
  duration
- no need to track millis overflow on top of existing overflow counter
  of the micros64 in getUptime
- remove class overhead in led static delays conversion, just try to
  inline the required calculations and use NAME as unique id

also fix some non-apparent issues with heartbeat
- allow zero interval when it is also Mode::Once
- iterating runners to find the interval might return zero
This commit is contained in:
Maxim Prokhorov
2021-11-25 19:06:18 +03:00
parent 2fe5fc6c34
commit 1ca98880d6
14 changed files with 829 additions and 523 deletions

View File

@@ -240,7 +240,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
}
// Do not record crash data when doing a normal reboot or when crash trace was disabled
if (checkNeedsReset()) {
if (pendingDeferredReset()) {
return;
}
@@ -297,7 +297,7 @@ void crashDump(Print& print) {
}
void crashResetReason(Print& print) {
auto reason = customResetReason();
const auto reason = customResetReason();
bool custom { CustomResetReason::None != reason };
print.printf_P(PSTR("last reset reason: %s\n"), custom
? customResetReasonToPayload(reason).c_str()