removed animation

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-02 10:22:04 +02:00
parent 5024761a27
commit a75b2e15d9
1 changed files with 4 additions and 8 deletions

12
main.py
View File

@ -29,7 +29,7 @@ def debug_print(message: str):
current_time = now.strftime("%H:%M:%S")
print('[DEBUG]['+current_time+'] '+message)
def wheel(pos):
def wheel(client, pos):
if pos < 85:
return Color(pos * 3, 255 - pos * 3, 0)
elif pos < 170:
@ -39,14 +39,14 @@ def wheel(pos):
pos -= 170
return Color(0, pos * 3, 255 - pos * 3)
def rainbowCycle(strip, wait_ms=5, iterations=10):
def rainbowCycle(client, strip, wait_ms=5, iterations=10):
for j in range(256*iterations):
if mode > 0:
break
elif power == "False":
break
for i in range(strip.numPixels()):
strip.setPixelColor(i, wheel((int(i * 256 / strip.numPixels()) + j) & 255))
strip.setPixelColor(i, wheel(client, (int(i * 256 / strip.numPixels()) + j) & 255))
strip.show()
time.sleep(wait_ms/1000.0)
@ -117,11 +117,7 @@ if __name__ == '__main__':
while True:
if power == "True":
if mode == 0:
rainbowCycle(strip)
animation_r = 255
animation_g = 0
animation_b = 0
client.publish("server-rack-led/rgb", str(animation_r)+","+str(animation_g)+","+str(animation_b))
rainbowCycle(client, strip)
elif mode == 1:
setColor(strip, Color(int(r), int(g), int(b)))
time.sleep(1)