|
|
@ -397,7 +397,7 @@ float analog2temp(int raw, uint8_t e) {
|
|
|
|
// For bed temperature measurement.
|
|
|
|
// For bed temperature measurement.
|
|
|
|
float analog2tempBed(int raw) {
|
|
|
|
float analog2tempBed(int raw) {
|
|
|
|
#ifdef BED_USES_THERMISTOR
|
|
|
|
#ifdef BED_USES_THERMISTOR
|
|
|
|
int celsius = 0;
|
|
|
|
float celsius = 0;
|
|
|
|
byte i;
|
|
|
|
byte i;
|
|
|
|
|
|
|
|
|
|
|
|
raw = (1023 * OVERSAMPLENR) - raw;
|
|
|
|
raw = (1023 * OVERSAMPLENR) - raw;
|
|
|
@ -408,9 +408,8 @@ float analog2tempBed(int raw) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
celsius = PGM_RD_W(bedtemptable[i-1][1]) +
|
|
|
|
celsius = PGM_RD_W(bedtemptable[i-1][1]) +
|
|
|
|
(raw - PGM_RD_W(bedtemptable[i-1][0])) *
|
|
|
|
(raw - PGM_RD_W(bedtemptable[i-1][0])) *
|
|
|
|
(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
|
|
|
|
(float)(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
|
|
|
|
(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
|
|
|
|
(float)(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -419,13 +418,12 @@ float analog2tempBed(int raw) {
|
|
|
|
if (i == bedtemptable_len) celsius = PGM_RD_W(bedtemptable[i-1][1]);
|
|
|
|
if (i == bedtemptable_len) celsius = PGM_RD_W(bedtemptable[i-1][1]);
|
|
|
|
|
|
|
|
|
|
|
|
return celsius;
|
|
|
|
return celsius;
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined BED_USES_AD595
|
|
|
|
#elif defined BED_USES_AD595
|
|
|
|
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
|
|
|
|
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#warning No heater-type defined for the bed.
|
|
|
|
#warning No heater-type defined for the bed.
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tp_init()
|
|
|
|
void tp_init()
|
|
|
|