Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/bring back bidirectional 3d mode #105

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,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 a
stylesuxx marked this conversation as resolved.
Show resolved Hide resolved
mov Pwm_Limit, #255
mov Temp_Pwm_Level_Setpoint, #255

; Begin startup sequence
IF MCU_TYPE >= 1
Expand Down Expand Up @@ -869,7 +871,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 @@ -881,9 +883,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 @@ -955,11 +955,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 @@ -972,7 +972,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