added support for test mode to the rest of the code
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4180 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/atom_code/input/FRCComm.h b/aos/atom_code/input/FRCComm.h
index 3d2f4c0..14c4602 100644
--- a/aos/atom_code/input/FRCComm.h
+++ b/aos/atom_code/input/FRCComm.h
@@ -26,10 +26,13 @@
UINT16 packetIndex;
union {
UINT8 control;
+ // The order of the bits has to be flipped on little-endian machines (aka
+ // everything other than the cRIO that we build for) in order for it to
+ // work. Upstream WPILib does this based off of a different macro.
+#ifndef __VXWORKS__
struct {
- /*the order of these are flipped on the fit pc side to make it work*/
- UINT8 fpgaChkSum :1;
- UINT8 cRIOChkSum :1;
+ UINT8 checkVersions :1;
+ UINT8 test :1;
UINT8 resync : 1;
UINT8 fmsAttached:1;
UINT8 autonomous : 1;
@@ -37,6 +40,18 @@
UINT8 notEStop : 1;
UINT8 reset : 1;
};
+#else
+ struct {
+ UINT8 reset : 1;
+ UINT8 notEStop : 1;
+ UINT8 enabled : 1;
+ UINT8 autonomous : 1;
+ UINT8 fmsAttached:1;
+ UINT8 resync : 1;
+ UINT8 test :1;
+ UINT8 checkVersions :1;
+ };
+#endif
};
UINT8 dsDigitalIn;
UINT16 teamID;
diff --git a/aos/atom_code/input/JoystickInput.cpp b/aos/atom_code/input/JoystickInput.cpp
index 6aeca4b..8b3bc44 100644
--- a/aos/atom_code/input/JoystickInput.cpp
+++ b/aos/atom_code/input/JoystickInput.cpp
@@ -18,7 +18,8 @@
buttons[0] |= (control_data_.enabled << (ENABLED - 9)) |
(control_data_.autonomous << (AUTONOMOUS - 9)) |
- (control_data_.fmsAttached << (FMS_ATTACHED - 9));
+ (control_data_.fmsAttached << (FMS_ATTACHED - 9)) |
+ (control_data_.test << (TEST_MODE - 9));
for (int j = 0; j < 4; ++j) {
for (int k = 1; k <= 12; ++k) {
@@ -36,6 +37,8 @@
if (NegEdge(0, AUTONOMOUS)) LOG(INFO, "NegEdge(AUTONOMOUS)\n");
if (PosEdge(0, FMS_ATTACHED)) LOG(INFO, "PosEdge(FMS_ATTACHED)\n");
if (NegEdge(0, FMS_ATTACHED)) LOG(INFO, "NegEdge(FMS_ATTACHED)\n");
+ if (PosEdge(0, TEST_MODE)) LOG(INFO, "PosEdge(TEST_MODE)\n");
+ if (NegEdge(0, TEST_MODE)) LOG(INFO, "NegEdge(TEST_MODE)\n");
}
void JoystickInput::Run() {
@@ -46,9 +49,12 @@
continue;
}
SetupButtons();
- if (!robot_state.MakeWithBuilder().enabled(Pressed(0, ENABLED)).
- autonomous(Pressed(0, AUTONOMOUS)).
- team_id(ntohs(control_data_.teamID)).Send()) {
+ if (!robot_state.MakeWithBuilder()
+ .enabled(Pressed(0, ENABLED))
+ .autonomous(Pressed(0, AUTONOMOUS))
+ .test_mode(Pressed(0, TEST_MODE))
+ .team_id(ntohs(control_data_.teamID))
+ .Send()) {
LOG(WARNING, "sending robot_state failed\n");
}
if (robot_state.FetchLatest()) {
diff --git a/aos/atom_code/input/JoystickInput.h b/aos/atom_code/input/JoystickInput.h
index de5de04..ddb0388 100644
--- a/aos/atom_code/input/JoystickInput.h
+++ b/aos/atom_code/input/JoystickInput.h
@@ -23,6 +23,7 @@
static const int ENABLED = 13;
static const int AUTONOMOUS = 14;
static const int FMS_ATTACHED = 15;
+ static const int TEST_MODE = 16;
bool Pressed(int stick, int button) {
return buttons[stick] & MASK(button);
}