OpenStickCommunity / GP2040-CE

Multi-Platform Gamepad Firmware for Raspberry Pi Pico and other RP2040 boards
https://gp2040-ce.info
MIT License
1.48k stars 319 forks source link

Enabling Turbo Dial cause instability problems #846

Open fostrike opened 8 months ago

fostrike commented 8 months ago

Prerequisites

Please check the following before posting an issue / bug report.

Context

Please provide all relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Expected Behavior

10K potentiometer connected to analog I/O pin26 to dial the turbo speed

Current Behavior

So i tested the use of a Turbo button, a Turbo LED and a Turbo Dial function back in September 2023 on firmware version V.0.7.1 with a simple bread board. Everything was fine and working as expected so i made a custom PCB. Now i just assembled the PCB and flashed the new WaveshareZero firmware v0.7.7. The Turbo functions are still working as expected but Windows very often fail to properly recognize the device, giving the "unknown device" error. This problem goes away as soon i disable the Turbo Dial on pin26 in the web-config. On top of that, if i plug the USB while the potentiometer is set to full turbo speed the configuration made in the web interface are wiped to the default settings. If i load the old v.0.7.1 firmware on my PCB the problem disappear.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Just enabling the Turbo Dial on an analog I/O pin make the device pretty unstable, Win11 and Win10 often fail to recognize the device

Screenshots & Files

(https://drive.google.com/file/d/1HMMg-TPW2Efj3OVIwXRW9o_sqa61D9Uq/view)

bsstephan commented 8 months ago

@fostrike this sounds legitimate based on your test with v0.7.1, but for completeness's sake, have you tried v0.7.7 on your breadboard setup?

fostrike commented 8 months ago

No but i did isolate the 3,3V output path that in the PCB goes to the Turbo LED trough a resistor and the 10K pot for the analog pin 26. So only the potentiometer and few buttons are connected, the OLED pins are wired but unconnected. If i measure with a multimeter between the RP2040Zero 3.3v out pin and pin 26 i got the full range of the pot, from 0 to 10K ohms

FeralAI commented 6 months ago

Hello @fostrike! Can you test out the latest release v0.7.8? There were several updates to turbo functionality, and specifically there was a bug that was fixed when using a turbo dial that may have caused the behavior you reported.

fostrike commented 6 months ago

Hello Feral, first of all thanks for the fixes. The instability problem seems resolved, i can leave the dial knob at any level and the controller is always properly recognize by Windows. The only thing is that by default when i plug the device the Turbo LED is always ON, then when I assign the Turbo function to a button the LED goes OFF and work as usual, blinking according to the Dial adjustment. Is this the expected behaviour? In my wiring i got the 3.3V connectet to the LED positive and the negative goes to the RP2040 pin, so i suppost at startup this pin goes to 0?

FeralAI commented 6 months ago

Hello Feral, first of all thanks for the fixes. The instability problem seems resolved, i can leave the dial knob at any level and the controller is always properly recognize by Windows. The only thing is that by default when i plug the device the Turbo LED is always ON, then when I assign the Turbo function to a button the LED goes OFF and work as usual, blinking according to the Dial adjustment. Is this the expected behaviour? In my wiring i got the 3.3V connectet to the LED positive and the negative goes to the RP2040 pin, so i suppost at startup this pin goes to 0?

Thanks for testing this out, and good to know it fixed that locking up issue. Regarding the LED, the logic in the turbo code is expecting the positive to connect to GPIO. This is because the breakout boards for the project use a generic 2-pin JST that connect a GPIO and ground. My test setup is similar to yours with LED- connected to GPIO. In the next version I'll add a toggle to the turbo addon that will allow inverting the turbo LED logic to correct this.