Hi Tony,
I was looking at the WDT and I realize that is a little problem with the interrupt, is a hardware problem because the card keeps the interrupt pin low even if the interrupt is enabled or not. The workaround for this is to add about 2k pull-up to 3.3V and the pin is copy the button state.
The "pbe" is created for safe shutdown and then power only if the button is pressed again so the flow should look like this:
1) enable the button "wdt -pbe 1"
2) Wait for button to be pressed reading periodically the status "wdt -g pbs"
3) if the button is pressed change the off period to a higher number "wdt -off 10000"
4) set the period so the raspberry have te time to shutdown "wdt -p 120"
5) issue a shutdown command "sudo shutdown now"
6) The raspberry will be powered off.
7) The raspberry will be powered on again if the button is pressed again or if the off interval is passed.
This is the functionality requested by a client so he can turn off his raspberry by pushing the button and turn it back on when push the button again.
I was looking at the WDT and I realize that is a little problem with the interrupt, is a hardware problem because the card keeps the interrupt pin low even if the interrupt is enabled or not. The workaround for this is to add about 2k pull-up to 3.3V and the pin is copy the button state.
The "pbe" is created for safe shutdown and then power only if the button is pressed again so the flow should look like this:
1) enable the button "wdt -pbe 1"
2) Wait for button to be pressed reading periodically the status "wdt -g pbs"
3) if the button is pressed change the off period to a higher number "wdt -off 10000"
4) set the period so the raspberry have te time to shutdown "wdt -p 120"
5) issue a shutdown command "sudo shutdown now"
6) The raspberry will be powered off.
7) The raspberry will be powered on again if the button is pressed again or if the off interval is passed.
This is the functionality requested by a client so he can turn off his raspberry by pushing the button and turn it back on when push the button again.