Changing shutdown sequence possible? Custom case not logical to very young kids.

Started by generatorlabs, April 19, 2017, 03:42:46 PM

generatorlabs

Just finished this little aluminum Rertropie baby with my CNC machine.
Images attached.
Used cheap, but handsome mini aluminum amplifier case from ebay.
Also used short header extenders to relocate the connectors for power and hdmi.

My problem is this. I use this device with very young kids. I also have Retropie in KID mode to prevent tampering.
They understand how to turn it on.
Turning it off is not so intuitive.
They press the button for too short a time and it reboots instead of shutting down.
I would like to eliminate the reboot option or swap the sequence for shutdown and reboot.

Is there a simple way to do this by modifying a script or something?

Thanks!

Felix

The firmware and the script are in "sync" with respect to the short/long reboot/shutdown signals. So that wont be so easy to change.

I propose something else - how about using ATXRaspi in "latching mode"? You could then use a slide or toggle switch. The reboot function is still available but more obscure to use. The shutdown delay will still be there (2sec+ to start shutdown) but turning on and off is pretty obvious - switch is either ON or OFF.

generatorlabs

Quote from: Felix on April 19, 2017, 06:58:07 PM
I propose something else - how about using ATXRaspi in "latching mode"? You could then use a slide or toggle switch. The reboot function is still available but more obscure to use. The shutdown delay will still be there (2sec+ to start shutdown) but turning on and off is pretty obvious - switch is either ON or OFF.

Felix, thanks for your input.

I thought along these lines.
I am pretty committed to this case and switch as I have already machined the front bezel specifically for it. There is probably a latching version of this switch out there but then that kills my ability to use the software shutdown feature of RetroPie and I would have to eliminate the extra parts I have to accomplish it. To be honest "I" prefer to shut down from the comfort of my seat. The kids are not so patient ( and I don't expect them to ever be ). They want to press and go. If they have friends over they don't understand the sequencing either. The sequence of this device should mimic a PC or laptop, especially if it is called ATXRapsi. It would be nice to offer 1 or 2 variants of the firmware & script so the end user could choose working parameters they desire. In my case I could care less for a reboot option. If I really needed to reboot I would do it via the screen. If the unit was locked up then nothing is probably going to prevent a dirty restart anyway. I don't really understand the need for reboot. When is it useful? If I am standing at the Pi to do a reboot then why not do a complete shutdown and power back up? I am of the opinion that the sequence order should follow the the importance and frequency of use of a function. ON/OFF are going invoked far more than REBOOT will ever be.

A really cool option would be to have a separate switch like most PC's, that would initiate a reboot command. That switch could be a tiny hidden switch on the back of any console case. The current script could be modified to monitor another pin for a REBOOT request. Then the ATXRaspi could run a firmware variant that can focus on its main goal of a clean ON/OFF. I do understand that a second switch is not truly like a PC RESET button but it mimics it closely.  If the PI is locked up to the point where a software called reboot won't work  then you are probably going to have to do a dirty restart anyway :)

Felix

I suppose I could customize the firmware to only issue a shutdown, then you could implement your own REBOOT directly on a Pi pin with a simple momentary button, basically use the same script but assign to monitor another pin.
How many of these shutdown-only Atxraspis do you need?

generatorlabs

I really appreciate your willingness to help in this matter :)

I wish I could say I am going to buy more ATXRaspi's again for future builds but alas, building RetroPie units is not really a business venture for me. This was only a hobby project. I may in the near future build similar units for friends or family but I cannot be sure when that could occur. My particular build was a one-off project for me and the kids to enjoy. However not having to explain timing for ON/OFF functions to future recipients of my builds would be a big plus!

Can these units be flashed by USB?

On a side-note wouldn't it be great if you could have a script pulse an IO pin to put the ATXRaspi into different pre-configured operating modes (ie; ON/OFF only, ON/OFF/Reboot mode, etc etc). Kind of like a rudimentary serial communication. It appears you would be short on currently available IO, but maybe you could dual purpose another pin during boot time or some other time frame. Then you could have a few flavors of "firmware" available to the end-user. Just my ramblings....I like to overthink things sometimes :)



Felix


generatorlabs

I am happy to say that I have modified the ATXRaspi to now follow the switching logic of a typical PC.
Felix (the developer) was very helpful in this regard. He provided the necessary hardware details that would allow me to write my own program.

This is not necessarily an easy task. The program that runs on the ATXRaspi is the property of Felix and I can fully respect his position on this. I don't know many hardware developers that would release their hard work into the public domain. If you have aspirations to modify your ATXRaspi then you are going to have to write your own code from scratch. It is a nice weekend project for those that have some experience with programming Arduinos. Felix offered to make small modifications to the code for a fee. This would be a good route if you didn't want to burn some hours writing and troubleshooting your own code. I wanted the challenge of completing it on my own. It was fun.

I used an Arduino Uno as a programming bridge to the ATXRaspi. There are many threads on the net about how to turn a Arduino board into a programmer. Or you could buy a dedicated programmer. I have a few of the very inexpensive Uno boards lying around. Jumping six wires from the Arduino to the ATXRaspi blank header holes will complete the programming link.

Pressing the button once powers up the Pi. Pressing it again will shut it down gracefully. Holding it for more than 4 seconds will do a brute-force shutdown. I eliminated the button controlled reboot function. I saw no need for it. If I need to reboot I can do it from the Retropie/EmulationStation menus. I also added CEC-Utils to the Pi and invoke some HDMI-CEC commands from the SHUTDOWN.py script that is executed on startup and shutdown. This sends CEC commands over HDMI to auto switch HDMI inputs etc.

There is probably a more efficient way to code this but for me it works. I use IF-ELSEIF-ELSE and CASE commands to get the bulk of the job done. The strobing effect for the LED can be borrowed and modified from the examples code in the Arduino IDE. Most of your time will be lost on debugging and the Arduino IDE does not have any built it debugging tools.

Just be forewarned if you do decide to venture down this path you are doing so at your own risk. If you are not comfortable programming these devices then it may be worth paying a small fee to have Felix do it for you. For most the outcome is not worth the effort. I just had some time I wanted to burn

:)

Felix

Thanks for the follow up and feedback :)
Glad I could help, nice to see a user actually modifying what I did to best suit their purpose!
Also nice job with the case and wiring, very neatly done, I should add that soldering the wiring that powers the load (RaspberryPi) is the best route to avoid any low voltage warnings from weak/poor jumper wires, so kudos there as well!
Is this a game console? Would be cool to see if you just used a standard setup (retropie or simiar?) or was it customized?

generatorlabs

Quote from: Felix on May 01, 2017, 02:36:45 PM
I should add that soldering the wiring that powers the load (RaspberryPi) is the best route to avoid any low voltage warnings from weak/poor jumper wires
Is this a game console? Would be cool to see if you just used a standard setup (retropie or simiar?) or was it customized?

This is a plain vanilla Retropie image I am using. It seems to work well especially if powered correctly.
If under-powered you will see the lightning bolt symbol anytime there is heavy processing.
Which is why I chose to use a USB Type B connector for the main power input on my case (see pics at top of thread).
I can always find a beefy USB Type B wire lying around. The pins seem like they have greater current capability.
I also use a very nice Dell USB power supply which was initially intended for Dell tablet PC's (pic attached). The combination of these things keeps all the Pi cores running at the highest clock speeds without a dip in voltage.