From fb036e3a2b963b935339dd59fc6973716474fb0d Mon Sep 17 00:00:00 2001 From: Mathias Rasmussen Date: Sun, 24 Jan 2021 11:50:44 +0100 Subject: [PATCH] refactor: Clean up dithering code --- Bluejay.asm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Bluejay.asm b/Bluejay.asm index 489514e..23756bd 100644 --- a/Bluejay.asm +++ b/Bluejay.asm @@ -896,26 +896,23 @@ IF PWM_BITS_H < 3 rl A ; Rotate pattern mov @Temp1, A ; Store pattern - jnb ACC.0, dithering_done + jnb ACC.0, t1_int_set_pwm ; Increment if bit is set mov A, Temp2 add A, #1 mov Temp2, A + jnz t1_int_set_pwm IF PWM_BITS_H != 0 mov A, Temp3 addc A, #0 mov Temp3, A - jnb ACC.PWM_BITS_H, dithering_done - dec Temp2 - dec Temp3 -ELSE - jnz dithering_done - dec Temp2 + jnb ACC.PWM_BITS_H, t1_int_set_pwm + dec Temp3 ; Reset on overflow ENDIF - -dithering_done: + dec Temp2 ENDIF +t1_int_set_pwm: ; Set pwm registers IF FETON_DELAY != 0 clr C