Skip to content

Commit ca6ac5f

Browse files
authored
Update boot.py
Prevent middle button from playing cd when trying to power off
1 parent 94931fe commit ca6ac5f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

boot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,18 @@ def pause():
314314
case 1:
315315
command = 2
316316
def middle():
317-
global command, start
317+
global start
318318
start = time.time()
319-
command = -1
320319

321320
def shutdown():
322-
global start
321+
global start, command
323322
end = time.time()
324323
if(end-start>2):
325324
lcd.clear()
326325
lcd.message="Goodbye"
327326
check_call(['sudo', 'poweroff'])
327+
else:
328+
command = -1
328329

329330
Button_up.when_pressed = pause
330331
Button_left.when_pressed = back

0 commit comments

Comments
 (0)