|
|
@ -105,6 +105,9 @@ func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 32}, mqMessages))
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 32}, mqMessages))
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func onConnectionLostHandler(c MQTT.Client, reason error) {
|
|
|
|
|
|
|
|
log.Fatalf(reason.Error())
|
|
|
|
|
|
|
|
}
|
|
|
|
func setupMQTT() *mqtt.ClientOptions {
|
|
|
|
func setupMQTT() *mqtt.ClientOptions {
|
|
|
|
opts := MQTT.NewClientOptions()
|
|
|
|
opts := MQTT.NewClientOptions()
|
|
|
|
opts.AddBroker(fmt.Sprintf("tcp://%s:%s", os.Getenv("MQTTBROKER"), os.Getenv("MQTTPORT")))
|
|
|
|
opts.AddBroker(fmt.Sprintf("tcp://%s:%s", os.Getenv("MQTTBROKER"), os.Getenv("MQTTPORT")))
|
|
|
@ -112,6 +115,7 @@ func setupMQTT() *mqtt.ClientOptions {
|
|
|
|
opts.SetPassword(os.Getenv("MQTTPASSWORD"))
|
|
|
|
opts.SetPassword(os.Getenv("MQTTPASSWORD"))
|
|
|
|
opts.SetClientID("rgbboard")
|
|
|
|
opts.SetClientID("rgbboard")
|
|
|
|
opts.SetAutoReconnect(true)
|
|
|
|
opts.SetAutoReconnect(true)
|
|
|
|
|
|
|
|
opts.SetConnectionLostHandler(onConnectionLostHandler)
|
|
|
|
|
|
|
|
|
|
|
|
return opts
|
|
|
|
return opts
|
|
|
|
}
|
|
|
|
}
|
|
|
|