fix tabs
This commit is contained in:
parent
51d6fe3698
commit
29b04c7d00
|
@ -16,8 +16,8 @@ class Controller:
|
||||||
def __init__(self, base_topic, mqtt_host, mqtt_port = 1883):
|
def __init__(self, base_topic, mqtt_host, mqtt_port = 1883):
|
||||||
|
|
||||||
self.scroll_interval = 0.25
|
self.scroll_interval = 0.25
|
||||||
self.text = ""
|
self.text = ""
|
||||||
self.poscount = 0
|
self.poscount = 0
|
||||||
|
|
||||||
# Create the I2C interface.
|
# Create the I2C interface.
|
||||||
self.i2c = busio.I2C(board.SCL, board.SDA)
|
self.i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
|
@ -49,29 +49,27 @@ class Controller:
|
||||||
print("msg = " + msg)
|
print("msg = " + msg)
|
||||||
|
|
||||||
if message.topic.endswith(__TOPIC_BRIGHTNESS__ + "/set"):
|
if message.topic.endswith(__TOPIC_BRIGHTNESS__ + "/set"):
|
||||||
val = float(msg)
|
val = float(msg)
|
||||||
if val >= 0.0 and val <=1.0:
|
if val >= 0.0 and val <=1.0:
|
||||||
self.display.brightness = val
|
self.display.brightness = val
|
||||||
print("changed brightness to ", self.display.brightness)
|
print("changed brightness to ", self.display.brightness)
|
||||||
self.mqtt.publish(self.topic + "/" + __TOPIC_BRIGHTNESS__, self.display.brightness, 1 )
|
self.mqtt.publish(self.topic + "/" + __TOPIC_BRIGHTNESS__, self.display.brightness, 1 )
|
||||||
else:
|
else:
|
||||||
print("invalid brightness ", val)
|
print("invalid brightness ", val)
|
||||||
|
|
||||||
if message.topic.endswith(__TOPIC_SCROLL_INTERVAL__ + "/set"):
|
if message.topic.endswith(__TOPIC_SCROLL_INTERVAL__ + "/set"):
|
||||||
val = float(msg)
|
val = float(msg)
|
||||||
if val > 0.0:
|
if val > 0.0:
|
||||||
self.scroll_interval = val
|
self.scroll_interval = val
|
||||||
print("changed scroll_interval to ", self.scroll_interval)
|
print("changed scroll_interval to ", self.scroll_interval)
|
||||||
self.mqtt.publish(self.topic + "/" + __TOPIC_SCROLL_INTERVAL__, self.scroll_interval, 1 )
|
self.mqtt.publish(self.topic + "/" + __TOPIC_SCROLL_INTERVAL__, self.scroll_interval, 1 )
|
||||||
else:
|
else:
|
||||||
print("error not >0.0: ", val)
|
print("error not >0.0: ", val)
|
||||||
|
|
||||||
|
|
||||||
|
if message.topic.endswith(__TOPIC_TEXT__ + "/set"):
|
||||||
|
|
||||||
if message.topic.endswith(__TOPIC_TEXT__ + "/set"):
|
|
||||||
self.text = msg
|
self.text = msg
|
||||||
print("changed text to ", self.text)
|
print("changed text to ", self.text)
|
||||||
self.mqtt.publish(self.topic + "/" + __TOPIC_TEXT__, self.text, 1 )
|
self.mqtt.publish(self.topic + "/" + __TOPIC_TEXT__, self.text, 1 )
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +89,7 @@ class Controller:
|
||||||
|
|
||||||
self.display.print(self.text[poscount])
|
self.display.print(self.text[poscount])
|
||||||
poscount += 1
|
poscount += 1
|
||||||
poscount %= len(self.text)
|
poscount %= len(self.text)
|
||||||
time.sleep(self.scroll_interval)
|
time.sleep(self.scroll_interval)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue