@@ -242,9 +242,6 @@ void ControllerWithScheduler::issue_mash_button(
242242 bool log = true ;
243243 while (duration > Milliseconds::zero ()){
244244 issue_buttons (cancellable, button, 8 *8ms, 5 *8ms, 3 *8ms);
245- duration = duration >= 8 *8ms
246- ? duration - 8 *8ms
247- : Milliseconds::zero ();
248245
249246 // We never log before the first issue to avoid delaying the critical path.
250247 // But we do want to log before the mash spam. So we log after the first
@@ -257,6 +254,10 @@ void ControllerWithScheduler::issue_mash_button(
257254 );
258255 }
259256 log = false ;
257+
258+ duration = duration >= 8 *8ms
259+ ? duration - 8 *8ms
260+ : Milliseconds::zero ();
260261 }
261262}
262263void ControllerWithScheduler::issue_mash_button (
@@ -271,7 +272,6 @@ void ControllerWithScheduler::issue_mash_button(
271272 while (duration > Milliseconds::zero ()){
272273 issue_buttons (cancellable, button0, Milliseconds (4 *8 ), 5 *8ms, 3 *8ms);
273274 issue_buttons (cancellable, button1, Milliseconds (4 *8 ), 5 *8ms, 3 *8ms);
274- duration -= std::min (8 *8ms, duration);
275275
276276 // We never log before the first issue to avoid delaying the critical path.
277277 // But we do want to log before the mash spam. So we log after the first
@@ -285,6 +285,8 @@ void ControllerWithScheduler::issue_mash_button(
285285 );
286286 }
287287 log = false ;
288+
289+ duration -= std::min (8 *8ms, duration);
288290 }
289291}
290292void ControllerWithScheduler::issue_mash_AZs (
@@ -301,7 +303,6 @@ void ControllerWithScheduler::issue_mash_AZs(
301303 break ;
302304 }
303305 issue_buttons (cancellable, BUTTON_A, 3 *8ms, 6 *8ms, 3 *8ms);
304- duration -= std::min (3 *8ms, duration);
305306
306307 // We never log before the first issue to avoid delaying the critical path.
307308 // But we do want to log before the mash spam. So we log after the first
@@ -314,6 +315,7 @@ void ControllerWithScheduler::issue_mash_AZs(
314315 }
315316 log = false ;
316317
318+ duration -= std::min (3 *8ms, duration);
317319 if (duration <= Milliseconds::zero ()){
318320 break ;
319321 }
0 commit comments