File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -621,16 +621,19 @@ void FIQ_PWMPeriod()
621
621
}
622
622
}
623
623
624
- // ホール素子は高速域では信頼できない
624
+ hall_pos = hall_pos % ENC0_BUF_MAX ;
625
+
626
+ // Rely hall signal only if the velocity is under the threshold.
627
+ // Force using all measurement result if it is first time of measurement.
625
628
if (_abs (motor [i ].vel1 ) > motor_param [i ].vel_rely_hall &&
626
- !saved_param .rely_hall )
629
+ !saved_param .rely_hall &&
630
+ motor [i ].enc0_buf [hall_pos ] != ENC0_BUF_UNKNOWN )
627
631
continue ;
628
632
629
633
// Compensate hall signal delay
630
634
enc0 -= motor [i ].vel1 * motor_param [i ].hall_delay_factor / 32768 ;
631
635
632
636
// Fill enc0_buf and calculate average
633
- hall_pos = hall_pos % ENC0_BUF_MAX ;
634
637
motor [i ].enc0_buf [hall_pos ] = enc0 ;
635
638
motor [i ].enc0_buf_updated = 1 ;
636
639
}
You can’t perform that action at this time.
0 commit comments