Reset Script only works ONE TIME - recalbox 4.1



  • Reset Script only works ONE TIME - recalbox 4.1

    Hey. I built my SNesPi. (RaspberryPi inside an original Nintendo Snes Case and i want to keep the use as intuitive and original as possible.

    So, i 3Dprinted an internal support to a button that is pressed when i press the original EJECT button on SNES console... The plastic just press the button and it´s tied to the GPIO 1P START Button. I am using 2 SNES controllers over USB on the same PI. So the SNES controllers are 1P, 2P and the GPIO is configured as 3P. 
    
    Unfortunatelly  (And i can´t imagine WHY this designed light that), retroarch only accepts Overall emulator Key Bindings on Player 1 Controller. :( That´s not good for my case, because it just ignore any input from Player 3 (Snes case buttons on GPIO as Player 3). 
    
    
       That said, i just checked that my EJECT button is working nicelly on REcalBox 4.1 and i noticed that now, there´s an handy EXIT Python script included to exit games just pressing START on GPIO ! That´s perfect for custom cases ! 
    
        But i need an RESET button working too. So i got the code for RESET (Custom.sh + Python script) set everything and bam. It´s "working" but it only works one single time. I enter a game, for the first time after the boot. Press RESET on my snes (Wich is using GPIO (24) Button A) The rom is reseted on Retroarch (Network commands on), but if i just try it again, all the next  resets are ignored. :( 
      I really don´t know what´s wrong... 
    
      I even monitored the Terminal on that Pi, acessing it over SSH, and everytime i Rock the RESET switch, the terminal shows "RESET" message. But retroarch ignores it... (After the first reset...) 
     This reset is the same as pressing HOTKEY + A on Retroarch on 1P controller... And it´s working everytime pressing on 1P gamepad... But i would love to see it working with the original RESET switch on SNES too... I just changed the original python script from GPIO 3 to GPIO 24 because its the one i have wired on the switch (but i can change it to any pin)
    
      This is  the custom.sh : 
    

    '''

    #!/bin/sh
    #custom.sh

    case "$1" in
    start)
    python /recalbox/share/system/reset_btn.py
    ;;
    stop)
    ;;
    esac
    exit $?

    And the Python script :

    import RPi.GPIO as GPIO
    import time
    import socket

    addressing information of target

    IPADDR = "127.0.0.1"
    PORTNUM = 55355

    enter the data content of the UDP packet

    COMMAND = "RESET"

    initialize a socket, think of it as a cable

    SOCK_DGRAM specifies that this is UDP

    try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    except socket.error: print 'Failed to create socket' sys.exit()

    GPIO.setmode(GPIO.BCM)
    GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)

    def exitEmulator(channel):
    s.sendto(COMMAND, (IPADDR, PORTNUM))

    GPIO.add_event_detect(24, GPIO.FALLING, callback=exitEmulator, bouncetime=500)

    while True: time.sleep(10)

    ----------------------------------------------- '''

    Any help ? :)



  • Sorry. I don´t know how to remove text formatting on this forum.


  • Moderator
    Moderator
    Team

    @marcelo-souza Hi,

    Same issue here. Trying to find a solution...



Want to support us ?

Join us on :

392
Online

31313
Users

15151
Topics

113956
Posts

Looks like your connection to Recalbox Forum was lost, please wait while we try to reconnect.