Danjovic Posted March 10, 2020 Share Posted March 10, 2020 Another controller adapter, deeply based on MegaPlay, should support: Analog Controller (using precise timing); Digital Controller on D-PAD just like a Masterplay adapter; Full keypad emulation; Auto detected second controller adapter for games like Robotron Independent Top/Bottom buttons on second controller. Controls Mapping, one controller: Controls Mapping, two controller emulation Second controller adapter consists of a P2 plug with DB-15 connector Wii classic controller connector should be builtin in the board 1 Quote Link to comment Share on other sites More sharing options...
0078265317 Posted March 10, 2020 Share Posted March 10, 2020 I have one of those classic controllers. Quote Link to comment Share on other sites More sharing options...
ave1 Posted March 10, 2020 Share Posted March 10, 2020 Maybe someone can make a few adapters for some of us? Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 12, 2020 Author Share Posted March 12, 2020 Still working on code, I kept the L and R buttons as Top and Bottom to make two joystick gaming easier. Changed 3.5mm stereo jack to USB A socket to allow control of buttons on the second joystick. Adapter cables can still be easily built. Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 13, 2020 Author Share Posted March 13, 2020 (edited) Updated the board and schematic. Added a Reset button as it might come in handy for a "powerup operation mode" selection without having to turn the console on/off or disconnect/reconnect the interface. Edited March 13, 2020 by Danjovic added info about reset button 1 Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 14, 2020 Author Share Posted March 14, 2020 Just created the repository on Github and a page with the log of the project at Hackaday.io. Code still in progress so no source yet. Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 16, 2020 Author Share Posted March 16, 2020 I should apply a gamma curve to the analog axes read from Classic controller to make the response of the stick more subtle near the center and more abrupt close to the edges. The curve below depicts the values from middle scale up to the growing edges (down and right) for two values of gamma. Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 22, 2020 Author Share Posted March 22, 2020 Easiest way to deal with dual joysticks to control a single pair of axis is to add both values and saturate on lower and higher limits. lx=classic.leftJoyX(); ly=classic.leftJoyY(); rx=(classic.rightJoyX()<<1); ry=(classic.rightJoyY()<<1); combinedXaxis = lx+rx-32; if (combinedXaxis>63) combinedXaxis = 63; if (combinedXaxis<0) combinedXaxis = 0; combinedYaxis = ly+ry-32; if (combinedYaxis>63) combinedYaxis = 63; if (combinedYaxis<0) combinedYaxis = 0; combinedYaxis = 63-combinedYaxis; Either axis will now return within the range 0..63 when moving respectively up->down and left->right. The resulting value in terms of Pokey hline countings will be in the range of 5..220 obtained from a table with values pre-computed in order to get more sensitivity around the central position of the sticks. uint8_t gammaCurve[64] = { // gamma = 2.0 5 , 12 , 18 , 24 , 30 , 36 , 42 , 47 , 52 , 57 , 62 , 66 , 71 , 75 , 78 , 82 , 86 , 89 , 92 , 95 , 97 , 100, 102, 104, 106, 107, 109, 110, 111, 112, 112, 112, 113, 113, 113, 114, 114, 115, 117, 118, 120, 122, 124, 126, 129, 131, 134, 138, 141, 145, 149, 153, 157, 162, 167, 172, 177, 182, 188, 194, 200, 207, 213, 220 } Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 23, 2020 Author Share Posted March 23, 2020 I am working now on code debugging but I can say that I am very close to a functional release. And I have updated the schematics. Freed one I/O pin by using one of the extra analog inputs from the Nano board to perform detection of the adapter for the second joystick port. Now with a couple of pins free I can add support for PS/2 mice and hence I have added a MiniDin connector on the board. Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 24, 2020 Author Share Posted March 24, 2020 (edited) Just released an Alpha on github repository. So far I have tested: Combined Analog control (either right or left stick control the axes) Dual controller auto detection Dual controller (left stick control main axes, right stick control secondary axes, buttons X,Y secondary buttons D-Pad override over left stick to provide full digital control (like Masterplay) Keypad emulation is yet to be tested on this prototype but it was verified to work on Megaplay. Edited March 24, 2020 by Danjovic added link to repository on github Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 24, 2020 Author Share Posted March 24, 2020 Second controller adapter can be made with standard USB cable and a DB-15 1 Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 26, 2020 Author Share Posted March 26, 2020 I have just released a beta version of the firmware, fully operational Also shared the PCB on OSHPark. All features planned initially are working: Full keypad emulation Can use either analog stick (left or right) on single controller mode DPAD works as a masterplay adapter (digital mode) Can change automatically to dual controller mode for games like robotron Do not depend upon internal potentiometer calibration Features to improve: Support for PS/2 mouse (connector provisioned at PCB) Support for Wii nunchuck (add gesture control for start / pause) I have invested plenty of time reading, investigating, designing, coding, testing, debugging and documenting this project, as well as Megaplay and even built a 5200 port emulator just for the fun, just for the challenge of solving a problem using a different approach. But now the deed is done and the time has come for me to move on to other projects, other platforms. I really hope you folks enjoy the things I did as much as I enjoyed doing 'em. But this is not a goodbye... I'll stick around! Less commited, though! Cheers! 1 Quote Link to comment Share on other sites More sharing options...
ave1 Posted March 26, 2020 Share Posted March 26, 2020 Danjovic, I would love to be able to play Robotron with the two sticks of a Wii Classic controller. I would also enjoy playing Gorf with the left stick for horizontal movement while the right stick is for vertical movement... Definitely let me know when someone builds a few of these to sell. Thanks! Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 21, 2021 Author Share Posted March 21, 2021 (edited) I have just uploaded a new version of the firmware. Some bugs have been corrected, specially the deadlock condition caused by pin change interrupt on pin 9 of 5200 port (Cav control). Using Classic controller library >0.8.1 . From version 0.8.1 the axes values are always returned in the range 0-255, even for knockoff controllers that can only operate in low resolution mode. Added a non-linear curve, that in practice provides a sort of dead band on the center and gets steep at the extremes. The curve saturate close to the edges to compensate some controllers that can not return in full range, even in high resolution mode. Corrected the code that adds the movement of left and right sticks in single controller mode. The resistor R1 shall be the value changed to 1K ohm so the LED on pin 13 of some Arduino Nanos does not interfere with Cav control. Thanks @Chris Belcher for the feedbacks! Edited March 21, 2021 by Danjovic Quote Link to comment Share on other sites More sharing options...
Swami Posted March 21, 2021 Share Posted March 21, 2021 can you share the microcontroller code for the latest analog control curve? Is that on Github? Quote Link to comment Share on other sites More sharing options...
Danjovic Posted March 21, 2021 Author Share Posted March 21, 2021 6 hours ago, Swami said: Is that on Github? Yes, the sources for the whole project are on github. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.