Index: firmware/App/Drivers/ConductivityTeensy.c =================================================================== diff -u -r37e25a996fb9e77c50979ae9007be54040376957 -r3b97a99ae360edaafcf73614162b267fc36e6a0c --- firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 37e25a996fb9e77c50979ae9007be54040376957) +++ firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 3b97a99ae360edaafcf73614162b267fc36e6a0c) @@ -106,7 +106,7 @@ static COND_MODELS_T currentConductivityModel; ///< Current Conductivity Model selected. static BOOL eepromInit; ///< Boolean to determine if we are loading eeprom data from sensors. -// Command Map +// Teensy Command Map static const COND_CMD_DATA_T teensyCmdMap[] = { // Command Index / Sub state Command Length of expected response data { TEENSY_CMD_INIT_SENSOR , ( U08* )"a" , RX_SIZE_INIT_SENSOR }, @@ -183,7 +183,7 @@ static COND_PARSE_STATUS parseMeasurementSettings( const U08 *buffer, U32 len ); static COND_PARSE_STATUS parseEEPROMdata( const U08 *buffer, U32 len ); -static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer, U32 len ); +static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer ); static U32 getTeensyCondId( CONDUCTIVITY_SENSORS_T sensorId ); static void calculateConductivity( TEENSY_SENSOR_INDEX_T sensorNum ); @@ -846,10 +846,6 @@ condWriteCmdRspnsRcvd = FALSE; success = TRUE; } - - // Should not be any data received at this time - //consumeUnexpectedConductivityData(); - return success; } @@ -1437,7 +1433,7 @@ condResponseTime = getMSTimerCount(); // Read the data from the receive buffer - parseStatus = parseConductivityMeasurements( condRxBuffer, COND_RX_BUFFER_LEN ); + parseStatus = parseConductivityMeasurements( condRxBuffer ); // Check if parsing was done successfully if ( COND_PARSE_SUCCESS == parseStatus ) @@ -1600,7 +1596,7 @@ condResponseTime = 0; // Read the data from the receive buffer - parseStatus = parseConductivityMeasurements( condRxBuffer, COND_RX_BUFFER_LEN ); + parseStatus = parseConductivityMeasurements( condRxBuffer ); // Check if parsing was done successfully if ( COND_PARSE_SUCCESS == parseStatus ) @@ -1675,7 +1671,7 @@ condResponseTime = 0; // Read the data from the receive buffer - COND_PARSE_STATUS parseStatus = parseConductivityMeasurements( condRxBuffer, COND_RX_BUFFER_LEN ); + COND_PARSE_STATUS parseStatus = parseConductivityMeasurements( condRxBuffer ); // Check if parsing was done successfully if ( COND_PARSE_SUCCESS == parseStatus ) @@ -1821,7 +1817,7 @@ * len - Length of the input data. * @return COND_PARSE_STATUS to tell if parsing was successful or not. *************************************************************************/ -static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer, U32 len ) +static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer ) { COND_PARSE_STATUS parseStatus = COND_PARSE_NONE; COND_SENSOR_DATA_T tempSensor; @@ -2049,6 +2045,7 @@ B0 = condCoeff[ sensorNum ].beta0DD; } + // B3( 1000 / impRz ) + B2( rtdRz / impRz ) + B1( 100ln(rtdRz) / impRz ) + B0 calculatedConductivity = ( ( B3 * ( 1000.0 / R ) ) + ( B2 * ( Z / R ) ) + ( B1 * ( ( 100 * log( Z ) ) / R ) ) + @@ -2086,7 +2083,7 @@ } calculateResistance( sensorNum, isFPSensor ); calculateTemperature( sensorNum ); - + // ( k / calculatedReistance ) * (1 + alpha*( 25 - calculatedTemperature ) ) calculatedConductivity = ( ( k / condCalculatedMeasurement[ sensorNum ].Resistance.data ) * ( 1 + ( alpha * ( COND_TEMP_OFFSET - condCalculatedMeasurement[ sensorNum ].Temperature.data ) ) ) ); calculatedConductivity = calculatedConductivity * COND_CONVERSION_SM_TO_USCM; @@ -2128,7 +2125,7 @@ k = condCoeff[ sensorNum ].kHighDDS; } calculateTemperature( sensorNum ); - + // ( k / impRz ) * (1 + alpha*( 25 - calculatedTemperature ) ) calculatedConductivity = ( ( k / R ) * ( 1 + ( alpha * ( COND_TEMP_OFFSET - condCalculatedMeasurement[ sensorNum ].Temperature.data ) ) ) ); @@ -2298,7 +2295,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); - if ( ( payload.index >= FIRST_DD_COND_SENSOR ) && ( payload.index <= LAST_FP_COND_SENSOR ) ) + if ( payload.index <= LAST_FP_COND_SENSOR ) { // D74 is not connected to Teensy and does not have a data structure to override. if ( LAST_DD_COND_SENSOR != payload.index )