Skip to content

Commit

Permalink
Merge pull request #52 from DeepBlueRobotics/workaround-wpilib-bug-wi…
Browse files Browse the repository at this point in the history
…th-SimDevice-SimBooleans-sent-over-HALSimWS

Accept 1 and 0 instead of true and false for booleans to workaround wpilibsuite/allwpilib#6835.
  • Loading branch information
brettle committed Jul 14, 2024
2 parents af684b3 + acaac31 commit c4e5638
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/carlmontrobotics/wpiws/StateDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public static <T> void filterMessageAndIgnoreRobotState(Object receivedObject, C
((BiConsumer<Integer, Boolean>)robotStateProcessor).accept(bd.intValue(), false);
} else if (requestedType == Double.class) {
((BiConsumer<Double, Boolean>)robotStateProcessor).accept(bd.doubleValue(), false);
} else if (requestedType == Boolean.class) {
// Workaround for https://github.com/wpilibsuite/allwpilib/issues/6835
((BiConsumer<Boolean, Boolean>) robotStateProcessor)
.accept(bd.intValue() != 0, false);
} else {
isInvalidValue = true;
}
Expand Down

0 comments on commit c4e5638

Please sign in to comment.