📅  最后修改于: 2023-12-03 15:29:27.953000             🧑  作者: Mango
Argon One is a high-quality aluminum case for Raspberry Pi 4 that comes with a built-in power button script. The power button script allows users to safely shut down and power on their Raspberry Pi 4 with a simple press of a button.
The installation process for the Argon One Power Button script is quite easy. Here are the steps:
git clone https://github.com/Argon40Tech/argon1-powerbutton.git
argon1-powerbutton
directory:cd argon1-powerbutton
sudo ./install.sh
sudo reboot
You can modify the Argon One Power Button script to suit your needs. Here are some of the modifications you can make:
To modify the script, navigate to the argon1-powerbutton
directory and open the argononed.py
file using your preferred text editor. Here's an example of how to change the shutdown delay time:
# shutdown function
def shutdown():
global hold_time
if hold_time >= SHUTDOWN_TIME:
subprocess.call(['sudo', 'poweroff'])
else:
if hold_time == 0:
os.system("sudo shutdown -c")
message = "Hold for %d more seconds to shutdown" % (SHUTDOWN_TIME-hold_time)
blink_led(RED, 0.2, 3)
logger.info(message)
print(message)
hold_time = 0
os.system("sudo shutdown -c")
SHUTDOWN_TIME
to your desired delay time. For example, change it to 10 seconds:SHUTDOWN_TIME = 10
sudo systemctl restart argononed.service
The Argon One Power Button script is a convenient tool that allows Raspberry Pi 4 users to safely shut down and power on their system with ease. The installation process is straightforward, and the script can be easily modified to suit your needs. Give it a try and enjoy the benefits!