Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spams buttons when swapping to a Keyboard mode on a Pico #21

Open
UMS-Ultra opened this issue Sep 3, 2022 · 3 comments
Open

Spams buttons when swapping to a Keyboard mode on a Pico #21

UMS-Ultra opened this issue Sep 3, 2022 · 3 comments

Comments

@UMS-Ultra
Copy link

When inputting the button combination for a Keyboard mode on a Pico, the device will rapidly spam those same 3 keys for maybe a second. For example, when inputing the Default Keyboard mode, it will spit out A, F, and H repeatedly in a long sequence. The sequence is variable, and appears to be related to how long all 3 buttons where held down after the button combination was inputed.

@JonnyHaystack
Copy link
Owner

This is known, it is caused by the keyboard mode being rapidly constructed/destructed many times very quickly

@ribbanya
Copy link
Contributor

Would something like this fix the issue? I wrote this for Smash Box rocker toggles but it also ensures that you can't switch to the current mode.

void select_mode(CommunicationBackend *backend, uint8_t new_mode_id) {
if (current_mode_id == new_mode_id)
return;
switch (new_mode_id) {
case 1:
set_mode(backend, new MeleePeach20Button(socd::SOCD_2IP_NO_REAC));
break;
case 2:
set_mode(backend, new MeleePuff20Button(socd::SOCD_2IP_NO_REAC));
break;
case 3:
set_mode(backend, new MeleeYoshi20Button(socd::SOCD_2IP_NO_REAC));
break;
case 4:
set_mode(backend, new MeleeMarth20Button(socd::SOCD_2IP));
break;
case 5:
set_mode(backend, new Melee20Button(socd::SOCD_2IP_NO_REAC));
break;
case 6:
set_mode(backend, new FgcMode(socd::SOCD_NEUTRAL));
break;
default:
return;
}
current_mode_id = new_mode_id;
}

@JonnyHaystack
Copy link
Owner

Yeah, it makes it significantly more complicated for the average user to edit the mode bindings though, which I'd prefer to avoid. I feel like the real problem is just the way keyboard modes themselves exist in the current architecture. It doesn't really fit in well. Especially considering they don't even work with XInputBackend which is the default on Pico now, so you need to hold a button on plugin as well. Gonna have to redesign it at some point.

JonnyHaystack added a commit that referenced this issue Oct 21, 2023
Track index of current game mode config to prevent switching from one
GameModeConfig to the same GameModeConfig, which in turn prevents
spamming of keypresses when entering a keyboard mode on RP2040.

Closes #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants