diff --git a/mcpwm.c b/mcpwm.c index 7a254df7..a3954d40 100644 --- a/mcpwm.c +++ b/mcpwm.c @@ -638,7 +638,7 @@ float mcpwm_get_tot_current(void) { } float mcpwm_get_tot_current_in(void) { - return mcpwm_get_tot_current() * dutycycle_now; + return mcpwm_get_tot_current() * fabsf(dutycycle_now); } int mcpwm_get_tachometer_value(int reset) {