at the buckeye regional I discovered a bug in our code, and sat up half the night in my hotel room looking at it. I finally concluded my code MUST be correct and the documentation must be wrong
testing in the pit the next day confirmed the documenation is wrong.
Im talking about the bit that tells you if the robot is disabled (before the match starts) or enabled: competition_mode
the documenation from IFI says :
Competition Mode Bit 7 of rc_mode_byte (aliased as competition_mode below) indicates the status of the Competition Control, either Enabled or Disabled. This indicates the starting and stopping of rounds at the competitions. Competition Mode is indicated by a solid “Disabled” LED on the Operator Interface.
When Disabled, all PWM and Relay outputs are disabled, but program execution continues. competition_mode = 1 for Enabled, 0 for Disabled. (copied from the FRC 2004 Reference Guide)
in actual testing when the robot is enabled this bit is 0 - when disabled its 1
there was a post by “Wizard of Az” talking about this, but he only seemed to indicate that the name of the variable was confusing - he did correctly state that 1=disabled, but did not mention that the documentation IS WRONG.
we use a yaw rate sensor and to detemine the zero reading we average the input over 32 SW loops when disabled, and continue to do so as long as we are disabled. The only thing that kept our code working was the fact that autom mode is a while loop, so our averaging code was not running during auton mode
but it was running when the driver closed the loop on the yaw rate sensor in normal driver mode - our driver had been complaining that it didnt seem to be working right, but I thought he just wasnt use to it. We had done the original testing with the zero point hard coded = 141, and added the averaging while disabled code later.
If anyone is using the competition_mode bit to initailze variables or start timers or initailze state machines before the bot is enabled, go back and check your code - this SW documentation error caused me hours of grief (trying to figure out why my code was changing the gyro zeropoint while the bot was enabled - we output the zero average to the user_mode display on the OI - so I could see something was rotten in Cleveland :^)