Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d3b3fbf7b | |||
| 6e27fc641b | |||
| 66d55c15de |
@@ -60,7 +60,7 @@ var DefaultConfig = HardwareConfig{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RunTimeConfig struct {
|
type RunTimeConfig struct {
|
||||||
gpio_slowdown int
|
Gpio_slowdown int
|
||||||
}
|
}
|
||||||
|
|
||||||
// HardwareConfig rgb-led-matrix configuration
|
// HardwareConfig rgb-led-matrix configuration
|
||||||
@@ -110,7 +110,7 @@ func (c *HardwareConfig) geometry() (width, height int) {
|
|||||||
|
|
||||||
func (c *RunTimeConfig) rt_options() *C.struct_RGBLedRuntimeOptions {
|
func (c *RunTimeConfig) rt_options() *C.struct_RGBLedRuntimeOptions {
|
||||||
rt := &C.struct_RGBLedRuntimeOptions{}
|
rt := &C.struct_RGBLedRuntimeOptions{}
|
||||||
rt.gpio_slowdown = C.int(c.gpio_slowdown)
|
rt.gpio_slowdown = C.int(c.Gpio_slowdown)
|
||||||
|
|
||||||
return rt
|
return rt
|
||||||
}
|
}
|
||||||
|
|||||||
30
toolkit.go
30
toolkit.go
@@ -64,7 +64,6 @@ func (tk *ToolKit) PlayAnimation(a Animation) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -72,6 +71,35 @@ func (tk *ToolKit) PlayAnimation(a Animation) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tk *ToolKit) PlayAnimationUntil(a Animation, notify <-chan bool) error {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
var i image.Image
|
||||||
|
var n <-chan time.Time
|
||||||
|
var outerError error
|
||||||
|
for outerError == nil {
|
||||||
|
select {
|
||||||
|
case <-notify:
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
i, n, err = a.Next()
|
||||||
|
if err != nil {
|
||||||
|
outerError = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err := tk.PlayImageUntil(i, n); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if outerError == io.EOF {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// PlayImageUntil draws the given image until is notified to stop
|
// PlayImageUntil draws the given image until is notified to stop
|
||||||
func (tk *ToolKit) PlayImageUntil(i image.Image, notify <-chan time.Time) error {
|
func (tk *ToolKit) PlayImageUntil(i image.Image, notify <-chan time.Time) error {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user