Fixed voltage range checking and error message

Change-Id: I7ba05eb27f3d82bfd37f6b407fe39e0ab9cf5bf0
This commit is contained in:
Thomas Clark
2014-08-05 11:07:39 -04:00
parent 4b22742cdc
commit ed08ab2989
2 changed files with 5 additions and 5 deletions

View File

@@ -353,12 +353,12 @@ float getAnalogAverageVoltage(void* analog_port_pointer, int32_t *status) {
* @return The raw value for the channel.
*/
int32_t getAnalogVoltsToValue(void* analog_port_pointer, double voltage, int32_t *status) {
if (voltage > 10.0) {
voltage = 10.0;
if (voltage > 5.0) {
voltage = 5.0;
*status = VOLTAGE_OUT_OF_RANGE;
}
if (voltage < -10.0) {
voltage = -10.0;
if (voltage < 0.0) {
voltage = 0.0;
*status = VOLTAGE_OUT_OF_RANGE;
}
uint32_t LSBWeight = getAnalogLSBWeight(analog_port_pointer, status);