Skip to content

Commit

Permalink
Add warnings if CAN ID is greater than 40.
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Nov 10, 2023
1 parent cd65f01 commit 1ef2b16
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/swervelib/parser/json/DeviceJson.java
Original file line number Diff line number Diff line change
@@ -53,6 +53,11 @@ public class DeviceJson
*/
public SwerveAbsoluteEncoder createEncoder(SwerveMotor motor)
{
if (id > 40)
{
DriverStation.reportWarning("CAN IDs greater than 40 can cause undefined behaviour, please use a CAN ID below 40!",
false);
}
switch (type)
{
case "none":
@@ -87,6 +92,11 @@ public SwerveAbsoluteEncoder createEncoder(SwerveMotor motor)
*/
public SwerveIMU createIMU()
{
if (id > 40)
{
DriverStation.reportWarning("CAN IDs greater than 40 can cause undefined behaviour, please use a CAN ID below 40!",
false);
}
switch (type)
{
case "adis16448":
@@ -130,6 +140,11 @@ public SwerveIMU createIMU()
*/
public SwerveMotor createMotor(boolean isDriveMotor)
{
if (id > 40)
{
DriverStation.reportWarning("CAN IDs greater than 40 can cause undefined behaviour, please use a CAN ID below 40!",
false);
}
switch (type)
{
case "sparkmax_brushed":

0 comments on commit 1ef2b16

Please sign in to comment.