mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 11:01:46 +02:00
Fix mistakes
This commit is contained in:
parent
5efa7a5efd
commit
7a7139360c
@ -34,7 +34,7 @@ public:
|
||||
InfraredLight infraredLight;
|
||||
Communication communication;
|
||||
Display display;
|
||||
Power power;
|
||||
PowerManager power;
|
||||
void begin(void);
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float modelCurrentConsumption();
|
||||
static float modelCurrentConsumption();
|
||||
|
||||
|
||||
/**
|
||||
@ -84,7 +84,7 @@ public:
|
||||
* @param durationMs
|
||||
* @return float
|
||||
*/
|
||||
float modelChargeConsumption(uint16_t durationMs);
|
||||
static float modelChargeConsumption(uint16_t durationMs);
|
||||
|
||||
protected:
|
||||
uint16_t readDoubleRegister(uint8_t regAddr);
|
||||
|
@ -80,8 +80,6 @@ void InfraredLED::setState(bool state){
|
||||
|
||||
void InfraredLED::sendFrequency(uint16_t frequency){
|
||||
constexpr uint32_t duty = DUTY_CYCLE_FREQUENCY;
|
||||
// Float to force float division without casting
|
||||
constexpr float resolution = 1 << DUTY_RESOLUTION;
|
||||
if (this->ledPin == IR_BOTTOM_PIN) {
|
||||
PowerManager::waitForCurrentAllowance(
|
||||
PowerParameters::PowerConsumers::LED_IR_BOTTOM,
|
||||
@ -111,8 +109,6 @@ float InfraredLED::modelCurrentConsumption(uint32_t duty){
|
||||
};
|
||||
|
||||
float InfraredLED::modelChargeConsumptionOn(uint16_t durationMs) {
|
||||
// Float to force float division without casting
|
||||
constexpr float resolution = 1 << DUTY_RESOLUTION;
|
||||
if (this->ledPin == IR_BOTTOM_PIN) {
|
||||
return durationMs *
|
||||
(PowerParameters::CurrentConsumptions::CURRENT_LED_IR_BOTTOM) / 10e6f;
|
||||
@ -124,8 +120,6 @@ float InfraredLED::modelChargeConsumptionOn(uint16_t durationMs) {
|
||||
}
|
||||
|
||||
float InfraredLED::modelChargeConsumptionSendFrequency(uint16_t durationMs) {
|
||||
// Float to force float division without casting
|
||||
|
||||
return (durationMs * this->modelCurrentConsumption(DUTY_CYCLE_FREQUENCY)) /
|
||||
10e6f;
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ class Motor{
|
||||
uint8_t pin;
|
||||
ledc_timer_t timer;
|
||||
ledc_channel_t channel;
|
||||
Power* powerManager;
|
||||
uint16_t duty;
|
||||
// The phase of the pwm signal, expressed as a number betweeen 0 and
|
||||
// the maximum value representable by the pwm timer resolution.
|
||||
|
@ -31,7 +31,7 @@ class MultiColorLight {
|
||||
protected:
|
||||
static const uint16_t ledAmount = 3;
|
||||
static const int16_t ledPin = 48;
|
||||
static const uint8_t maxBrightness = 150;
|
||||
static const uint8_t defaultMaxBrightness = 150;
|
||||
Adafruit_NeoPixel rgbLeds;
|
||||
static constexpr int maximumExecutionDelayMs = 10;
|
||||
|
||||
@ -203,7 +203,7 @@ private:
|
||||
* can be between 0 - maxBrightness
|
||||
*/
|
||||
uint32_t normalizeColor(uint32_t color,
|
||||
uint8_t maxBrigthness = maxBrightness);
|
||||
uint8_t maxBrightness = defaultMaxBrightness);
|
||||
};
|
||||
|
||||
#endif // MultiColorLight_h
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user