[shutdown] fix bugs
This commit is contained in:
1 parent
bf2b8c2625
commit
800724cb54
1 file changed
+1
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user