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

[Zero Delay Encoder] Button mapping(detected&working) #15

Closed
Vegz78 opened this issue Jun 29, 2021 · 9 comments
Closed

[Zero Delay Encoder] Button mapping(detected&working) #15

Vegz78 opened this issue Jun 29, 2021 · 9 comments
Labels
Controller Controller related issue help wanted Extra attention is needed

Comments

@Vegz78
Copy link
Owner

Vegz78 commented Jun 29, 2021

I have now changed to this encoder https://www.electrokit.com/uploads/productfile/41017/SBC-ZDE-Datasheet.pdf, because it's the one the kids will have (I'll revert to the SJ@JX later). Could you point me to tha latest issue on this encoder, if there is anyone else who have tryed it? It would be really helpful. I have worked out the following so far:

Dragonrise inc generic USB joystick on event 4

Button 1 (K1) = TRIGGER
Button 2 (K2) = BTN THUMB = A
Button 3 (K3) = BTN THUMB2 = B
Button 4 (K4) = BTN TOP
Button 5 (L2) = BTN TOP 2
Button 6 (R2) = BTN PINKIE
Button 7 (L1) = BTN BASE
Button 8 (R1) = BTN BASE 2
Button 9 (SE) = BTN BASE 3
Button 10 (ST) = BTN BASE 4
Button 11 (K11) = BTN BASE 5
Button 12 (K12) = BTN BASE 6

I get A and B and the joystick to work, but the rest seem to work sometimes and sometimes not, and I randomly can't exit. It also seems like the B button (which acts like the B button in the game, also can select, hm...

Originally posted by @sofiania in #10 (comment)

@Vegz78
Copy link
Owner Author

Vegz78 commented Jun 29, 2021

Deleted the last comment. It does seem to work with both retropie and makecode games now!!! It seems that many of my "unstable" problems occurs when I am to fast for the system... If I press Button 10 (ST) = BTN BASE 4 it does exit, but the screen goes black for a while first. Still some strange things, like button B seems to be select plus the B-button. And Button 10 - exit also opens the manue if I exit from Makecode (the list of makecode games)

This is my present configuration:

Button 2 (K2) = BTN THUMB = A
Button 3 (K3) = BTN THUMB2 = B (+ Select)
Button 9 (SE) = BTN BASE 3 = RETURN
Button 10 (ST) = BTN BASE 4 = EXIT

Originally posted by @sofiania in #10 (comment)

@Vegz78
Copy link
Owner Author

Vegz78 commented Jun 29, 2021

Try using evtest /dev/input/eventX | grep "(type 1)" and see what pressing each of the buttons shows. Specifically, press B, then press select, and see what shows up. If they have the same button name, there might be a problem with the encoder. Maybe try plugging the select button into a different port on the encoder if another is available, and seeing if it fixes the issue.

Edit: close quote

Originally posted by @SuperPupperDoggo in #10 (comment)

@Vegz78
Copy link
Owner Author

Vegz78 commented Jun 29, 2021

This is B and select:
20210628_191543
Uploading 20210628_191518.jpg…

Originally posted by @sofiania in #10 (comment)

@Vegz78
Copy link
Owner Author

Vegz78 commented Jun 29, 2021

It does seem to work with both retropie and makecode games now!!!

I am really happy to hear that it is starting to work for you now, @sofiania! ;-)

If I press Button 10 (ST) = BTN BASE 4 it does exit, but the screen goes black for a while first.

The black screen for a little while on exit is expected, since McAirpos uses a little time to make sure and double check that every MakeCode game process is killed and not respawned, and then clear and hand back control of the framebuffer, to prevent the system from appearing frozen with the last image loaded into the framebuffer, zombie processes etc. This time differs according to how fast your system is, since the "time" to wait actually is enough numbers of CPU cycles to be sure all processes are killed, and not actual SI unit time IRL...
=> RPi Zero and 3A slow, 3B and 4 etc. much faster...
(I never had Zero and 3A in mind or available when I battled with the freeze problem, so maybe you could optimize the while-loop counter in launCharc.c and compile for your system. Then again, a higher number of freezes/reboots is normally felt like a much worse experience than a little longer waiting time, in that tradeoff.)

This is my present configuration:

Button 2 (K2) = BTN THUMB = A
Button 3 (K3) = BTN THUMB2 = B (+ Select)
Button 9 (SE) = BTN BASE 3 = RETURN
Button 10 (ST) = BTN BASE 4 = EXIT

Still some strange things, like button B seems to be select plus the B-button.

image

(Thanks for your helpe here, @SuperPupperDoggo!)

The most important step, from my 4-point list in my last reply above, and like @SuperPupperDoggo just mentioned and @QuadDam has described in his writeup above, for DIY Arcade controller, is to:
1-2. Physically (re-)wire the real button with its intended function(e.g. Exit) so that evtest outputs one of the codes in the rightmost column of the same row as this function in the controller mapping table

Kindly see the newly updated controller section in the README:
https://github.com/Vegz78/McAirpos#ev_abs-controller

It seems that many of my "unstable" problems occurs when I am to fast for the system...

You might experience the auto calibration routine at work, and, when you get all buttons working as intended, it might be possible to optimize uinput-mapper a little:
https://github.com/Vegz78/McAirpos#optimizing-controller-performance

This is B and select:
20210628_191543
Uploading 20210628_191518.jpg…

