Added blink() function, and called it when message receive, and when the face is loaded.

This commit is contained in:
CiscoTheWolf 2023-05-23 22:15:38 +02:00
parent a83da2c004
commit aa6ef89745

View file

@ -55,6 +55,9 @@ class ProotState:
return self.current_blink_state return self.current_blink_state
def blink(self):
self.set_desired_blink_state(10)
def set_desired_blink_state(self, state: int): def set_desired_blink_state(self, state: int):
self.desired_blink_state = state self.desired_blink_state = state
@ -289,8 +292,8 @@ endT = curr_time = round(time.time()*1000)
print("populating matrices for each blink frame took: " + str(endT - startT) + " ms") print("populating matrices for each blink frame took: " + str(endT - startT) + " ms")
proot_state = ProotState() proot_state = ProotState()
proot_state.set_blinks_frames_ready(True) proot_state.set_blinks_frames_ready(True)
proot_state.blink()
@ -304,7 +307,7 @@ def on_message(client, userdata, message):
print("Received message '" + str(message.payload) + "' on topic '" print("Received message '" + str(message.payload) + "' on topic '"
+ message.topic + "' with QoS " + str(message.qos)) + message.topic + "' with QoS " + str(message.qos))
proot_state = ProotState() proot_state = ProotState()
proot_state.set_desired_blink_state(10) proot_state.blink()
# MQTT broker configuration # MQTT broker configuration
broker_address = "10.1.13.173" # Replace with your MQTT broker's address broker_address = "10.1.13.173" # Replace with your MQTT broker's address