🪡 Makes control loop frequency const value

This commit is contained in:
Rune Harlyk
2024-11-16 00:32:17 +01:00
parent d8ca913188
commit b7882ee6cf
+2 -1
View File
@@ -4,12 +4,13 @@ DRAM_ATTR Spot spot;
void IRAM_ATTR SpotControlLoopEntry(void*) { void IRAM_ATTR SpotControlLoopEntry(void*) {
TickType_t xLastWakeTime = xTaskGetTickCount(); TickType_t xLastWakeTime = xTaskGetTickCount();
const TickType_t xFrequency = 10 / portTICK_PERIOD_MS;
for (;;) { for (;;) {
spot.readSensors(); spot.readSensors();
spot.planMotion(); spot.planMotion();
spot.updateActuators(); spot.updateActuators();
spot.emitTelemetry(); spot.emitTelemetry();
vTaskDelayUntil(&xLastWakeTime, 10 / portTICK_PERIOD_MS); vTaskDelayUntil(&xLastWakeTime, xFrequency);
} }
} }