Skip to content

Commit d89fa26

Browse files
committed
added the error debugging
1 parent 0b367c3 commit d89fa26

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ void* _configureADCInline(const void* driver_params, const int pinA, const int p
8484
if(_isset(params->pins[i])){
8585
pinMode(params->pins[i], ANALOG);
8686
if(!adcInit(params->pins[i])) {
87-
SIMPLEFOC_ESP32_CS_DEBUG("Failed to initialise ADC pin: "+String(params->pins[i]) + String(", maybe not an ADC pin?"));
87+
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Failed to initialise ADC pin: "+String(params->pins[i]) + String(", maybe not an ADC pin?"));
8888
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
8989
}
9090
}
9191
}
92-
92+
9393
return params;
9494
}
9595

@@ -109,6 +109,7 @@ float _readADCVoltageLowSide(const int pin, const void* cs_params){
109109
return p->adc_buffer[no_channel] * p->adc_voltage_conv;
110110
else no_channel++;
111111
}
112+
SIMPLEFOC_DEBUG("ERROR: ADC pin not found in the buffer!");
112113
// not found
113114
return 0;
114115
}
@@ -126,7 +127,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
126127
// check if low side callback is already set
127128
// if it is, return error
128129
if(t->on_full != nullptr){
129-
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));
130+
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));
130131
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
131132
}
132133

@@ -140,7 +141,7 @@ void* _configureADCLowSide(const void* driver_params, const int pinA,const int p
140141
for (int i = 0; i < 3; i++){
141142
if(_isset(adc_pins[i])){
142143
if(!adcInit(adc_pins[i])){
143-
SIMPLEFOC_ESP32_CS_DEBUG("Failed to initialise ADC pin: "+String(adc_pins[i]) + String(", maybe not an ADC pin?"));
144+
SIMPLEFOC_ESP32_CS_DEBUG("ERROR: Failed to initialise ADC pin: "+String(adc_pins[i]) + String(", maybe not an ADC pin?"));
144145
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
145146
}
146147
params->pins[no_adc_channels++] = adc_pins[i];
@@ -165,7 +166,7 @@ void* _driverSyncLowSide(void* driver_params, void* cs_params){
165166
// check if low side callback is already set
166167
// if it is, return error
167168
if(t->on_full != nullptr){
168-
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));
169+
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));
169170
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
170171
}
171172

0 commit comments

Comments
 (0)