Both images didn't upload fully, but if your "B-button" outputs the "BTN_BASE3" code, this is by default mapped by uinput-mapper as the "SELECT/RESET" function. It is easier to re-wire physically on default/unchanged /sd/arcade.cfg and arcade1&1.py config files, which work together, than editing these config files. It should only be necessary to edit these files if some of the buttons are wrongly/not mapped AND it is not possible to rewire your controller (not the case with the ZERO DELAY ENCODER), or if there is missing too many output codes from your controller to fill every needed function to play MakeCode Arcade games(7-9 functions; UP, DOWN, LEFT, RIGHT, FIRE1, FIRE2, EXIT(,RESET, MENU))
https://github.com/Vegz78/McAirpos#default-button-mappings-with-corresponding-ev_abs-and-ev_key-codes

If you "B-button" emits TWO output codes(BTN_BASE3(it shouldn't) AND simultaneously(it shouldn't) any of the codes BTN_EAST(/BTN_B), BTN_THUMB2, 42 or 57), you should re-check the wiring and/or revert back to clean/default arcade.cfg and arcade1&2.py files(or at least ensure that the chain: physical button code output -> arcade1&2.py mapping -> arcade.cfg mapping is correct for every button/function.

I have now changed to this encoder https://www.electrokit.com/uploads/productfile/41017/SBC-ZDE-Datasheet.pdf, because it's the one the kids will have (I'll revert to the SJ@JX later).

Ok, I have opened a new issue for the Zero Delay Encoder(ZDE) here. Please keep your future comments about the ZDE inside this issue, and when you come back to the SJ@JX Arcade, please post in the other issue.

Could you point me to tha latest issue on this encoder, if there is anyone else who have tryed it? It would be really helpful.

This is the first time I have seen the ZDE and this is the first issue about it specifically.

And Button 10 - exit also opens the manue if I exit from Makecode (the list of makecode games)

RetroPie controller settings - apart from whatever changes you make to the physical wiring - is totally seperate from controller settings for McAirpos, which works on a lower RAW tier than ReroPie for controller inputs. Please get the controller to work as intended in McAirpos and according to EV codes that are output from the controller first, then easily remap/recofigure inside RetroPie afterwards.

@Vegz78 Vegz78 added the help wanted Extra attention is needed label Jun 29, 2021
@Vegz78 Vegz78 changed the title (Zero Delay Encoder) - Button mapping (Zero Delay Encoder)Button mapping Jun 29, 2021
@sofiania
Copy link

Thanks for the reply! The picture that uploaded was rhe Select button (SE) BASE3. B button output is: 1 (EU_KEY), code 290 (BTN_THUMB2), value 1. So it should be ok? But is still is the select button as well in menues etc... strange.

@Vegz78
Copy link
Owner Author

Vegz78 commented Jun 29, 2021

Thanks for the reply! The picture that uploaded was rhe Select button (SE) BASE3. B button output is: 1 (EU_KEY), code 290 (BTN_THUMB2), value 1. So it should be ok?

Looks correct for McAirpos that "Select" button outputs EV code BTN_BASE3 and "B" button outputs BTN_THUMB2! ;-)

But is still is the select button as well in menues etc... strange.

When you mention "menus", do you mean the RetroPie menus? In that case, reconfiguring for RetroPie is a totally separate operation, which you could do when every button is configured correctly inside MakeCode Arcade games:
https://droix.co.uk/kb/how-to-reset-controllers-on-retropie/

(You could instead of resetting controller mappings inside RetroPie, also find "Configure Input" in the RetroPie Main Menu, and then just hold any button on the controller you want to configure to start the process)
image

@Vegz78
Copy link
Owner Author

Vegz78 commented Jul 1, 2021

Any luck at last, @sofiania?

@sofiania
Copy link

sofiania commented Jul 1, 2021

Yes! I thougt I couldn't configure it that way as well, I thought I had to avoid that menue, and let McAirpos decide all the input controllers.

I'm so happy, because I got it all to work only really the last minute before the workshop began. Now with one day left of the workshop the cabinets are almost finished and they all have got RetroPie AND Makecode up and running with the usb encoder and all. I am so so so grateful for all your replies, because otherwise they would "only" have had RetroPie, and now they will also be able to play their own games in it!!!!

@Vegz78
Copy link
Owner Author

Vegz78 commented Jul 1, 2021

I am delighted to hear that, and much better a little late than never! ;-)

Thank you very much for you feed back and keep on retro game making and playing!

PS: Please advise your workshop participants to reduce as much as possible the use of extensions if they want the games to run well in RetroPie, at least the ones for (other)hardware. At least test the extensions early on in RetroPie, to see which ones work and which don't. The web simulator @makecode.com is known to ignore errors with extensions more gracefully and work more robustly, and the extensions do not all compile equally well @makecode.com to the RPi(and other hardware). This will save you all from a lot of frustration and boring bug-hunting time.

@Vegz78 Vegz78 closed this as completed Jul 1, 2021
@Vegz78 Vegz78 changed the title (Zero Delay Encoder)Button mapping (Zero Delay Encoder)Button mapping(detected&working) Jul 1, 2021
@Vegz78 Vegz78 changed the title (Zero Delay Encoder)Button mapping(detected&working) [Zero Delay Encoder] Button mapping(detected&working) Sep 2, 2021
@Vegz78 Vegz78 added the Controller Controller related issue label Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Controller Controller related issue help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants