RBEGamer / Python-Gamepad-Input

A pythonscript to send keystrokes by GPIO and ASD1
1 stars 1 forks source link

Feature Request for adding second joystick #1

Open TimGreerNZ opened 1 year ago

TimGreerNZ commented 1 year ago

Hi, just wondering if you had advice on adding a second joystick to this code. I'm assuming that I could just copy all the JS0 pieces and add a JS1 in the copied sections and adjust the ASD1115 address to scan the A2 and A3 input for second joystick. I will have both joystick modules on the one ASD1115 module for ease of wiring. Any advice on this would be appreciated.

TimGreerNZ commented 1 year ago

I believe I have coded in a second joystick, but I'm not 100% sure ai have it correct. I added extra buttons for js1 and just used 09876 included 6 as the second joystick button. Would you consider checking my code for me. I could just run it and see if it works I guess. Once I confirm its working I'm.happy to do a pull request incase you want it to add to the collection.

RBEGamer commented 1 year ago

Thank you! Scanning the other analog inputs is right and should work fine. Yes test or share it and then i can test it too!

TimGreerNZ commented 1 year ago

Ahi, no worries I love a challenge, I have mapped a couple of extra GPIO pins 1 each for Left and Right Trigger Buttons and one for js1 button. I should have it all finished up tomorrow and will try and remember how to get it in github and set it as a pull request to you. I basically copied what you had, adjusted the ads1115 channels for pins 2 and 3 and defined a few extra buttons in uinput for the extra stuff. I have never coded in python before so it was a steep learning curve lol. But I read over what you had a few times and got the basis of what it does. I am currently sitting here reading over it again to make sure I havnt missed anything. :)

TimGreerNZ commented 1 year ago

Have managed to fork a branch and add the file I sent it to you via a pull request for you to check over. Hope I got it right. IM also testing it as we speak.

TimGreerNZ commented 1 year ago

I think part of the ADC1115 code is going to need a rewrite because Adafruit have archived the code and switched everything over to circuit python so I cant download the original ADS1x15 library anymore. Im currently working on getting everything to behave with circuit python and the new ADS1x15 Library. Will flick a new Pull request once its sorted.