AEFeinstein / Super-2024-Swadge-FW

Firmware for the Super Magfest 2024 Swadge
https://adam.feinste.in/Super-2024-Swadge-FW/
MIT License
11 stars 9 forks source link

Port Gamepad #36

Closed Brycey92 closed 10 months ago

Brycey92 commented 1 year ago

Summary What is the feature all about? Is it a game, a utility, an enhancement, or something else? Gamepad mode from 2023, now in IDF 5.0

Technical Spec How will this be implemented? What peripherals will be used, and how? Digital touch buttons should be removed, and replaced with a virtual analog stick mapped to the new touchpad. 2024 hardware will be needed for this.

UI What are the display screens & menus (if applicable)? What user inputs are there for each screen? Same UI as last year, but with changes for aforementioned touchpad redesign. We can also add a deadzone setting if we find it natural to return the finger on the touchpad to a "home" position in the center, rather than lifting the finger.

Mockups Paste any mockups of screens or anything else here. Sample analog stick visualization with deadzone: image

How to Test How can we verify the feature is working? Test on a Switch and a PC

Brycey92 commented 1 year ago

The bulk of the mode is currently ported, except for aforementioned UI/control changes and the gamepad support in the tinyusb component.

No compiling or testing has been done, since the tinyusb changes are required.

AEFeinstein commented 1 year ago

If you want to make the UI look more Metroid-Primey, and less gamecube controllery, that'd be cool too. Maybe some color swaps, maybe some HUD decor?

Brycey92 commented 1 year ago

Currently blocked by missing driver support. Looking for helper(s) experienced with modifying components.

Will pick up UI and touchpad changes once driver compiles.

AEFeinstein commented 1 year ago

Driver support isn't missing, but I agree that it isn't working as expected. When loading demo mode, my Swadge does enumerate as a USB Gamepad, but it isn't sending button presses as expected. When I ported everything, I used TUD_HID_REPORT_DESC_GAMEPAD, but it looks like that was replaced in our source by TUD_HID_REPORT_DESC_GAMEPAD_SWADGE. I suspect something about that is screwy. Paging @cnlohr

AEFeinstein commented 1 year ago

@Brycey92 in the meantime you can try checking out 2bf02263f92fe2401efbe2f98b22edb7c51a8df0, the rev before advanced USB changes, and see if Demo mode's USB works for you there.

Brycey92 commented 1 year ago

I ran a fullclean, make, and idf.py build flash on https://github.com/AEFeinstein/Swadge-IDF-5.0/commit/2bf02263f92fe2401efbe2f98b22edb7c51a8df0 and the hardware becomes unresponsive when powered on. No LEDs light up, the TFT remains off, and the Swadge cannot be rebooted into the bootloader via USB utilities.

Holding UP to force programming-mode-boot allows reflashing to known working firmware from main branch, though repeating steps to clean and build the suggested commit result in the same issues.

AEFeinstein commented 1 year ago

dang. Lets go further back, does it work in 30823ed? If so, this may be a job for git bisect

AEFeinstein commented 1 year ago

Also, fwiw, this was originally developed on a squarewavebird

Brycey92 commented 12 months ago

This now compiles, connects to PC, and reports buttons, thanks to @AEFeinstein.

We now have to

AEFeinstein commented 11 months ago

UI update is necessary.

Switch compat is a 'very nice to have' but I'd still be OK shipping without that.

I don't know if touchpad reporting style settings are worth the effort. The options, in bullet point form are:

But of these, the only one I care about is analog. For real commercial gamepads, analog sticks don't have settings to report as binary buttons. They just report analog and the PC deals with it. I'd recommend cutting both the settings and UI scope such that it only reports X/Y analog and only draws a dot-in-a-circle.

AEFeinstein commented 11 months ago

@Brycey92 motion support and PC/Switch compat are in main, so I think this is all in your court for UI and maybe some config if you want.