mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-19 11:52:12 +08:00
Update shutdownd logic - reported by loveloveses@wechat
This commit is contained in:
@@ -10,6 +10,7 @@ def main(gctx=None):
|
||||
shutdown_count = 0
|
||||
auto_shutdown_at = get_shutdown_val()
|
||||
frame = 0
|
||||
last_shutdown_val = get_shutdown_val()
|
||||
|
||||
while 1:
|
||||
with open("/sys/class/power_supply/usb/present") as f:
|
||||
@@ -23,6 +24,10 @@ def main(gctx=None):
|
||||
else:
|
||||
shutdown_count = 0
|
||||
|
||||
if not last_shutdown_val == auto_shutdown_at:
|
||||
shutdown_count = 0
|
||||
last_shutdown_val = auto_shutdown_at
|
||||
|
||||
if auto_shutdown_at is None:
|
||||
auto_shutdown_at = get_shutdown_val()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user