Skip to content

Commit

Permalink
Use pwm_reset() instead of turn_pwm_off().
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Feb 25, 2022
1 parent 15f503f commit d17de95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions firmware/src/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ inline void set_state_initializing(void)
*/
inline void set_state_contactor(void)
{
pwm_reset();
state_contactor = STATE_CONTACTOR_WAITING_MOTOR;
state_machine = STATE_CONTACTOR;
}
Expand All @@ -171,6 +172,7 @@ inline void set_state_contactor(void)
*/
inline void set_state_idle(void)
{
pwm_reset();
state_machine = STATE_IDLE;
}

Expand Down Expand Up @@ -259,8 +261,7 @@ inline void print_control(void)
inline void task_initializing(void)
{
set_led();
set_pwm_off();
pwm_fault_count = 0;
pwm_reset();

//check_buffers();
//check_idle_current();
Expand Down Expand Up @@ -289,7 +290,6 @@ inline void task_initializing(void)
inline void task_change_contactor(void)
{
check_reverse();
set_pwm_off();

if(led_clk_div++ >= 100){
cpl_led();
Expand Down Expand Up @@ -387,7 +387,6 @@ inline void task_running(void)
if(system_flags.motor_on && system_flags.dms){
pwm_compute();
}else{
pwm_reset();
set_state_idle();
}

Expand Down
1 change: 1 addition & 0 deletions firmware/src/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void pwm_init()
inline void pwm_reset(void)
{
set_pwm_off();
pwm_fault_count = 0;
control.D_raw = control.D_raw_target = control.D = 0;
control.I_raw = control.I_raw_target = control.I = 0;
VERBOSE_MSG_PWM(usart_send_string("PWM turned off!\n"));
Expand Down

0 comments on commit d17de95

Please sign in to comment.