• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Multi Switch Shutdown Script!

Scheduled Pinned Locked Moved Ideas and Development
shutdown scriptshutdown switchcyperghost
272 Posts 40 Posters 109.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    darknior
    last edited by 7 Jul 2018, 07:10

    WOAW excellent, i've receved my new NesPi+, i will try it :)
    Thanks

    Life is game, just play it !

    1 Reply Last reply Reply Quote 0
    • D
      dudumaroja
      last edited by dudumaroja 20 Jul 2018, 03:18

      Hello.. i have a modification sugestion..

      maybe you could integrate a save state function to the reset button.. using this!

      https://github.com/GregorR/RetroArch/wiki/Network-Commands

      this open doors to.. gracefully quit emulation ( retroarch compatible cores).. and other thinks like.. pressing reset for 5 seconds save state.. quick press load state..

      you can even set the reset button to reset only the game you are playing.. and other thinks,

      L 1 Reply Last reply 20 Jul 2018, 04:57 Reply Quote 0
      • L
        lostless @dudumaroja
        last edited by 20 Jul 2018, 04:57

        @dudumaroja You can do it your self. That's the whole fun of retro pie. If you are willing to do some research and get your hands dirty anything can be done.
        heres a link to the recalbox help page with instructions on how to set this up.
        https://github.com/recalbox/recalbox-os/wiki/RetroArch-Network-Commands-(EN)

        1 Reply Last reply Reply Quote 0
        • O
          OrehRuoy
          last edited by 21 Jul 2018, 21:54

          Hello, is there a way to get the source code so that I can add led functionality to the code. I just want it to set a GPIO to high when turned on and to LOW when turned off.

          Thanks.

          M 1 Reply Last reply 22 Jul 2018, 02:03 Reply Quote 0
          • M
            mitu Global Moderator @OrehRuoy
            last edited by 22 Jul 2018, 02:03

            @orehruoy The source is on github, link is in the 1st post - https://github.com/crcerror/ES-generic-shutdown.

            1 Reply Last reply Reply Quote 0
            • C
              cyperghost
              last edited by 22 Jul 2018, 10:41

              @orehruoy You can modify the code of the script of course. But if you just want to glow a LED for power on/off control then use the UART port. A simple solution and no script needed.

              Here is a guide of how to do this

              O 1 Reply Last reply 22 Jul 2018, 15:19 Reply Quote 1
              • O
                OrehRuoy @cyperghost
                last edited by 22 Jul 2018, 15:19

                @cyperghost said in Multi Switch Shutdown Script!:

                @orehruoy You can modify the code of the script of course. But if you just want to glow a LED for power on/off control then use the UART port. A simple solution and no script needed.

                Here is a guide of how to do this

                I didn't know how to access your code in the pi. I will try that other method though seems simple. Thanks.

                1 Reply Last reply Reply Quote 0
                • D
                  darknior
                  last edited by 16 Sept 2018, 22:37

                  I finally try your script :)
                  Correct a problem for me because you install the script in /home/pi/Retropie/Scripts/ and this directory is on my USB drive.
                  I can't have good right to execute .sh on USB drive with the auto-mount :p
                  I change to use it in /home/pi/Scripts/ and it's perfect, thanks a lot :)

                  Only one question, when i want to quit RetroArch to ES i must clic 3 time on my reset button ... Is it normal ?
                  The power off button working fine every time. Using Reset in ES to restart ES is not working for me.
                  Your PID detection is impressive, it works with emulators and also OpenBOR :p

                  Life is game, just play it !

                  C 1 Reply Last reply 17 Sept 2018, 18:59 Reply Quote 0
                  • C
                    cyperghost @darknior
                    last edited by 17 Sept 2018, 18:59

                    @darknior said in Multi Switch Shutdown Script!:

                    Only one question, when i want to quit RetroArch to ES i must clic 3 time on my reset button ... Is it normal ?
                    The power off button working fine every time. Using Reset in ES to restart ES is not working for me.
                    Your PID detection is impressive, it works with emulators and also OpenBOR :p

                    Well the detection of button press is just checked every 1 second. So you might press the button for a longer time.

                    The PID detection is introduced by runcommand script as entry point ;) And from this point I create PID array.

                    1 Reply Last reply Reply Quote 1
                    • D
                      darknior
                      last edited by 17 Sept 2018, 22:22

                      Ok thanks i understand better now :)

                      Your PID idea is cool and can maybe be used to improve other scripts?
                      I use this one, where we must make an array to list all the emulators and homebrews to stop music :(

                      https://retropie.org.uk/forum/topic/16458/modified-background-music-script-with-added-overlays

                      I'm sure we can do it with your idea, or maybe just detect when runcommand launch something and mute the music.

                      Life is game, just play it !

                      C 1 Reply Last reply 17 Sept 2018, 22:33 Reply Quote 0
                      • C
                        cyperghost @darknior
                        last edited by 17 Sept 2018, 22:33

                        @darknior That's is possible, too.

                        try the parameter multi_switch.sh --es-emupid
                        If it returns 0 than there is no emulator called by runcommand.

                        1 Reply Last reply Reply Quote 0
                        • M
                          mrfalk
                          last edited by 8 Nov 2018, 17:47

                          Hi there love this script and community I’m trying to implement this to a 12v relay that turns the pi on and off using NO port so it’s ether open or close depending on if the 12v trigger is on or off

                          Is it possible with the generic trigger in the script?

                          C 1 Reply Last reply 8 Nov 2018, 18:33 Reply Quote 0
                          • C
                            cyperghost @mrfalk
                            last edited by 8 Nov 2018, 18:33

                            @mrfalk Yes, this should work with generic button script.
                            So 12V closes the relais and as long your car keeps running the relais stays close. You turn off the vehicle the relais turns to off-state and releases the circuit.

                            1 Reply Last reply Reply Quote 0
                            • M
                              mrfalk
                              last edited by mrfalk 11 Sept 2018, 08:40 9 Nov 2018, 08:39

                              Cool I was messing around with it yesterday but dident get it to work I’ll try again today after work.
                              And it’s not a car I’m using it’s a trigger signal from my projector that is normally used to tell screen go down when projector is on and hop when you turn the projector off.
                              But I guess it works the same.
                              And yes relay circuit is ether close or open depending in if the projector is on or off so same principle i guess

                              One question do I only install script and tell which button to use or do I need to mess with python commands?

                              C 1 Reply Last reply 9 Nov 2018, 14:54 Reply Quote 0
                              • C
                                cyperghost @mrfalk
                                last edited by cyperghost 9 Nov 2018, 14:54

                                @mrfalk

                                One question do I only install script and tell which button to use or do I need to mess with python commands?

                                You download the script with wget command or insert the code with nano and make the script executable (chmod +x). By default GPIO3 (=Pin5) is used because this pin is the only one to wake the Raspberry from deep sleep. The shutdown function is independent from GPIOs but as I said only GPIO3 offers full shutdown/repower ability.
                                The just type ./multi_switch.sh --generic and follow intructions. It's very likely you need to install raspi-gpio with sudo apt install raspi-gpio before but the script will tell you.

                                Yes please report your progress. But why you want to use a relais? Opto-isolators are much cheaper and easier to use.
                                Wiki Opto Isolator
                                https://en.wikipedia.org/wiki/Opto-isolator

                                1 Reply Last reply Reply Quote 0
                                • M
                                  mrfalk
                                  last edited by mrfalk 11 Sept 2018, 22:45 9 Nov 2018, 20:30

                                  couse im a newbie at the electronic/rasberry/ stuff but learning and relay was only thing i could think of and that i had laying around =)

                                  when i do ./multi_switch.sh --generic nothing happens
                                  im in /RetroPie/scripts & folder and when i type ./multi_switch.sh --generic nothing comes up or happens

                                  i do get it to wake up from sleep when i turn projector on and relay goes to close state.
                                  but i doesent shut down when i turn projector off and relay goes to open state

                                  and uhm what do i need to make it executable sorry for my noobishness =/

                                  Edit
                                  nvm found out how to do it

                                  Edit 2
                                  but still cant get shutdown to work when the relay opens the circuit and the two pins get seperated (open/not shorted) nothing happens

                                  and when i do raspi-gpio set PIN# ip pu i get unknown GPIO PIN# im guessing PIN# is 3 then

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    mrfalk
                                    last edited by 10 Nov 2018, 00:56

                                    Finally got it to work after few hours of bug searching
                                    and reason was that I hade (boot to desktop auto login as pi) and change to (boot to text console auto login as pi) and Now everything workes perfectly exectly as I want it to at least hehe thx @cyperghost for all your hard work on this script was exactly what I was looking for and I would have never could have done something like this myself

                                    //peace

                                    C 1 Reply Last reply 10 Nov 2018, 08:36 Reply Quote 0
                                    • C
                                      cyperghost @mrfalk
                                      last edited by 10 Nov 2018, 08:36

                                      @mrfalk

                                      boot to text console auto login as pi

                                      I think it is enough to just write ./multi_switch --generic & to send the process to background. Then you avoid the second text console ;)

                                      1 Reply Last reply Reply Quote 1
                                      • M
                                        mrfalk
                                        last edited by 12 Nov 2018, 11:39

                                        It works great it boots in to EmulationStation and turns On/Off

                                        But I encounter a problem it randomly starts it self when projector is still off and dont give out signal to relay wich means circut is open

                                        C 1 Reply Last reply 12 Nov 2018, 19:03 Reply Quote 0
                                        • C
                                          cyperghost @mrfalk
                                          last edited by 12 Nov 2018, 19:03

                                          @mrfalk Then there is a kind of "backstroke" somewhere. Maybe it's the relay coil itself, or the relais falls back in closed state somewhere.... Really have no idea why this is happening.

                                          1 Reply Last reply Reply Quote 1
                                          • First post
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                            This community forum collects and processes your personal information.
                                            consent.not_received