Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawinganimal committed Dec 24, 2019
2 parents e63cb05 + 4116070 commit c4b0812
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,28 @@ class MotorController<T : MotorId>(
}

fun eachFollower(configure: MotorController<*>.() -> Unit) {
followers.forEach { it.value.apply(configure) }
followers.forEach {
it.value.apply(configure)
}
}

fun eachTalon(configure: MotorController<TalonId>.() -> Unit) {
eachMotor {
@Suppress("unchecked_cast") // Will work because type of id is T
if (id is TalonId) (this as MotorController<TalonId>).apply(configure)
if (id is TalonId) {
(this as MotorController<TalonId>).apply(configure)
Unit
}
}
}

fun eachVictor(configure: MotorController<VictorId>.() -> Unit) {
eachMotor {
@Suppress("unchecked_cast") // Will work because type of id is T
if (id is VictorId) (this as MotorController<VictorId>).apply(configure)
if (id is VictorId) {
(this as MotorController<VictorId>).apply(configure)
Unit
}
}
}

Expand Down Expand Up @@ -244,9 +252,6 @@ class MotorController<T : MotorId>(
}
updateCurrentLimit(currentLimit)
}
eachMotor {
ctreMotorController.setNeutralMode(ctreNeutralMode(brakeMode))
}
configure()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ class TableEntry<T>(val name: String, initialValue: T, val location: List<String
wpiProperty.setValue(value)
}
}

fun groundControlToMajorTom() = Unit

0 comments on commit c4b0812

Please sign in to comment.