motor_control: add a little bit of delay between notes

This commit is contained in:
Peter Cai 2021-06-30 20:07:44 +08:00
parent 6ca0fb07ea
commit ac3036011e
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,9 @@ void MotorControl::Init() {
void MotorControl::TickOn(unsigned long period_half_micros) {
tick_ctrl.SetPeriod(period_half_micros);
next_tick_half_micros = tick_ctrl.NextTick();
// 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;
}
void MotorControl::TickAtPitch(unsigned int midi_pitch) {