Roboclaw Firmware Changes:
//Removed leaky integrator in Velocity PID controller
//Added back calculation for integral windup in Velocity PID controller
//Swapped Temp and Temp2 signals on dual sensor models to match associated motor channel
//Changed Current Sense Blanking in Sign Magnitude PWM mode
//Changed A/D sample Phase/Offset model
//Changed User current filtering to a 256 sample window(12.8ms update rate)
//Added Read and Write EEPROM commands(256x16bits).
//Current Control method revision
//Bridged mode consolidation
//Dir setting for motor and encoder channels
//Added Roboclaw 2x60A V5D
//Adjusted Deadtime on Roboclaw 2x45A
//Fixed Auto home when using RC/Analog mode
//Added invert option for S3/S4/S5 input pin functions
//S3/S4/S5 bitmask changed slightly to accomodate invert option for input modes.
//Some models motor directions may have changed due to an update to the internal PWM handler.
//Fixed an auto homing issue.
//Added auto homing power/velocity and timeout settings
//Sign magnitude now default setting for newer Roboclaw models
//Disabled braking on over voltage warning when using voltage clamp(assumes voltage clamp will handle regen disipation).
//S3/S4/S5 input pin settings changed to bitmask
//Added Default Deceleration setting
//Added Forward/Reverse Limit support
//Added Forward Limit/Reverse Home support
//Fixed power up Home switch state(now reads the initial state if HOME/Manual Home is enabeld
//Home/Limit switch now supports on the fly changes
//Fixed short PWM glitch on power up
//Resets internal position counter when encoder is reset(fixes position movement glitches after Encoder Reset)
//Fixed sign magnitude on HV units
//Adjusted deadtime on MC5,7,15,30,60
//Fixed invalid conditional in MC120-160 A/D sample timer
//Fixed Set/Zero Encoders
//Added RC Encoder Mode selection Option using RC/TTL signal on S3
//Adjusted RC/Analog deadband filtering
//Changed A/D sampling to prevent PWM noise
//Added GetDefaultAccel commands
//Changed RC/Analog w/ Encoder modes to use DefaultAccel for Accel/Deccel
//Added MC60A V5
//Disabled Sign Magnitude mode on HV models
//Fixed power on zero position movement in RC w/ Encoder mode.
//Adjusted RC/Analog controlled Velocity and Position Control functions
//Fixed Sync Motor option in Position Settings window
//Adjusted auto tuner loop
//Changed currentpos reset to only execute when not running a position command(prevents hickups when running override position commands.
//Fixed an analog mode powerup calibration issue
//Added Roboclaw 2x7A
//Fixed MixedSpeedAccel/MixedSpeedAccelDistamce accel arguments.
//S3 mode setting on power up is now loaded correctly. Wasn't getting set until a second ReadNVM or manually set.
//Changed Position accel/deccel handler to take into account existing motion when a new command is executed.
//Added responsiveness slider to Autotuner. After autotuning the slider can be used to easily adjust the tuned settings for responsiveness(until IonMotion is restarted or the Autotune mode is changed(eg from PD to PID to PIV).
//Removed PID setting commands from python examples. We recommend you etup the Roboclaw and save the settings to the board before usign the examples. Having default values make customers assume those values would work well with any motors.
//Added support for multiple attached roboclaws in IonMotion.
//Adjusted switching DEADTIME for Roboclaw 2x60A boards.
//Changed communication checksum to CRC-CCITT(CRC16 xmodem, polynomial 0x1021). see manual.
//ACK is now mandatory on write only commands. see manual.
//Home signal falling edge triggers motor stop and encoder zero
//Added manual homing option, does not automatically home on start. User must move motor until home signal is triggered top zero encoders
//Fixed unsigned value underflow in Analog filter function
//Changed E-Stop to OR instead of AND when using multiple E-Stop inputs. Note if any signal is a Latching E-STOP all E-STOPs are latching E-STOPs.
//Added option to swap encoder channels
//Added Home signal states to status word(see updated manual)
//Added open drain enable for S2(multi-unit mode)
//Added adjustable +(forward) and -(backward) deadbands for Rc/Analog modes
//Fixed a hardware reset bug in xmega. USBCAL values being updated in main loop caused reset if USB was connected and a 5v signal was on S1.
//Added USB reset on USB suspend(caused by usbser.sys not handling IN errors properly)
//Added GETENCODERS(Reads both encoder values in one call)
//Added GETISPEEDS(Reads both ispeed values in on call)
//a beta release, see 4.1.12 changes
//added an option to reset the Roboclaw to default settings by holding the SET button on power up.
//Increased the number of samples taken on startup to auto calibrate the center/zero of RC pulses.
//Added hysteresis to Over and Under voltage detection
//Added 4 more TTL serial baudrates, 57600, 115200, 230400 and 460800
//Added S3,S4 and S5 signal pin options.
//Added voltage clamp output control options to signal pints. Used to drive an active external voltage clamp circuit to dissipate regen energy when usinga power supply
//Added simple Homing support(using S4 and S5). When enable, using an active low switch to detect the home signal, the unit will automatically move forward out of the sensor on power up if the home signal is already triggered, and then move backwards until the home sensor triggers. When moving backwards into the sensor there is a 5 second timeout. Power used is limited to 25% PWM.
//Added non-latching E-STOP(doesnt require a reset to clear)
//Added Sign magnitude PWM mode. All V3,V4 and V5 boards except Roboclaw 2x60A V4 boards support new mode. Roboclaw 2x60A V5 boards will support this mode when released.
//Added a command to read back current motor PWM settings(to detect when PWM is saturated when under PID control)
//Added user max current settings. Allows user to set lower maximum current limits
//Changed how Roboclaw handles over voltages. Units will now use active braking when regen over voltage is detected above the user set maximum main battery voltage until the over voltage has dissipated. An over voltage of this type is caused when a motor is slowed down too fast when attached to a power source that can't handle the regen. This will prevent large over voltage spikes under these conditions which could damage the unit and/or power supply.
//Changed how Position commands function when using PD and PID tuning. Acceleration/decceleration curves now function with them just like when using the PIV tuning.
//Updated Autotuning algorithms for all modes. Position autotuning now requires the QPPS value be set by the user before tuning instead of the system trying to autodetect the motors QPPS. Velocity tuning still autodetects the QPPS value.
//Added magic numbers to WriteNVM and EnterBootloader packetserial commands. Prevents accidtenal writes by the user.
//Adjusted overcurrent temperature range calculation
//added button swap option to general settings
//changed pwmcnt to volatile
//changed read back delay to use timer instead of cycle count
//modified speed/velocity control in RC/Analog mode.
//changed current chopping to use raw current and chop every PWM cycle
//Removed overcurrent timeout
//Changed overcurrent calculation based on temperatures between 25c and 85c
//Changed maxcurrent reduction calculation based on temperatures between 85c and 100c
//USB detach/re-attach code updated
//Changed battery voltages to signed calculation
//Modified battery cutoff settings
//Modified battery auto cell count detect
//Changed SetConfig/GetConfig to set/get bits in ram only. Must use WriteNVM to save all settings from now on.
//Changed checksum calculation on re-set encoder commands
//Added timeouts on USB while loops. Roboclaw buttons work even if the PC USB port stalls.
//Changed current offset calibration for better accuracy
//Added new error/warning code. GetErrorStatus command now returns 16bits of data
//Changed encoder re-set command to support values larger than 65535
//Added max current chopper to elliminate overcurrent error
//Temperature Current ramp down(85C to 100C) based on timer
//Added individual encoder re-set commands
//Added user settable acceleration config for rc/analog/simple serial modes
//Added Autotune functions added
//Changed current sense filter period to 3.3ms
//Changed CalcPWM to update 300+ times per second(reduces processor over head)
//Changed all analog readings to be updated 300+ times per second
//Changed overcurrent timeout to be 2.56seconds
//Added gettemp2 command
//Changed to polled USB communicatiosn so USB can't interfere with motor control interrupts.
//Changed read current to every PWM pulse edge
//Added USB Bootloader