Author Topic: Is Shutdown only possible?  (Read 2495 times)

olivergoldblack

  • NewMember
  • *
  • Posts: 4
Is Shutdown only possible?
« on: October 09, 2020, 04:12:31 AM »
Hi, Just wondering if it is possible to have a shutdown and complete power off option only? (no reboot)

Currently pressing a switch 1-3 seconds is reboot, 4-8 seconds is shutdown and complete power off, and 8+ seconds is force shutdown.

I'd only like to use the second option but on a single push of the button (not waiting for 4 seconds)

Is this possible?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Is Shutdown only possible?
« Reply #1 on: October 11, 2020, 06:36:47 PM »
I suppose you could use a latching button. It has 2 states. When you turn it ON, the ATXRaspi provides power, Pi boots up BOOTOK green LED goes ON. Then you flip the switch OFF, then ATXRaspi issues SHUTDOWN and Pi unboots and signals to ATXRaspi to turn power off.
The reboot would still technically be available in that intermediary state where you flip the latching button OFF then back ON quickly  before the SHUTDOWN is issued, then a REBOOT would be issued instead.
I guess a more advanced firmware and microcontroller would be needed to offer much more configuration than a standard set of behaviors. Maybe sometime in the future.

olivergoldblack

  • NewMember
  • *
  • Posts: 4
Re: Is Shutdown only possible?
« Reply #2 on: October 14, 2020, 03:07:21 AM »
OK thanks for the reply.
I'll try a latching switch, I assume I can use the same script.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Is Shutdown only possible?
« Reply #3 on: October 14, 2020, 09:18:26 AM »
Yes, the script doesn't care about the hardware, it listens to SHUTDOWN and REBOOT commands.
I suppose you could comment out the script section where it does a REBOOT, so in case you would ever issue a REBOOT, then it would ignore it. ATXRaspi would then timeout after a minute and return to normal state if the BOOTOK signal never goes LOW.

olivergoldblack

  • NewMember
  • *
  • Posts: 4
Re: Is Shutdown only possible?
« Reply #4 on: October 16, 2020, 03:02:01 AM »
so I've done a load of trials.

1. A latch switch doesn't really work because you have to press it twice to shutdown and to boot again.
I couldn't work out why at first, but I swapped the switch with some jumper wires then realized what was happening. When you turn the switch off it shutsdown and powers off, but its a closed circuit (drawing current) at this point to trigger the shutdown script, so in order to boot  from the same button press it needs a new signal so you have to press the switch twice to cut the switch signal and create a new signal.

I also tried hacking the 'softshutdown' script, which nearly worked. I added the 'sudo' shutdown script to a python file (I need other things to happen before the pi totally shuts down you see), which works fine as long as you press the switch longer than 3 seconds, but any less and it shutsdown but doesn't cut the power and the 'bootok' led just flashes.

 The softshutdown script is modified to be triggered using the shutdown button, then I was hoping the simulated 4 second press in the script would trick the ATX board into thinking it needed to shutdown and poweroff no matter how long the button was pressed for.

It must be something in the firmware that is also counting how long the shutdown button is pressed for, can't seem to python my way round of just having a single on off press to shutdown, poweroff and boot.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Is Shutdown only possible?
« Reply #5 on: October 16, 2020, 09:17:09 AM »
Yes, it matters how long the "press" is in effect. This is how the firmware decides if it's a SHUTDOWN or REBOOT.
Then on the Pi side, the script checks how long the SHUTDOWN signal is HIGH. Short is REBOOT, permanent is SHUTDOWN.

olivergoldblack

  • NewMember
  • *
  • Posts: 4
Re: Is Shutdown only possible?
« Reply #6 on: October 16, 2020, 09:56:02 AM »
OK thank you for your help.
I need to put my thinking cap back on then.