diff --git a/main.py b/main.py index 3f38585..45dea4d 100644 --- a/main.py +++ b/main.py @@ -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: