nice
rgb/pipeline/head This commit looks good Details

pull/3/head
Nathan 2 years ago
parent 527f89d86c
commit 4be0d5e009

@ -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
}

Loading…
Cancel
Save