@@ -20,17 +20,13 @@ public class MockedCANCoder {
2020 private int port ;
2121 private SimDevice device ;
2222 private SimDouble position ; // Rotations - Continuous
23- private SimDouble motorId ;
24- private SimDouble motorType ;
2523 private SimDouble gearing ;
2624 private CANCoderSimCollection sim ;
2725
2826 public MockedCANCoder (CANCoder canCoder ) {
2927 port = canCoder .getDeviceID ();
3028 device = SimDevice .create ("CANCoder" , port );
3129 position = device .createDouble ("count" , Direction .kInput , 0 );
32- motorId = device .createDouble ("motorId" , Direction .kOutput , -1 );
33- motorType = device .createDouble ("motorType" , Direction .kOutput , MotorType .NONE .id );
3430 gearing = device .createDouble ("gearing" , Direction .kOutput , 1 );
3531 sim = canCoder .getSimCollection ();
3632 Lib199Subsystem .registerPeriodic (this ::update );
@@ -41,24 +37,12 @@ public void update() {
4137 sim .setRawPosition ((int ) (position .get () * kCANCoderCPR ));
4238 }
4339
44- public void linkMotor (int motorId , MotorType motorType , double gearing ) {
45- this .motorId .set (motorId );
46- this .motorType .set (motorType .id );
40+ public void setGearing (double gearing ) {
4741 this .gearing .set (gearing );
4842 }
4943
50- public static void linkMotor (int canCoderPort , int motorId , MotorType motorType , double gearing ) {
51- if (sims .containsKey (canCoderPort )) sims .get (canCoderPort ).linkMotor (motorId , motorType , gearing );
52- }
53-
54- public static enum MotorType {
55- NONE (0 ), TALON (1 ), VICTOR (2 ), SPARKMAX (3 );
56-
57- public final int id ;
58-
59- private MotorType (int id ) {
60- this .id = id ;
61- }
44+ public static void setGearing (int port , double gearing ) {
45+ if (sims .containsKey (port )) sims .get (port ).setGearing (gearing );
6246 }
6347
6448}
0 commit comments