removed animation

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-12-27 23:48:53 +01:00
parent c37e129862
commit 42b18eab5f
1 changed files with 0 additions and 37 deletions

37
main.py
View File

@ -32,34 +32,6 @@ def debug_print(message: str):
current_time = now.strftime("%H:%M:%S")
print('[DEBUG]['+current_time+'] '+message)
def fade_in_animation(strip, mode, color):
if mode == 0:
for i in range(strip.numPixels()):
strip.setPixelColor(i, wheel((int(i * 256 / strip.numPixels())) & 255))
strip.show()
elif mode == 1:
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
strip.show()
time.sleep(float(0.01))
elif mode == 2:
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
strip.show()
time.sleep(float(0.01))
elif mode == 3:
color = Color(randint(0, 255), randint(0, 255), randint(0, 255))
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
strip.show()
time.sleep(float(0.01))
time.sleep(1)
elif mode == 4:
for i in range(strip.numPixels()):
strip.setPixelColor(i, Color(randint(0, 255), randint(0, 255), randint(0, 255)))
strip.show()
time.sleep(1)
def wheel(pos):
if pos < 85:
return Color(pos * 3, 255 - pos * 3, 0)
@ -126,8 +98,6 @@ def mqtt_on_connect(client, userdata, flags, rc):
if __name__ == '__main__':
global singleExecute
singleExecute = True
def mqtt_on_message(client, userdata, msg):
print("topic: " ,str(msg.topic))
print("payload: " ,str(msg.payload.decode("utf-8")))
@ -137,8 +107,6 @@ if __name__ == '__main__':
client.publish("server-rack-led/power/status", str(payload))
global power
power = payload
global singleExecute
singleExecute = True
elif topic == "server-rack-led/rgb":
client.publish("server-rack-led/rgb/status", str(payload))
@ -198,9 +166,6 @@ if __name__ == '__main__':
while True:
if power == "True":
client.publish("server-rack-led/power/status", "True")
if singleExecute == True:
fade_in_animation(strip, mode, Color(int(r), int(g), int(b)))
singleExecute = False
if mode == 0:
rainbowCycle(strip)
@ -222,8 +187,6 @@ if __name__ == '__main__':
client.publish("server-rack-led/mode/status", "Color fade-in")
else:
client.publish("server-rack-led/power/status", "False")
if singleExecute == True:
singleExecute = False
setColor(strip, Color(0,0,0))
except KeyboardInterrupt: