Describe the bug
In SimpleFOC 2.4.0, the ESP32 MCPWM current-sense callbacks return true in three places.
In ESP-IDF, the callback return value indicates whether a higher-priority task was woken and whether a context switch may be required after the ISR.
These callbacks only sample ADC data and update internal buffers; they do not appear to wake any FreeRTOS task. Therefore these returns should be false.
Proposed change
diff --git a/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp b/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp
--- a/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp
+++ b/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp
@@ -112,7 +112,7 @@
#ifdef SIMPLEFOC_ESP32_USE_ADC_DEBUG
gpio_set_level((gpio_num_t)debug_pin, 0);
#endif
- return true;
+ return false;
}
@@ -120,7 +120,7 @@
if(edata->direction != MCPWM_TIMER_DIRECTION_UP){
- return true;
+ return false;
}
@@ -140,7 +140,7 @@
#ifdef SIMPLEFOC_ESP32_USE_ADC_DEBUG
gpio_set_level((gpio_num_t)debug_pin, 0);
#endif
- return true;
+ return false;
}
This should not change ADC sampling behavior; it only avoids reporting an unnecessary ISR task wakeup/yield.
Hardware
- ESP32-S3
- DRV8353
- 3-phase BLDC
- Sensorless FOC
- Low-side current sensing
- PlatformIO
- SimpleFOC 2.4.0
Sources
Describe the bug
In SimpleFOC 2.4.0, the ESP32 MCPWM current-sense callbacks return
truein three places.In ESP-IDF, the callback return value indicates whether a higher-priority task was woken and whether a context switch may be required after the ISR.
These callbacks only sample ADC data and update internal buffers; they do not appear to wake any FreeRTOS task. Therefore these returns should be
false.Proposed change
This should not change ADC sampling behavior; it only avoids reporting an unnecessary ISR task wakeup/yield.
Hardware
Sources