diff --git a/tgy.asm b/tgy.asm index d4b594b..17e147a 100644 --- a/tgy.asm +++ b/tgy.asm @@ -153,7 +153,10 @@ .equ DEAD_TIME_HIGH = DEAD_HIGH_NS * CPU_MHZ / 1000 .if !defined(MOTOR_ADVANCE) -.equ MOTOR_ADVANCE = 18 ; Degrees of timing advance (0 - 30, 30 meaning no delay) +.equ MOTOR_ADVANCE = 12 ; Degrees of timing advance (0 - 30, 30 meaning no delay) +.endif +.if !defined(TIMING_OFFSET) +.equ TIMING_OFFSET = 24 ; Degrees of timing offset in microseconds (max 4096µs) .endif .equ MOTOR_BRAKE = 0 ; Enable brake during neutral/idle ("motor drag" brake) .equ LOW_BRAKE = 0 ; Enable brake on very short RC pulse ("thumb" brake like on Airtronics XL2P) @@ -2195,6 +2198,10 @@ update_timing4: movw timing_duty_l, XL ldi temp4, (30 - MOTOR_ADVANCE) * 256 / 60 rcall update_timing_add_degrees +.if TIMING_OFFSET + adiwx YL, YH, TIMING_OFFSET * CPU_MHZ + adc temp7, ZH +.endif sts com_time_l, YL ; Store start of next commutation sts com_time_h, YH sts com_time_x, temp7