-
Notifications
You must be signed in to change notification settings - Fork 27
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
Help with a custom controller implementation on CYD. #56
Comments
There are a few things that don't make much sense. The value printed is way too big for a single byte. This often indicates that signed and unsiged are messed up, but in this case the value is 0x3ffb3c0c which actually isn't negative as a 32 bit value either. You really need to figure out what this byte type is. sizeof(byte) may give some hints. Another thing I noticed is that bval is neither initialized nor set later in case of a timeout. So in that case readi2c would return random stuff from the stack in case of a timeout, This all isn't Arduino or galagino specific but rather just plain C. You simply need to debug this further. What exact size is a "byte" here? Is it signed or unsigned? How is this expanded when doing a printf? etc etc ... |
@harbaum - Thank you. I am a programming generalist and you could inscribe what I know about C and C++, specifically, on a grain of rice with a blunt crayon. That said, I think this is definitely something to consider. Appreciate your feedback. Will persist with debugging and hopefully post working code here soon! |
I actually accidentally posted my last update to a completely different issue board like a dork (bluepad32 board) anyways, I have changed tracks, and tried to move to a bluetooth controller implementation. I thought I'd take a crack at getting the bluepad32 library working and I've mostly succeeded.
The cool thing is this is MOSTLY working. When the library is compiled with the Bluepad32 version of ESP32 Dev Module, everything compiles, the controller is detected. The buttons work and Up and Down work in the menu for picking which game you want to play. The problem I'm having right now, and I'm just completely stuck on, is that, using the serial prints, I know I'm getting left and right from the x and y axes (-512 for left/up, 512 for rt/dn on press with it centered at maybe 3 on x axis and -3 on y axis). I've even tried some debugging to verify that when dpad is pushed, that
I feel like what I'm returning is not markedly different (just different expected values from the joystick). Example serial output dead stick:
Example serial output left stick:
My only other guess is that MAYBE something about the bluepad32 library itself is causing issues detecting input. Not 100% sure if that's the case, but stranger things have happened. Anyways, delving into the C code where control is parsed is not something I'm skilled enough to do with any sort of speed, so at this point, while I am working my way through it, thought I'd ask again since you were helpful with the first version. I'm incredibly close to things working 100% right now. Any suggestions are welcome. For reference, I'm not at all a C or C++ guy but I am fluent in psuedocode and many other languages, as well as googling and R-ing TFM. If I can get this updated, it's a few simple steps to a working PR. Bluepad32 works with many controllers, you've probably got one laying around. If you'd like to try this out, follow the instructions for the bluepad32 installation in arduino ide here: https://github.com/ricardoquesada/bluepad32 , compile galagino for the CYD board under bluepad32 esp32 instead of esp32 and drop in the above file for Nunchuck.h, it compiles and lets you select a ROM in the menu. Works without the controller connected as well in "demo mode" where it selects a master on it's own. I've got this last little issue to clear up is all. Cheers! |
Sorry, for the above, button presses are detected in the menu and the game, but not directions. |
Greetings,
I have things working on a CYD, but I don't want to use a Wii nunchuck. CYD doesn't have adequate GPIO pins for a proper controller, so I've worked on making my own i2c device using an Seeeduino Xiao. I tested this i2c device using an ESP32 and it seems to work just fine when using the default i2c pins on the esp32. Here is the slave sketch:
And here is the master sketch:
As I said, this seems to be working just fine. So I turned my hand toward modifying it to use with Galagino.
I got Galagino compiling and running on my CYD with just a few modifications to
config.h
per the instructions. The serial is reportingNunchuck disconnected!
of course, but the roms load and go through the motions, I can get them to start with the button as you'd expect.I thought the best way to try to implement my i2c controller was to just overwrite the existing
nunchuck.h
include with my owni2c.h
include with the same functions implemented for my device. I updated the main sketch to include my file instead of the original, confirmed it's being loaded, and got it compiling and loading just fine. So here is my implementation:For some reason, when I use this implementation, I can see the values I'm expecting via serial print messages, except for the start byte, which is reading as "1073429516" instead of 255. Here is what I am getting:
This is really strange to me, but I am new to i2c, Arduino IDE (platformio guy), and Galagino. I have tried the following things:
Things I haven't tried:
Any suggestions are welcome. Thanks for the great software! So cool!!
The text was updated successfully, but these errors were encountered: