Skip to content

Commit

Permalink
perf: Optimize comp read jumps
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasvr committed Oct 21, 2020
1 parent 3aaaf36 commit 703d70a
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,18 @@ comp_check_timeout_not_timed_out:
Read_Comp_Out ; Read comparator output
anl A, #40h
cjne A, Bit_Access, comp_read_wrong
sjmp comp_read_ok

; Comp read ok
mov A, Startup_Cnt ; Force a timeout for the first commutation
jz wait_for_comp_out_start

jb Flags0.DEMAG_DETECTED, wait_for_comp_out_start ; Do not accept correct comparator output if it is demag

djnz Temp1, comp_check_timeout ; Decrement readings counter - repeat comparator reading if not zero

clr Flags0.COMP_TIMED_OUT

sjmp setup_comm_wait

comp_read_wrong:
jnb Flags1.STARTUP_PHASE, comp_read_wrong_not_startup
Expand Down Expand Up @@ -2391,22 +2402,6 @@ comp_read_wrong_load_timeout:
mov TMR3H, A
sjmp comp_read_wrong_timeout_set

comp_read_ok:
mov A, Startup_Cnt ; Force a timeout for the first commutation
jnz ($+4)
ajmp wait_for_comp_out_start

jnb Flags0.DEMAG_DETECTED, ($+5) ; Do not accept correct comparator output if it is demag
ajmp wait_for_comp_out_start

djnz Temp1, comp_read_ok_jmp ; Decrement readings counter - repeat comparator reading if not zero
sjmp ($+4)

comp_read_ok_jmp:
sjmp comp_check_timeout

clr Flags0.COMP_TIMED_OUT


;**** **** **** **** **** **** **** **** **** **** **** **** ****
;
Expand Down

0 comments on commit 703d70a

Please sign in to comment.