Hook LED modes up to field state.

This commit is contained in:
Patrick Fairbank
2018-07-21 22:28:22 -07:00
parent 5f457f96ec
commit 738b5a0e7b
11 changed files with 206 additions and 109 deletions

View File

@@ -45,10 +45,14 @@ func (controller *Controller) SetAddress(address string) error {
// Sets the current LED sequence mode and resets the intra-sequence counter to the beginning.
func (controller *Controller) SetMode(nearMode, farMode Mode) {
controller.nearStrip.currentMode = nearMode
controller.nearStrip.counter = 0
controller.farStrip.currentMode = farMode
controller.farStrip.counter = 0
if nearMode != controller.nearStrip.currentMode {
controller.nearStrip.currentMode = nearMode
controller.nearStrip.counter = 0
}
if farMode != controller.farStrip.currentMode {
controller.farStrip.currentMode = farMode
controller.farStrip.counter = 0
}
}
// Returns the current mode if both sides are in the same mode, or off otherwise.