This commit is contained in:
10
main.go
10
main.go
@@ -28,7 +28,8 @@ type Animation struct {
|
|||||||
stroke int
|
stroke int
|
||||||
image []image.Image
|
image []image.Image
|
||||||
updown int
|
updown int
|
||||||
msg chan mqtt.Message
|
mqmsg chan mqtt.Message
|
||||||
|
msg string
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -156,7 +157,7 @@ func NewAnimation(sz image.Point, mqMessages chan mqtt.Message) *Animation {
|
|||||||
stroke: 8,
|
stroke: 8,
|
||||||
image: images,
|
image: images,
|
||||||
updown: 0,
|
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)
|
a.ctx.SetColor(color.White)
|
||||||
select {
|
select {
|
||||||
case msg := <-a.msg:
|
case msg := <-a.mqmsg:
|
||||||
a.ctx.DrawString(string(msg.Payload()), 5, 9)
|
a.msg = string(msg.Payload())
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
a.ctx.DrawString(a.msg, 5, 9)
|
||||||
return a.ctx.Image(), time.After(time.Millisecond * 50), nil
|
return a.ctx.Image(), time.After(time.Millisecond * 50), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user