mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
refactor: time steps with ElapsedTimer::lap()
loop(), socket client init and /discovery each read a step's time and restarted the timer by hand. lap() does both. Also put the request timing comment back on timeRequest() and say why /discovery logs its steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
293e013aa2
commit
4544eb6469
6 changed files with 53 additions and 28 deletions
|
|
@ -24,6 +24,14 @@ class ElapsedTimer {
|
|||
ElapsedTimer() : _start(micros()) {}
|
||||
void restart() { _start = micros(); }
|
||||
uint32_t us() const { return micros() - _start; }
|
||||
// The time since the last lap (or start) and starts the next one, for
|
||||
// timing a series of steps.
|
||||
uint32_t lap() {
|
||||
const uint32_t now = micros();
|
||||
const uint32_t us = now - _start;
|
||||
_start = now;
|
||||
return us;
|
||||
}
|
||||
};
|
||||
|
||||
// Whether logElapsed() would print a timing this long. Check it before
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue