Rename Power.* to PowerManager.* for clarity

This commit is contained in:
2025-02-16 01:10:33 +01:00
parent ff11ad95b0
commit 5efa7a5efd
20 changed files with 152 additions and 152 deletions

View File

@ -27,7 +27,7 @@ photoTransistors LightDetection::getBrightest(ptType type){
photoTransistors maxSensor;
uint16_t maxReading = 0;
uint16_t currentReading = 0;
if (type == IR){
maxSensor = IR_FRONT;
for(const auto pt : allIRPTs){
@ -47,15 +47,15 @@ photoTransistors LightDetection::getBrightest(ptType type){
}
}
}
return maxSensor;
};
uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween){
TickType_t xLastWakeTime = xTaskGetTickCount();
TickType_t frequency = timeBetween / portTICK_PERIOD_MS;
uint64_t cumulatedResult = 0;
uint64_t cumulatedResult = 0;
for(int i = 0; i < measurments; i++){
cumulatedResult += LightDetection::getValue(sensor);
xTaskDelayUntil(&xLastWakeTime,frequency);
@ -64,7 +64,7 @@ uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measu
};
void LightDetection::beginInfrared(void){
if(!Power::waitForCurrentAllowance(
if(!PowerManager::waitForCurrentAllowance(
PowerParameters::PowerConsumers::PT_IR,
PowerParameters::CurrentConsumptions::CURRENT_PT * 4,
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
@ -80,7 +80,7 @@ void LightDetection::beginInfrared(void){
};
void LightDetection::beginDaylight(void){
if(!Power::waitForCurrentAllowance(
if(!PowerManager::waitForCurrentAllowance(
PowerParameters::PowerConsumers::PT_DL,
PowerParameters::CurrentConsumptions::CURRENT_PT * 2,
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
@ -113,7 +113,7 @@ uint16_t LightDetection::readIRPT(photoTransistors sensor){
default:
break;
}
//Power::releaseCurrent(PowerParameters::PowerConsumers::PT_IR);
//PowerManager::releaseCurrent(PowerParameters::PowerConsumers::PT_IR);
//digitalWrite(IR_PT_ENABLE,LOW);
return result;
};
@ -132,7 +132,7 @@ uint16_t LightDetection::readDLPT(photoTransistors sensor){
default:
break;
}
Power::releaseCurrent(PowerParameters::PowerConsumers::PT_DL);
PowerManager::releaseCurrent(PowerParameters::PowerConsumers::PT_DL);
digitalWrite(DL_PT_ENABLE,LOW);
return result;
};
@ -148,4 +148,4 @@ float LightDetection::modelCurrentConsumption(photoTransistors sensor){
float LightDetection::modelChargeConsumptionOn(photoTransistors sensor,
uint16_t durationMs) {
return (LightDetection::modelCurrentConsumption(sensor) * durationMs) / 10e6f;
}
}