|
|
|
@ -45,13 +45,12 @@ type Animation struct {
|
|
|
|
|
|
|
|
|
|
//flags from cmd line
|
|
|
|
|
var (
|
|
|
|
|
rows = flag.Int("led-rows", 64, "number of rows supported")
|
|
|
|
|
cols = flag.Int("led-cols", 64, "number of columns supported")
|
|
|
|
|
rows = flag.Int("led-rows", 32, "number of rows supported")
|
|
|
|
|
cols = flag.Int("led-cols", 32, "number of columns supported")
|
|
|
|
|
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
|
|
|
|
|
chain = flag.Int("led-chain", 1, "number of displays daisy-chained")
|
|
|
|
|
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
|
|
|
|
|
brightness = flag.Int("brightness", 100, "brightness (0-100)")
|
|
|
|
|
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
|
|
|
|
|
led_multiplexing = flag.Int("led-multiplexing", 1, "Multiplexing type.")
|
|
|
|
|
show_refresh = flag.Bool("led-show-refresh", false, "Show refresh rate.")
|
|
|
|
|
inverse_colors = flag.Bool("led-inverse", false, "Switch if your matrix has inverse colors on.")
|
|
|
|
|
disable_hardware_pulsing = flag.Bool("led-no-hardware-pulse", false, "Don't use hardware pin-pulse generation.")
|
|
|
|
@ -76,7 +75,7 @@ func listener(mqMessages chan mqtt.Message) {
|
|
|
|
|
//animator is a wrapping function for go routine that can receive an mq channel
|
|
|
|
|
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
|
//Playanimation comes from the toolkit, all it takes is an animation struct
|
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 64}, mqMessages))
|
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 32}, mqMessages))
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -145,7 +144,7 @@ func NewAnimation(sz image.Point, mqMessages chan mqtt.Message) *Animation {
|
|
|
|
|
func appendImage(img string, a *Animation) {
|
|
|
|
|
baseImage, _ := b64.StdEncoding.DecodeString(img)
|
|
|
|
|
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage))
|
|
|
|
|
a.image = append(a.image, imaging.Resize(bigImage, 64, 64, imaging.Lanczos))
|
|
|
|
|
a.image = append(a.image, imaging.Resize(bigImage, 32, 32, imaging.Lanczos))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// what happens each frame, at an interval of 50 milliseconds
|
|
|
|
@ -214,7 +213,6 @@ func main() {
|
|
|
|
|
config.ShowRefreshRate = *show_refresh
|
|
|
|
|
config.InverseColors = *inverse_colors
|
|
|
|
|
config.DisableHardwarePulsing = *disable_hardware_pulsing
|
|
|
|
|
config.LedMultiplexing = *led_multiplexing
|
|
|
|
|
setupMQTT()
|
|
|
|
|
|
|
|
|
|
m, err := rgbmatrix.NewRGBLedMatrix(config)
|
|
|
|
|