Index: firmware/App/Controllers/Thermistors.c =================================================================== diff -u -re6453f6070bec116e1f1e3a553eb2c6a7aac1f9d -r6bf297b685487355fd581f221c59cf9d5a4fa53e --- firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision e6453f6070bec116e1f1e3a553eb2c6a7aac1f9d) +++ firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision 6bf297b685487355fd581f221c59cf9d5a4fa53e) @@ -270,12 +270,12 @@ static void monitorThermistors( void ) { THERMISTORS_TEMP_SENSORS_T sensorId; - THERMISTORS_TEMP_SENSORS_T sensorInAlarm = THERMISTOR_ONBOARD_NTC; + THERMISTORS_TEMP_SENSORS_T sensorInAlarm = THERMISTOR_FIRST; F32 temperature = 0.0F; BOOL isTempOutOfRange = FALSE; F32 alarmTemperature = 0.0F; - for ( sensorId = THERMISTOR_ONBOARD_NTC; sensorId < NUM_OF_THERMISTORS; sensorId++ ) + for ( sensorId = THERMISTOR_FIRST; sensorId < NUM_OF_THERMISTORS; sensorId++ ) { temperature = getThermistorTemperatureValue( sensorId ); @@ -335,11 +335,11 @@ // Voltage = ADC x (voltage reference) / (ADC bit resolution) F32 thermistorVoltage = adcValue * ( thermistorsStatus[ thermistor ].voltageReference / thermistorsStatus[ thermistor ].adcBitResolution ); - // Calculate the thermistor resistor by solving: thermistorVoltage = (3 x 10) / (10 + R(T)) + // Calculate the thermistor resistor voltage reference - current voltage (at 25 degrees C) F32 thermistorResistor = ( ( THERMISTOR_REFERENCE_RESISTOR_AT_25 * thermistorsStatus[ thermistor ].voltageReference ) - ( THERMISTOR_REFERENCE_RESISTOR_AT_25 * thermistorVoltage ) ) / thermistorVoltage; - // 1/T = Ln(thermistorResistor/10000)/3380 + 1/298 + // 1/T = Ln(thermistorResistor/THERMISTOR_REFERENCE_RESISTOR_AT_25)/THERMISTOR_BETA_VALUE + THERMISTOR_REF_TEMP_INV F32 invTemperature = ( logf( thermistorResistor / THERMISTOR_REFERENCE_RESISTOR_AT_25 ) / THERMISTOR_BETA_VALUE ) + THERMISTOR_REF_TEMP_INV; // Inverse the value to get the temperature in Kelvin and then convert it to Celsius