removed saving system
parent
ee2c0af90e
commit
f0092b3962
10
main.py
10
main.py
|
@ -4,7 +4,6 @@ from rpi_ws281x import *
|
||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
current_path = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
led_power = 'True'
|
led_power = 'True'
|
||||||
idle_mode = 1
|
idle_mode = 1
|
||||||
|
@ -75,10 +74,6 @@ def change_idle_mode(channel):
|
||||||
if idle_mode == 8:
|
if idle_mode == 8:
|
||||||
idle_mode = 1
|
idle_mode = 1
|
||||||
debug_print('Change Idlemode executed')
|
debug_print('Change Idlemode executed')
|
||||||
with open(current_path+'/settings.txt', 'w') as f:
|
|
||||||
f.write(str(idle_mode))
|
|
||||||
debug_print('Saved idle mode')
|
|
||||||
|
|
||||||
|
|
||||||
def power_toggle(channel):
|
def power_toggle(channel):
|
||||||
global power_button_pressed
|
global power_button_pressed
|
||||||
|
@ -93,11 +88,6 @@ if __name__ == '__main__':
|
||||||
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
GPIO.add_event_detect(13, GPIO.RISING, callback=power_toggle, bouncetime=300)
|
GPIO.add_event_detect(13, GPIO.RISING, callback=power_toggle, bouncetime=300)
|
||||||
GPIO.add_event_detect(19, GPIO.RISING, callback=change_idle_mode, bouncetime=300)
|
GPIO.add_event_detect(19, GPIO.RISING, callback=change_idle_mode, bouncetime=300)
|
||||||
try:
|
|
||||||
with open(current_path+'/settings.txt', 'r') as f:
|
|
||||||
idle_mode = int(f.readlines())
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue