more accurate SD card rate

This commit is contained in:
Matthew Kennedy 2024-11-24 02:19:02 -05:00 committed by rusefillc
parent 13f7eded9a
commit 5b876677d6
1 changed files with 3 additions and 2 deletions

View File

@ -566,6 +566,7 @@ void mlgLogger() {
}
#endif
systime_t before = chVTGetSystemTime();
writeSdLogLine(logBuffer);
@ -581,8 +582,8 @@ void mlgLogger() {
freq = 1;
}
auto period = 1e6 / freq;
chThdSleepMicroseconds((int)period);
systime_t period = CH_CFG_ST_FREQUENCY / freq;
chThdSleepUntilWindowed(before, before + period);
}
}