Skip to content

Commit

Permalink
added the error debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
askuric committed Jun 21, 2024
1 parent 0b367c3 commit d89fa26
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ void* _configureADCInline(const void* driver_params, const int pinA, const int p
if(_isset(params->pins[i])){
pinMode(params->pins[i], ANALOG);
if(!adcInit(params->pins[i])) {
SIMPLEFOC_ESP32_CS_DEBUG("Failed to initialise ADC pin: "+String(params->pins[i]) + String(", maybe not an ADC pin?"));
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Failed to initialise ADC pin: "+String(params->pins[i]) + String(", maybe not an ADC pin?"));
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
}
}
}

return params;
}

Expand All @@ -109,6 +109,7 @@ float _readADCVoltageLowSide(const int pin, const void* cs_params){
return p->adc_buffer[no_channel] * p->adc_voltage_conv;
else no_channel++;
}
SIMPLEFOC_DEBUG("ERROR: ADC pin not found in the buffer!");
// not found
return 0;
}
Expand All @@ -126,7 +127,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
// check if low side callback is already set
// if it is, return error
if(t->on_full != nullptr){
SIMPLEFOC_ESP32_CS_DEBUG("Low side callback is already set. Cannot set it again for timer: "+String(t->timer_id)+", group: "+String(t->group->group_id));
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Low side callback is already set. Cannot set it again for timer: "+String(t->timer_id)+", group: "+String(t->group->group_id));
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
}

Expand All @@ -140,7 +141,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
for (int i = 0; i < 3; i++){
if(_isset(adc_pins[i])){
if(!adcInit(adc_pins[i])){
SIMPLEFOC_ESP32_CS_DEBUG("Failed to initialise ADC pin: "+String(adc_pins[i]) + String(", maybe not an ADC pin?"));
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Failed to initialise ADC pin: "+String(adc_pins[i]) + String(", maybe not an ADC pin?"));
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
}
params->pins[no_adc_channels++] = adc_pins[i];
Expand All @@ -165,7 +166,7 @@ void* _driverSyncLowSide(void* driver_params, void* cs_params){
// check if low side callback is already set
// if it is, return error
if(t->on_full != nullptr){
SIMPLEFOC_ESP32_CS_DEBUG("Low side callback is already set. Cannot set it again for timer: "+String(t->timer_id)+", group: "+String(t->group->group_id));
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Low side callback is already set. Cannot set it again for timer: "+String(t->timer_id)+", group: "+String(t->group->group_id));
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
}

Expand Down

0 comments on commit d89fa26

Please sign in to comment.