|
|
@ -45,13 +45,12 @@ type Animation struct {
|
|
|
|
|
|
|
|
|
|
|
|
//flags from cmd line
|
|
|
|
//flags from cmd line
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
rows = flag.Int("led-rows", 64, "number of rows supported")
|
|
|
|
rows = flag.Int("led-rows", 32, "number of rows supported")
|
|
|
|
cols = flag.Int("led-cols", 64, "number of columns supported")
|
|
|
|
cols = flag.Int("led-cols", 32, "number of columns supported")
|
|
|
|
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
|
|
|
|
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)")
|
|
|
|
brightness = flag.Int("brightness", 100, "brightness (0-100)")
|
|
|
|
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
|
|
|
|
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.")
|
|
|
|
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.")
|
|
|
|
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.")
|
|
|
|
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
|
|
|
|
//animator is a wrapping function for go routine that can receive an mq channel
|
|
|
|
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
//Playanimation comes from the toolkit, all it takes is an animation struct
|
|
|
|
//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) {
|
|
|
|
func appendImage(img string, a *Animation) {
|
|
|
|
baseImage, _ := b64.StdEncoding.DecodeString(img)
|
|
|
|
baseImage, _ := b64.StdEncoding.DecodeString(img)
|
|
|
|
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage))
|
|
|
|
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
|
|
|
|
// what happens each frame, at an interval of 50 milliseconds
|
|
|
@ -214,7 +213,6 @@ func main() {
|
|
|
|
config.ShowRefreshRate = *show_refresh
|
|
|
|
config.ShowRefreshRate = *show_refresh
|
|
|
|
config.InverseColors = *inverse_colors
|
|
|
|
config.InverseColors = *inverse_colors
|
|
|
|
config.DisableHardwarePulsing = *disable_hardware_pulsing
|
|
|
|
config.DisableHardwarePulsing = *disable_hardware_pulsing
|
|
|
|
config.LedMultiplexing = *led_multiplexing
|
|
|
|
|
|
|
|
setupMQTT()
|
|
|
|
setupMQTT()
|
|
|
|
|
|
|
|
|
|
|
|
m, err := rgbmatrix.NewRGBLedMatrix(config)
|
|
|
|
m, err := rgbmatrix.NewRGBLedMatrix(config)
|
|
|
|