Skip to content

Commit 23f57b6

Browse files
committed
todo comment
1 parent 9d16ec5 commit 23f57b6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ void* IRAM_ATTR _driverSyncLowSide(void* driver_params, void* cs_params){
186186
// if comparator creation failed, fall back to on_full callback
187187
if (cs->pretrig_comparator){
188188
// Calculate pwm duty cycle ticks for pre-trigger channel
189-
uint32_t pwm_duty_cycle = p->mcpwm_period * (0.75 - ((float)p->pwm_frequency*SIMPLEFOC_CS_PRETRIGGER_US)/1e6/2.0);
189+
// TODO: verify the timing it seems to be correct between 15 and 20kHz (but needs better testing)
190+
uint32_t pwm_duty_cycle = p->mcpwm_period * (0.75 - ((float)p->pwm_frequency*SIMPLEFOC_CS_PRETRIGGER_US)/1e6/2.0);
190191
// set up the comparator duty cycle
191192
CHECK_CS_ERR(mcpwm_comparator_set_compare_value((mcpwm_cmpr_handle_t)cs->pretrig_comparator, pwm_duty_cycle),
192193
"Failed to set pretrigger compare value");

0 commit comments

Comments
 (0)