Skip to content

Commit

Permalink
Bugfix/bring back bidirectional 3d mode (#105)
Browse files Browse the repository at this point in the history
* Fixed temperature limiting affecting to 3D mode.
* Fixed Pwm_Limit_By_Rpm to match comments concept
  • Loading branch information
damosvil committed Jun 12, 2023
1 parent e449a27 commit 6fbad4e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,11 @@ motor_start:
clr IE_EA ; Disable interrupts
mov Temp2, #Pgm_Startup_Power_Max
mov Pwm_Limit_Beg, @Temp2 ; Set initial pwm limit
mov Pwm_Limit, Pwm_Limit_Beg
mov Pwm_Limit_By_Rpm, Pwm_Limit_Beg
mov Temp_Pwm_Level_Setpoint, Pwm_Limit_Beg

; Set temperature PWM limit and setpoint to the maximum value
mov Pwm_Limit, #255
mov Temp_Pwm_Level_Setpoint, #255

; Begin startup sequence
IF MCU_TYPE == MCU_BB2 or MCU_TYPE == MCU_BB51
Expand Down Expand Up @@ -860,7 +862,7 @@ run6:
jnb Flag_Startup_Phase, initial_run_phase

; Startup phase
mov Pwm_Limit, Pwm_Limit_Beg ; Set initial max power
mov Pwm_Limit_By_Rpm, Pwm_Limit_Beg; Set initial max power
clr C
mov A, Startup_Cnt ; Load startup counter
subb A, #24 ; Is counter above requirement?
Expand All @@ -872,9 +874,7 @@ run6:
startup_phase_done:
; Clear startup phase flag & remove pwm limits
clr Flag_Startup_Phase
mov Pwm_Limit, #255 ; Reset temperature level pwm limit
mov Pwm_Limit_By_Rpm, #255
mov Temp_Pwm_Level_Setpoint, #255 ; Reset temperature level setpoint

initial_run_phase:
; If it is a direction change - branch
Expand Down Expand Up @@ -946,11 +946,11 @@ run6_bidir_check_reversal:
run6_bidir_reversal:
; Initiate direction and start braking
setb Flag_Dir_Change_Brake ; Set brake flag
mov Pwm_Limit, Pwm_Limit_Beg ; Set max power while braking to initial power limit
mov Pwm_Limit_By_Rpm, Pwm_Limit_Beg; Set max power while braking to initial power limit
jmp run4 ; Go back to run 4,thereby changing force direction

run6_bidir_braking:
mov Pwm_Limit, Pwm_Limit_Beg ; Set max power while braking to initial power limit
mov Pwm_Limit_By_Rpm, Pwm_Limit_Beg; Set max power while braking to initial power limit

clr C
mov A, Comm_Period4x_H ; Is Comm_Period4x below minimum speed?
Expand All @@ -963,7 +963,6 @@ run6_bidir_braking:
mov Flag_Motor_Dir_Rev, C ; Set spinning direction
setb Flag_Initial_Run_Phase
mov Initial_Run_Rot_Cntd, #18
mov Pwm_Limit, Pwm_Limit_Beg ; Set initial max power

run6_bidir_continue:
jmp run1 ; Go back to run 1
Expand Down

0 comments on commit 6fbad4e

Please sign in to comment.