From a23e3a12cf8388f6b6e598452fc221f1170f6758 Mon Sep 17 00:00:00 2001 From: Mathias Rasmussen Date: Thu, 24 Dec 2020 00:21:00 +0100 Subject: [PATCH] fix: Rework startup boost, increase max number of stalls --- Bluejay.asm | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Bluejay.asm b/Bluejay.asm index a4e7a50..bcd3052 100644 --- a/Bluejay.asm +++ b/Bluejay.asm @@ -720,28 +720,31 @@ t1_int_not_bidir: jb Flag_MOTOR_STARTED, t1_int_startup_boosted ; Do not boost when changing direction in bidirectional mode - mov A, Temp5 - jnz t1_int_startup_boost_stall - mov A, Pwm_Limit_Beg ; Set 25% of max startup power as minimum power - rlc A - mov B, A - clr C - subb A, Temp4 - jc t1_int_startup_boost_stall + ; Add an extra power boost during start + mov Temp6, Stall_Cnt - mov Temp4, B + inc Temp6 + mov B, #31 t1_int_startup_boost_stall: - mov A, Stall_Cnt ; Add an extra power boost during start - swap A - rlc A - add A, Temp4 + mov A, Temp4 + add A, B mov Temp4, A mov A, Temp5 addc A, #0 mov Temp5, A + mov A, B + rl A ; Add more boost when stalling + mov B, A + + djnz Temp6, t1_int_startup_boost_stall + + jnb ACC.3, ($+7) + mov Temp4, #0FFh ; Set maximum 11-bit value + mov Temp5, #07h + t1_int_startup_boosted: ; Set 8-bit value mov A, Temp4 @@ -3833,7 +3836,7 @@ ENDIF run_to_wait_for_power_on_brake_done: clr C mov A, Stall_Cnt - subb A, #4 ; Maximum consecutive stalls before stopping + subb A, #10 ; Maximum consecutive stalls before stopping jc ($+5) ljmp init_no_signal ; Stalled too many times