Change approach of notifying of power problem to be more beginner friendly

This commit is contained in:
Phillip Kühne 2025-02-13 21:34:27 +01:00
parent 4c13eb593e
commit 598ac75e32
Signed by: phillip
GPG Key ID: E4C1C4D2F90902AA
6 changed files with 7 additions and 7 deletions

View File

@ -82,7 +82,7 @@ void Communication::begin(void) {
PowerParameters::CurrentConsumptions::CURRENT_WIFI_BASE, PowerParameters::CurrentConsumptions::CURRENT_WIFI_BASE,
MESH_MAX_EXECUTION_DELAY_MS, NULL)) { MESH_MAX_EXECUTION_DELAY_MS, NULL)) {
ESP_LOGE(TAG, "Failed to get power for mesh initialization"); ESP_LOGE(TAG, "Failed to get power for mesh initialization");
throw "Failed to get power for mesh initialization"; Serial.println("Failed to get power for mesh initialization");
} }
mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT); mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
mesh.onReceive(&receivedCallback); mesh.onReceive(&receivedCallback);

View File

@ -18,7 +18,7 @@ void Display::begin(void){
PowerParameters::PowerConsumers::DISPLAY_OLED, PowerParameters::CurrentConsumptions::CURRENT_DISPLAY PowerParameters::PowerConsumers::DISPLAY_OLED, PowerParameters::CurrentConsumptions::CURRENT_DISPLAY
,DISPLAY_MAX_EXECUTION_DELAY_MS, NULL)){ ,DISPLAY_MAX_EXECUTION_DELAY_MS, NULL)){
ESP_LOGE(TAG,"Could not get power for Display"); ESP_LOGE(TAG,"Could not get power for Display");
throw "Could not get power for Display"; Serial.println("Could not get power for Display");
} }
//set Mux Ratio //set Mux Ratio
sendDisplayCMD(muxRatio); sendDisplayCMD(muxRatio);

View File

@ -69,7 +69,7 @@ void LightDetection::beginInfrared(void){
PowerParameters::CurrentConsumptions::CURRENT_PT * 4, PowerParameters::CurrentConsumptions::CURRENT_PT * 4,
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) { LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
ESP_LOGE(TAG,"Could not get power for Infrared Phototransistors"); ESP_LOGE(TAG,"Could not get power for Infrared Phototransistors");
throw "Could not get power for Infrared Phototransistors"; Serial.println("Could not get power for Infrared Phototransistors");
} }
digitalWrite(IR_PT_ENABLE,true); digitalWrite(IR_PT_ENABLE,true);
pinMode(IR_PT_ENABLE, OUTPUT); pinMode(IR_PT_ENABLE, OUTPUT);
@ -85,7 +85,7 @@ void LightDetection::beginDaylight(void){
PowerParameters::CurrentConsumptions::CURRENT_PT * 2, PowerParameters::CurrentConsumptions::CURRENT_PT * 2,
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) { LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
ESP_LOGE(TAG,"Could not get power for Daylight Phototransistors"); ESP_LOGE(TAG,"Could not get power for Daylight Phototransistors");
throw "Could not get power for Daylight Phototransistors"; Serial.println("Could not get power for Daylight Phototransistors");
} }
digitalWrite(DL_PT_ENABLE,true); digitalWrite(DL_PT_ENABLE,true);
pinMode(DL_PT_ENABLE, OUTPUT); pinMode(DL_PT_ENABLE, OUTPUT);

View File

@ -11,7 +11,7 @@ void MotionDetection::begin(void){
PowerParameters::CurrentConsumptions::CURRENT_IMU, PowerParameters::CurrentConsumptions::CURRENT_IMU,
IMU_MAX_EXECUTION_DELAY_MS, NULL)) { IMU_MAX_EXECUTION_DELAY_MS, NULL)) {
ESP_LOGE(TAG, "Could not get power for MotionDetection"); ESP_LOGE(TAG, "Could not get power for MotionDetection");
throw "Could not get power for MotionDetection"; Serial.println("Could not get power for MotionDetection");
} }
pinMode(34,OUTPUT); pinMode(34,OUTPUT);
digitalWrite(34,HIGH); digitalWrite(34,HIGH);

View File

@ -9,7 +9,7 @@ void MultiColorLight::begin(void){
Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::LED_RGB_TOP_RIGHT, PowerParameters::CurrentConsumptions::CURRENT_LED_RGB_BASE, MULTI_COLOR_LIGHT_MAX_EXECUTION_DELAY_MS, NULL) && Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::LED_RGB_TOP_RIGHT, PowerParameters::CurrentConsumptions::CURRENT_LED_RGB_BASE, MULTI_COLOR_LIGHT_MAX_EXECUTION_DELAY_MS, NULL) &&
Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::LED_RGB_BOTTOM, PowerParameters::CurrentConsumptions::CURRENT_LED_RGB_BASE, MULTI_COLOR_LIGHT_MAX_EXECUTION_DELAY_MS, NULL) ){ Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::LED_RGB_BOTTOM, PowerParameters::CurrentConsumptions::CURRENT_LED_RGB_BASE, MULTI_COLOR_LIGHT_MAX_EXECUTION_DELAY_MS, NULL) ){
ESP_LOGE(TAG, "Could not get power for MultiColorLight"); ESP_LOGE(TAG, "Could not get power for MultiColorLight");
throw "Could not get power for MultiColorLight"; Serial.println("Could not get power for MultiColorLight");
} }
rgbLeds.begin(); rgbLeds.begin();
this->turnOffLed(); this->turnOffLed();

View File

@ -38,7 +38,7 @@ void Power::begin() {
PowerParameters::PowerConsumers::ESP, PowerParameters::PowerConsumers::ESP,
PowerParameters::CurrentConsumptions::CURRENT_ESP_AVG))) { PowerParameters::CurrentConsumptions::CURRENT_ESP_AVG))) {
ESP_LOGE(TAG, "Could not get power for ESP"); ESP_LOGE(TAG, "Could not get power for ESP");
throw "Could not get power for ESP"; Serial.println("Could not get power for ESP");
} }
} }
} }