Use 'loop rate' term instead of misleading 'loop frequency'

This commit is contained in:
Oleg Kalachev
2024-12-04 07:00:00 +03:00
parent 7fa3baa76a
commit ea141f851f
5 changed files with 12 additions and 12 deletions

View File

@@ -12,16 +12,16 @@ void step() {
dt = 0; // assume dt to be zero on first step and on reset
}
computeLoopFreq();
computeLoopRate();
}
void computeLoopFreq() {
void computeLoopRate() {
static float windowStart = 0;
static uint32_t freq = 0;
freq++;
static uint32_t rate = 0;
rate++;
if (t - windowStart >= 1) { // 1 second window
loopFreq = freq;
loopRate = rate;
windowStart = t;
freq = 0;
rate = 0;
}
}