Skip to content

Commit

Permalink
feat: Faster brake on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasvr committed Jan 2, 2022
1 parent 44a163a commit 6bfeddc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4256,17 +4256,19 @@ IF MCU_48MHZ == 1
ENDIF

setb IE_EA ; Enable all interrupts
call wait100ms ; Wait for pwm to be stopped
call switch_power_off

; Check if RCP is zero, then it is a normal stop or signal timeout
jb Flag_Rcp_Stop, exit_run_mode_no_stall

clr C ; Otherwise - it's a stall
mov A, Startup_Stall_Cnt
subb A, #4 ; Maximum consecutive stalls
ljc motor_start ; Go back and try starting motors again
jnc exit_run_mode_stall_done

call wait100ms ; Wait for a bit between stall restarts
ljmp motor_start ; Go back and try starting motors again

exit_run_mode_stall_done:
; Stalled too many times
clr IE_EA
call beep_motor_stalled
Expand Down

0 comments on commit 6bfeddc

Please sign in to comment.