Skip to content

Commit

Permalink
Switch on row light when a new deployment is added. Closes #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
lreimer committed Apr 30, 2016
1 parent 028939b commit c5331c7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ open class LaunchpadController @Inject constructor(private val grid: ClusterNode
private val nodes: Event<ClusterNodeEvent>,
private val logger: Logger) {

private var activeRow = 0
private var activeRow = -1

/**
* Called when we have a button pressed event.
Expand Down Expand Up @@ -232,6 +232,10 @@ open class LaunchpadController @Inject constructor(private val grid: ClusterNode
open fun starting(@Observes @ClusterNodeEvent.Starting event: ClusterNodeEvent) {
val square = Square(event.row, event.column)
pulse(square, YELLOW)
if (grid.active(event.row) > 0 && (event.row != activeRow)) {
// switch on the light of this is the first node
light(Switch.ON, Button.right(event.row), PURPLE)
}
}

/**
Expand All @@ -243,7 +247,7 @@ open class LaunchpadController @Inject constructor(private val grid: ClusterNode
val square = Square(event.row, event.column)
light(Switch.ON, square, LIGHT_GREEN)
if (grid.active(event.row) > 0 && (event.row != activeRow)) {
// switch on the light of this was the last node
// switch on the light of this is the first node
light(Switch.ON, Button.right(event.row), PURPLE)
}
}
Expand Down

0 comments on commit c5331c7

Please sign in to comment.