Skip to content

Commit

Permalink
refactor: Only exit run mode early when using brake on stop
Browse files Browse the repository at this point in the history
Otherwise we wait until speed is low or comparator times out
  • Loading branch information
mathiasvr committed Sep 1, 2021
1 parent 77f0178 commit 9606623
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4094,19 +4094,18 @@ initial_run_phase_done:
; Exit run loop after a given time
jb Flag_Pgm_Bidir, run6_check_timeout ; Check if bidirectional operation

mov Temp1, #250
mov Temp2, #Pgm_Brake_On_Stop
mov Temp2, #Pgm_Brake_On_Stop ; Check if using brake on stop
mov A, @Temp2
jz ($+4)

mov Temp1, #3 ; About 100ms before stopping when brake is set
jz run6_check_timeout

; Exit run loop after 100ms when using brake on stop
clr C
mov A, Rcp_Stop_Cnt ; Load stop RC pulse counter low byte value
subb A, Temp1 ; Is number of stop RC pulses above limit?
mov A, Rcp_Stop_Cnt ; Load stop RC pulse counter value
subb A, #3 ; Is number of stop RC pulses above limit?
jnc run_to_wait_for_start ; Yes, go back to wait for power on

run6_check_timeout:
; Exit run loop immediately if timeout
mov A, Rcp_Timeout_Cntd ; Load RC pulse timeout counter value
jz run_to_wait_for_start ; If it is zero - go back to wait for power on

Expand Down

0 comments on commit 9606623

Please sign in to comment.