Skip to content

Commit

Permalink
feat: Smoother DShot throttle scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasvr committed Jan 15, 2021
1 parent 17f08f1 commit 2268e16
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Bluejay.asm
Expand Up @@ -733,19 +733,20 @@ t1_int_bidir_rev_chk:
rlca Temp5

t1_int_not_bidir:
; Generate 4/256
mov A, Temp5
add A, Temp5
addc A, Temp5
addc A, Temp5
mov A, Temp4 ; Divide by 16 (12 to 8-bit)
anl A, #0F0h
orl A, Temp5 ; Note: Assumes Temp5 to be 4-bit
swap A
mov B, #5 ; Divide by 5 (80 in total)
div AB
mov Temp3, A
; Align to 11 bits
clr C
;clr C ; Note: Cleared by div
rrca Temp5
rrca Temp4
; Scale from 2000 to 2048
mov A, Temp4
add A, Temp3 ; Holds 4/128
rrc A
; Scale from 2000 to 2048
add A, Temp3
mov Temp4, A
mov A, Temp5
addc A, #0
Expand Down

0 comments on commit 2268e16

Please sign in to comment.