The maths in question is the B parameter equation which uses the Beta value specified for NTC thermistor to approximate the curve.
I added the following code to temperature.cpp:-
float analog2tempi(int raw, const float& beta, const float& rs, const float& r_inf)
{
return = ABS_ZERO + beta/log( (raw*rs/(AD_RANGE - raw))/r_inf );
}
In order to use this, download the latest version of the T3P3 branch of Marlin and make the following changes to Configuration.h
//use RepRapPro Algebraic Temperature calculation rather than
//the tables - still experimental in this version of Marlin.
#define ALGEBRA_TEMP
and define the series resistor and Thermistors specific to your setup:
// Uncomment ONE of the next two lines - the one for the series resistors on your controller (most common is 4700)
#define SERIAL_R 4700
//#define SERIAL_R 10000
#define E_BETA 4036.0
#define E_NTC 100000.0
#define BED_BETA 4036.0
#define BED_NTC 100000.0
The data sheet for your thermistor will give the Beta value, the E_NTC or B_NTC is the value of the thermistor at 25C which for a "100K" thermistor is 100 000.
Warning: This is only tested with a variable resistor and an EPCOS B57560G104, and the equation used is an approximation - it is not as accurate as a well defined table.
To do: Investigate using a better equation, such as the equation that Nophead describes here which is in the new createTemperatureLookupMarlin.py script in Marlin.