n-e-y-s/G27_Pedals_and_Shifter

Sanity check: Device does not present as a gear shift gamecontroller.

thatguyinoz opened this issue · 9 comments

Hi
First up thank you for the excellent work on this project.
I am using this project to address issues with the G27 Shifter having old/worn potentiometers and thus not detecting gears effectively.

Background
I have used a 'Duinotech Leonardo Tiny' which is a ATmega32u4 with a reduced number of exposed pins, however there are enough usable IO pins to attach the shifter.
I have changed the specific pins used for IO to suit this hardware, with equivalent Analog and Digital GPIO used.
I have edited the code to suit the new pin assignments, and it compiles without error.

When I run the calibration program I see the shifter move into the appropriate quadrant/sector to suit the gear being selected and after following the calibration process, I can see the zones have changed away from the defaults, and I can load and save calibration as expected.
When I attach the shifter (via the Leonardo) to a pc, it is detected as a serial port and a HID-compliant game controller.

All of this leads me to believe that the hardware and code are working as expected.

Issue
Windows control panel shows a device called "Arduino Leonardo" as a game controller. and going into Properties shows an X/Y axis graph, a Z-axis bar graph and a selection of buttons, (see image). It does not present as a shifter controller. In addition the buttons all flicker on/off 2-3 times a second. Pressing any of the red, black or "D-pad" buttons does not change the on screen status of any of the buttons. Changing the gear position changes the number of buttons that are illuminated, and rate that they flicker.
I would expect that the device would present as a gear selector device

Can i have a bit of a sanity check from someone using this device/code as to how it presents in windows, or how it is supposed to be used within a game such as Beam-NG

kind regards

Attached images
Capture2
Capture1

This is how it looks for me:

grafik

grafik

grafik

Maybe you just need to install the logitech driver for the G27, then the device would work. I don't remember if this was necessary...

Thank you for that info.
That is how the device appears on my computers, but doesn't explain the strobing effect of the buttons in the "Properties|test" section of Control Panel.
I will continue to review the hardware side and get a genuine Arduino Leonardo to see if it respoves the isse.

thanks again.

Here are some useful notes for future uses of this project

After a bit of thought, i swapped the pins labeled RX and TX over (D0 <-> D1) and the problem has been resolved. it seems that the Button Clock and Data were effective inverted. not sure if this was an artifact of the specific board i used or not as various pinouts I found using google search showed D0 and D1 swapped on many different boards.

The controller now responds as expected, with pedals using X, Y and Z axis, and buttons mapped as button 1 to 19. Gears are 1-7, other buttons are sequentially iterated.

The small green LED does not illuminate due to the choice of reversing the polarity of 5VDC to the pin1 and pin9. This has no effect on the operation of the controller.

Bottom line:
If you see inconsistent button action, then try swapping the D0 and D1 GPIOs around. :-)

serpro commented

@thatguyinoz I have now the same issue as you had initially and swapping the RX and TX pins doesn't solve it.

@n-e-y-s thanks for this project! When I put the debug as true in Arduino IDE and check the serial monitor I can see everything working correctly (gears, and pedals). But when I go to the calibration program, nothing happens (after disabling the debug mode). I don't have the wheel base anymore. only the pedals and shifter so when the calibration software starts I can't select G27 in the second dropdown. Do I need a G27 wheel for this to work?

Edit: I've also tried this project: https://www.youtube.com/watch?v=6Pu1qknGjy4 and it works fine (just the pedals)

Any suggestions?

You don't need the G27 wheel for this to work, I don't have it either. Maybe you can try to select another port in the first combo box?

@serpro
Sorry but i dont have any advice for you.

serpro commented

G27_Pedals_and_Shifter_mod.zip
I found someone who has fixed it. Thanks (this is where I found it: functionreturnfunction#26)

On a separate but related note, now my reverse doesn't work. Not sure how to debug/fix it. as in the serial monitor pressing the shifter and putting in reverse doesn't activate the reverse button.

my reverse was broken too - it was a mechanical defect for me. Before I fixed, the mechanics, there is a special mode where you can use one of the normal buttons for setting the gear in reverse. (it can be activated in the calibration app)

serpro commented

The reverse was working few days ago. But I can't use any other button as I'm using the shifter from the G29 which doesn't have any buttons :) Thanks for your help