ramapcsx2 / gbs-control

GNU General Public License v3.0
809 stars 113 forks source link

D-DUINO "HW-630" mod #530

Open MacGyver4B opened 10 months ago

MacGyver4B commented 10 months ago

gbs-control_2button_mod.zip I bought an D-DUINO thats a little carrier board comes with nodeMCU, usb serial, an oled display and two buttons. I attached my modded version of the code if that is of any interest still did not figure out how to do that correctly with github. The board I have is marked HW-630 you need to exchange D1 and D2 in line 29: "SSD1306Wire display(0x3c, D1, D2);" to make the display work. As I don't have an encoder I decided to connect an up and down button instead of the encoder the select was already assigned to the onboard button labeled flash. If you just use down and select the menu still is working so I decided to mod the D-Duino, as the second button was wired as Reset. On the back side you can remove the 470 Ohm resistor close to the button to disconnect it from Reset. There is an empty resistor pad that will connect the button to D0 (GPIO16) for some unknown reason D0 does not work in conjunction with the rest of the code even not when a 10K pullup is connected and a test sketch works completely fine. Maybe you know why? I connected the button via a 470 Ohm resistor to D7 and like that the attached code works well. There are two modification quite to the end because sometimes I got stuck in the menu with button control. That might be an issue with encoder as well. Best regards Stefan

MacGyver4B commented 9 months ago

With the freshly added renewed menu I was thinking I did need to look at the code again but that is actually not needed. No real change to the code is needs to be done, just some little adjustments to the pin assignment are enough, the change in the last line is not need its just cosmetic to match the others:

SSD1306Wire display(0x3c, D1, D2); //inits I2C address & pins for OLED const int pin_clk = D7;
const int pin_data = D5;
const int pin_switch = D3;

Is there a way to preserve that in case of OTA update? How do I get the 4 buttons on the GBS working?

Found out some things and got more questions: If "#define HAVE_BUTTONS" is set to 1 only the SDD1306Wire line needs to be adjusted as Up and Down gets exchanged.

From the code it looks like the buttons need to be connected as following: D3 (menu_shift), D5 (down_shift) and D7 (up_shift) and also?! to (input_shift), but how can two buttons be connected to D7?

I think I found the answer: The code is very confusing up and down gets swapped when no encoder is used, input_shift and back_shift is not used when new OLED menu is used.

Actually the buttons need to be connected like this: Connect whatever button (left/right) you want to have as Select-button to D3. Connect Down-button to D7 and Up-button to D5. Back_shift is defined but not used. Menu_shift is used as Enter/Select.

It would be great if the info how to connect the buttons is added to the Documentation/Wiki.

I might have found some bugs: