motor_control: tweak the between-notes delay

Also, we need unsigned long to avoid overflowing
This commit is contained in:
Peter Cai 2021-06-30 20:22:29 +08:00
parent ac3036011e
commit c33009867f
1 changed files with 3 additions and 3 deletions

View File

@ -61,9 +61,9 @@ void MotorControl::Init() {
void MotorControl::TickOn(unsigned long period_half_micros) {
tick_ctrl.SetPeriod(period_half_micros);
// Delay every note for 20 ms to add a bit of gap (attack) between notes
// 20 ms should be short enough (you need > 350 bpm for 1/32 notes to be 20ms long)
next_tick_half_micros = tick_ctrl.NextTick() + 20 * 1000 * 2;
// Delay every note for 5 ms to add a bit of gap (attack) between notes
// 5 ms should be short enough (you need > 700 bpm for 1/64 notes to be 5ms long)
next_tick_half_micros = tick_ctrl.NextTick() + (unsigned long) 5 * 1000 * 2;
}
void MotorControl::TickAtPitch(unsigned int midi_pitch) {