mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 02:51:47 +02:00
Improve Power State Update Task timing
This commit is contained in:
parent
a48dd7c9dd
commit
fd1be4ffeb
@ -14,8 +14,11 @@ SemaphoreHandle_t PowerManager::powerMutex = NULL;
|
|||||||
void vTaskUpdatePowerState(void *pvParameters) {
|
void vTaskUpdatePowerState(void *pvParameters) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ESP_LOGV(TAG, "Updating Power State...");
|
ESP_LOGV(TAG, "Updating Power State...");
|
||||||
|
TickType_t executionStart = xTaskGetTickCount();
|
||||||
PowerManager::updatePowerStateHandler();
|
PowerManager::updatePowerStateHandler();
|
||||||
vTaskDelay(pdMS_TO_TICKS(10));
|
vTaskDelayUntil(
|
||||||
|
&executionStart,
|
||||||
|
pdMS_TO_TICKS(PowerParameters::POWER_STATE_UPDATE_INTERVAL_MS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#ifndef PowerParameters_h
|
#ifndef PowerParameters_h
|
||||||
#define PowerParameters_h
|
#define PowerParameters_h
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
namespace PowerParameters {
|
namespace PowerParameters {
|
||||||
|
|
||||||
struct Battery {
|
struct Battery {
|
||||||
@ -114,6 +115,9 @@ enum PowerConsumers {
|
|||||||
MOTOR_RIGHT,
|
MOTOR_RIGHT,
|
||||||
IMU
|
IMU
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr uint32_t POWER_STATE_UPDATE_INTERVAL_MS = 10;
|
||||||
|
|
||||||
}; // namespace PowerParameters
|
}; // namespace PowerParameters
|
||||||
|
|
||||||
#endif // Consumptions_h
|
#endif // Consumptions_h
|
Loading…
x
Reference in New Issue
Block a user