O_C
O_C copied to clipboard
Trigger long-press as soon as the button is held long enough, instead…
… of at release
Hopefully this doesn't have any side effects I haven't thought of. I don't know the codebase well enough to say for sure.
Line 85 is to stop the button being flagged to ignore by Ui::AppSettings(). Kinda hacky.
The +7 in line 89 is compensation for the 7-bit button debouncing.
I haven't looked at the pull request code, but functionally, is this an improvement. By actioning the long-press when the button is released, the action can be triggered at a precise moment (eg on-the-beat), whereas triggering after minimum long-press time has elapsed makes it very hard to manually synchronise the action with other events.
Off the top of my head I suspect this might break at least one thing, the hold + turn in the scale editor. I vaguely remember thinking about handling all button presses this way when the UI code was re-written, but suspect I didn't to maintain existing behaviours (or some other forgotten reason).
So looking at the source seems to confirm that generating the long-press this way would conflict with the scale editor: The L long press is used, and also there's a case where you hold L pressed and turn R where the long press (at release) gets ignored. It might still work if you manage to turn R within kLongPressTicks
but that seems a bit too fiddly... Not sure if there's a way to resolve that, at least nothing comes to mind spontaneously.