RowdyVoyeur / m8c-rpi4

M8 Tracker Headless Client for Raspberry Pi 4 Model B.

Home Page:https://www.m8tracker.top/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Button-Problems with Waveshare Game Hat

headkit opened this issue · comments

Great tool, thanx for sharing!
I am trying to install it in a Waveshare Game Hat. I got it running and see M8 screen, but I don't get the buttons routed right.

I added

# PiBoy DMG
15000000010000000100000000010000,PiBoy DMG Controller,platform:Linux,a:b1,b:b0,x:b4,y:b3,back:b8,start:b9,leftstick:b10,leftshoulder>

# Waveshare game HAT
15000000010000000500000000010000,mkarcadejoystick GPIO Controller,platform:Linux,a:b1,b:b0,x:b3,y:b2,back:b7,start:b6,leftshoulder:b>

to gamecontrollerdb.txt and using jstest-gtk I was able to determine the button assignment (from my understanding) to be added to config.ini

gamepad_up=10
gamepad_left=12
gamepad_down=11
gamepad_right=13
gamepad_select=0
gamepad_start=9
gamepad_opt=3
gamepad_edit=1
gamepad_quit=5
gamepad_reset=4
gamepad_analog_threshold=32766

Unfortunately I only see the M8 screen, the buttons do nothing.
Any ideas?
Thnx!

I now checked the GPIO-Inputs with a quick python-scipt

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

for i in range(27):
    GPIO.setup(i, GPIO.IN)

while True:
    for i in range(27):
        if not GPIO.input(i):
            print("Input", i, "is HIGH")

and got a totally different setup:

gamepad_up=5
gamepad_left=13
gamepad_down=6
gamepad_right=19
gamepad_select=26
gamepad_start=4
gamepad_opt=21
gamepad_edit=16
gamepad_quit=23
gamepad_reset=18

Now when I use the joystick, the application crashes and the Raspberry restarts.

Sorry for the late reply. Have you tried the SDL2 Gamepad Tool to get the actual mapping of the controller?

Once you get the mapping right, you can copy and paste it onto the gamecontrollerdb.txt. Finnally, you may need to make some adjustments to config.ini. But, based on my experience, that can only be done once the mapping is absolutely correct.

I hope this helps.