diff --git a/board/recalbox/fsoverlay/recalbox/scripts/rpi-pin356-power.py b/board/recalbox/fsoverlay/recalbox/scripts/rpi-pin356-power.py index 672e7c270399f15cc8fe6fb38e66e7c77b2e47ec..fe1f44633e64898ca3e1b835900c968be6ecc760 100644 --- a/board/recalbox/fsoverlay/recalbox/scripts/rpi-pin356-power.py +++ b/board/recalbox/fsoverlay/recalbox/scripts/rpi-pin356-power.py @@ -168,11 +168,13 @@ if mode == "onoff" : # Allow Nespi+ to detect the end of the shutdown for proper power-off GPIO.setup(POWEREN, GPIO.OUT) GPIO.output(POWEREN, True) - GPIO.add_event_detect(POWERPLUS, GPIO.FALLING, callback=onoff_mode, bouncetime=2) - GPIO.add_event_detect(RESETPLUS, GPIO.BOTH, callback=onoff_mode, bouncetime=2) + time.sleep(0.2) + # Change from FALLING to RISING to detect correctly the on/off from active to shutdown + GPIO.add_event_detect(POWERPLUS, GPIO.RISING, callback=onoff_mode, bouncetime=200) + GPIO.add_event_detect(RESETPLUS, GPIO.BOTH, callback=onoff_mode, bouncetime=200) elif mode == "push": - GPIO.add_event_detect(POWERPLUS, GPIO.BOTH, callback=push_mode, bouncetime=2) - GPIO.add_event_detect(RESETPLUS, GPIO.BOTH, callback=push_mode, bouncetime=2) + GPIO.add_event_detect(POWERPLUS, GPIO.BOTH, callback=push_mode, bouncetime=200) + GPIO.add_event_detect(RESETPLUS, GPIO.BOTH, callback=push_mode, bouncetime=200) while True: time.sleep(0.2)