Fix mistakes

This commit is contained in:
2025-02-16 01:43:19 +01:00
parent 5efa7a5efd
commit 7a7139360c
8 changed files with 13 additions and 21 deletions

View File

@@ -14,8 +14,8 @@
#include "driver/adc.h"
#include "esp_adc/adc_oneshot.h"
#include "freertos/semphr.h"
#ifndef Power_h
#define Power_h
#ifndef PowerManager_h
#define PowerManager_h
#define TAG "Power"
@@ -47,7 +47,7 @@ private:
xSemaphoreGive(mutex);
}
}
bool isLocked() { return locked; }
bool isLocked() const { return locked; }
};
protected:
@@ -103,7 +103,7 @@ public:
/// @return whether the current could be successfully allocated
static bool
tryAccquireCurrentAllowance(PowerParameters::PowerConsumers consumer,
uint16_t neededcurrent,
uint16_t neededCurrent,
uint16_t requestedDurationMs = 0);
/// @brief "Return" the current currently allocated to a consumer
/// @param consumer the active consumer to release the current for

View File

@@ -304,9 +304,8 @@ float PowerScheduler::getConsumerCurrent(
return currentSum;
}
PowerScheduler::PowerScheduler(float i_limit_ma, float i_max_ma) {
this->limitCurrent = i_limit_ma;
this->maximumCurrent = i_max_ma;
PowerScheduler::PowerScheduler(float i_limit_ma, float i_max_ma)
: freeLimitCurrentBudget(i_limit_ma), freeMaximumCurrentBudget(i_max_ma) {
this->currentAllowances = std::vector<CurrentAllowance>();
this->powerSchedulerMutex = xSemaphoreCreateMutex();
}

View File

@@ -91,7 +91,7 @@ public:
/// account, so requesting the same or less power will always succeed. Also,
/// small amounts of power (below 1 mA) will always be granted.
bool tryAccquireCurrentAllowance(PowerParameters::PowerConsumers consumer,
float neededcurrent,
float neededCurrent,
uint16_t requestedDurationMs = 0);
/// @brief "Return" the current currently allocated to a consumer
/// @param consumer the active consumer to release the current for