mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 02:51:47 +02:00
Safeguard serial error prints
This commit is contained in:
parent
b410338109
commit
a48dd7c9dd
@ -81,8 +81,10 @@ void Communication::begin(void) {
|
||||
PowerParameters::CurrentConsumptions::CURRENT_WIFI_BASE,
|
||||
MESH_MAX_EXECUTION_DELAY_MS, NULL)) {
|
||||
ESP_LOGE(TAG, "Failed to get power for mesh initialization");
|
||||
if(Serial) {
|
||||
Serial.println("Failed to get power for mesh initialization");
|
||||
}
|
||||
}
|
||||
mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
|
||||
mesh.onReceive(&receivedCallback);
|
||||
mesh.onNewConnection(&newConnectionCallback);
|
||||
|
@ -18,8 +18,10 @@ void Display::begin(void){
|
||||
PowerParameters::PowerConsumers::DISPLAY_OLED, PowerParameters::CurrentConsumptions::CURRENT_DISPLAY
|
||||
,DISPLAY_MAX_EXECUTION_DELAY_MS, NULL)){
|
||||
ESP_LOGE(TAG,"Could not get power for Display");
|
||||
if (Serial) {
|
||||
Serial.println("Could not get power for Display");
|
||||
}
|
||||
}
|
||||
//set Mux Ratio
|
||||
sendDisplayCMD(muxRatio);
|
||||
sendDisplayCMD(0x3f);
|
||||
|
@ -69,7 +69,10 @@ void LightDetection::beginInfrared(void){
|
||||
PowerParameters::CurrentConsumptions::CURRENT_PT * 4,
|
||||
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
|
||||
ESP_LOGE(TAG,"Could not get power for Infrared Phototransistors");
|
||||
Serial.println("Could not get power for Infrared Phototransistors");
|
||||
if(Serial){
|
||||
Serial.println(
|
||||
"Could not get power for Infrared Phototransistors");
|
||||
}
|
||||
}
|
||||
digitalWrite(IR_PT_ENABLE,true);
|
||||
pinMode(IR_PT_ENABLE, OUTPUT);
|
||||
@ -85,7 +88,10 @@ void LightDetection::beginDaylight(void){
|
||||
PowerParameters::CurrentConsumptions::CURRENT_PT * 2,
|
||||
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)) {
|
||||
ESP_LOGE(TAG,"Could not get power for Daylight Phototransistors");
|
||||
Serial.println("Could not get power for Daylight Phototransistors");
|
||||
if(Serial){
|
||||
Serial.println(
|
||||
"Could not get power for Daylight Phototransistors");
|
||||
}
|
||||
}
|
||||
digitalWrite(DL_PT_ENABLE,true);
|
||||
pinMode(DL_PT_ENABLE, OUTPUT);
|
||||
|
@ -32,7 +32,9 @@ void Motion::moveTask(void * args) {
|
||||
uint32_t runtime = (uint32_t)args;
|
||||
|
||||
if (!Motion::left.setSpeed(LEFT_MOTOR_DUTY) || !Motion::right.setSpeed(RIGHT_MOTOR_DUTY)) {
|
||||
Serial.println("ailed to start motors due to power constraints");
|
||||
if(Serial){
|
||||
Serial.println("Failed to start motors due to power constraints");
|
||||
}
|
||||
Motion::stop(); // Use to clean up
|
||||
return;
|
||||
}
|
||||
@ -123,7 +125,9 @@ void Motion::leftMotorTask(void * args) {
|
||||
}
|
||||
Motion::right.setSpeed(0);
|
||||
if(!Motion::left.setSpeed(LEFT_MOTOR_DUTY)){
|
||||
if(Serial){
|
||||
Serial.println("Can not rotate Clockwise due to power constraints");
|
||||
}
|
||||
Motion::stop();
|
||||
return;
|
||||
}
|
||||
@ -166,7 +170,10 @@ void Motion::rightMotorTask(void * args) {
|
||||
xClockwiseTaskHandle = NULL;
|
||||
}
|
||||
if(!Motion::left.setSpeed(RIGHT_MOTOR_DUTY)){
|
||||
Serial.println("Can not rotate Antilockwise due to power constraints");
|
||||
if(Serial){
|
||||
Serial.println(
|
||||
"Can not rotate Antilcockwise due to power constraints");
|
||||
}
|
||||
Motion::stop();
|
||||
return;
|
||||
}
|
||||
|
@ -11,8 +11,10 @@ void MotionDetection::begin(void){
|
||||
PowerParameters::CurrentConsumptions::CURRENT_IMU,
|
||||
IMU_MAX_EXECUTION_DELAY_MS, NULL)) {
|
||||
ESP_LOGE(TAG, "Could not get power for MotionDetection");
|
||||
if(Serial){
|
||||
Serial.println("Could not get power for MotionDetection");
|
||||
}
|
||||
}
|
||||
pinMode(34,OUTPUT);
|
||||
digitalWrite(34,HIGH);
|
||||
handler->begin(36,37,35,34);
|
||||
|
@ -19,8 +19,10 @@ void MultiColorLight::begin(void) {
|
||||
PowerParameters::CurrentConsumptions::CURRENT_LED_RGB_BASE,
|
||||
MULTI_COLOR_LIGHT_MAX_EXECUTION_DELAY_MS, NULL)) {
|
||||
ESP_LOGE(TAG, "Could not get power for MultiColorLight");
|
||||
if(Serial){
|
||||
Serial.println("Could not get power for MultiColorLight");
|
||||
}
|
||||
}
|
||||
rgbLeds.begin();
|
||||
this->turnOffLed();
|
||||
};
|
||||
|
@ -137,7 +137,7 @@ bool PowerScheduler::waitForCurrentAllowance(
|
||||
.requestedAt = initialTickCount,
|
||||
.grantedAt = xTaskGetTickCount(),
|
||||
.granted = true});
|
||||
ESP_LOGV(TAG, "%d mA granted to consumer %d after %d ms",
|
||||
ESP_LOGI(TAG, "%d mA granted to consumer %d with a delay of %d ms",
|
||||
neededCurrent, static_cast<int>(consumer),
|
||||
xTaskGetTickCount() - initialTickCount);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user