[shutdown] fix bugs
This commit is contained in:
parent
bf2b8c2625
commit
800724cb54
|
@ -2,6 +2,7 @@ from takway.board.base_hd import BaseHardware
|
|||
import threading
|
||||
from datetime import datetime
|
||||
import time
|
||||
import subprocess
|
||||
try:
|
||||
import wiringpi
|
||||
from wiringpi import GPIO
|
||||
|
@ -78,7 +79,6 @@ class OrangePi(BaseHardware):
|
|||
press_duration = (datetime.now() - press_time_1).total_seconds()
|
||||
# if press_duration > 0.01:
|
||||
if press_duration > 5:
|
||||
time.sleep(1) # 防止短按误触发
|
||||
subprocess.Popen('sudo shutdown now', shell=True)
|
||||
else:
|
||||
self.long_power_status = not self.long_power_status
|
||||
|
|
Loading…
Reference in New Issue