fixed errors caused by code restructure
This commit is contained in:
parent
282c3f3a39
commit
f71718c5aa
@ -1,3 +1,7 @@
|
||||
import sys
|
||||
import time
|
||||
import ws2801
|
||||
|
||||
def color_cycle(speed):
|
||||
if int(speed) == 0:
|
||||
delay = 0
|
||||
@ -11,20 +15,20 @@ def color_cycle(speed):
|
||||
while r > 0:
|
||||
r = r-1
|
||||
g = g+1
|
||||
set_color(r,g,b)
|
||||
ws2801.set_color(r,g,b)
|
||||
time.sleep(delay)
|
||||
while g > 0:
|
||||
g = g-1
|
||||
b = b+1
|
||||
set_color(r,g,b)
|
||||
ws2801.set_color(r,g,b)
|
||||
time.sleep(delay)
|
||||
while b > 0:
|
||||
b = b-1
|
||||
r = r+1
|
||||
set_color(r,g,b)
|
||||
ws2801.set_color(r,g,b)
|
||||
time.sleep(delay)
|
||||
|
||||
def visualizer():
|
||||
for volume in sys.stdin:
|
||||
volume = int(volume)
|
||||
set_color(volume,0,0)
|
||||
ws2801.set_color(volume,0,0)
|
||||
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import getopt
|
||||
import time
|
||||
|
||||
import "ws2801"
|
||||
import "server"
|
||||
import ws2801
|
||||
import server
|
||||
import color_mode
|
||||
|
||||
def helpmenu():
|
||||
print("Options:")
|
||||
@ -15,7 +15,7 @@ def helpmenu():
|
||||
def main(argv):
|
||||
|
||||
if not sys.stdin.isatty():
|
||||
visualizer()
|
||||
color_mode.visualizer()
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
@ -30,13 +30,13 @@ def main(argv):
|
||||
helpmenu()
|
||||
sys.exit()
|
||||
elif opt == "-s":
|
||||
r,g,b = hex_to_rgb(arg)
|
||||
set_color(r,g,b)
|
||||
r,g,b = ws2801.hex_to_rgb(arg)
|
||||
ws2801.set_color(r,g,b)
|
||||
sys.exit()
|
||||
elif opt == "-c":
|
||||
color_cycle(arg)
|
||||
color_mode.color_cycle(arg)
|
||||
elif opt == "-d":
|
||||
start_server()
|
||||
server.start()
|
||||
|
||||
helpmenu()
|
||||
sys.exit()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user