Skip to content

Commit

Permalink
fix: Discrepancy when calculating wait times during startup
Browse files Browse the repository at this point in the history
In the startup phase Temp4 could have the wrong value
  • Loading branch information
mathiasvr committed Jun 11, 2021
1 parent ca98367 commit fd9864a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1843,16 +1843,14 @@ calc_next_comm_new_period_div_done:
mov Temp4, A
mov Comm_Period4x_L, Temp3 ; Store Comm_Period4x_X
mov Comm_Period4x_H, Temp4
jnc calc_new_wait_times_setup ; If period larger than 0xffff - go to slow case

mov Temp4, #0FFh
mov Comm_Period4x_L, Temp4 ; Set commutation period registers to very slow timing (0xffff)
mov Comm_Period4x_H, Temp4
jnc calc_new_wait_times_setup ; Is period larger than 0xffff?
mov Comm_Period4x_L, #0FFh ; Yes - Set commutation period registers to very slow timing (0xffff)
mov Comm_Period4x_H, #0FFh

calc_new_wait_times_setup:
; Set high rpm flag (if above 156k erpm)
clr C
mov A, Temp4
mov A, Comm_Period4x_H
subb A, #2 ; Is Comm_Period4x_H below 2?
jnc ($+4)
setb Flag_High_Rpm ; Yes - Set high rpm flag
Expand Down

0 comments on commit fd9864a

Please sign in to comment.