diff --git a/main.go b/main.go index 5622487..9abac3f 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,8 @@ type Animation struct { stroke int image []image.Image updown int - msg chan mqtt.Message + mqmsg chan mqtt.Message + msg string } var ( @@ -156,7 +157,7 @@ func NewAnimation(sz image.Point, mqMessages chan mqtt.Message) *Animation { stroke: 8, image: images, updown: 0, - msg: mqMessages, + mqmsg: mqMessages, } } @@ -171,10 +172,11 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) { } a.ctx.SetColor(color.White) select { - case msg := <-a.msg: - a.ctx.DrawString(string(msg.Payload()), 5, 9) + case msg := <-a.mqmsg: + a.msg = string(msg.Payload()) default: } + a.ctx.DrawString(a.msg, 5, 9) return a.ctx.Image(), time.After(time.Millisecond * 50), nil }