Skip to content

Commit 92cc826

Browse files
committed
indent
1 parent cb4f5f9 commit 92cc826

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

Marlin/src/libs/adc/adc_ads1118.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -283,31 +283,31 @@ float ThermocoupleK:: tempReadtoCelsius(const int16_t rawADC) {
283283
// Búsqueda lineal en la tabla (de menor a mayor valor ADC)
284284
for (uint16_t i = 0; i < TEMP_TABLE_SIZE - 1; i++) {
285285

286-
int16_t adc1 = pgm_read_word(&table_thermocouple_k[i].adc);
287-
int16_t adc2 = pgm_read_word(&table_thermocouple_k[i + 1].adc);
288-
// Serial.print(i); Serial.print(" "); Serial.print(adc1); Serial.print(" "); Serial.print(adc2);
289-
290-
if (rawADC >= adc1 && rawADC < adc2) { // in-between tableValue and nextValue
291-
// Approximate temperature via linear interpolation
292-
//float frac = float(rawADC - adc2) / float(adc1 - adc2);
293-
int16_t t1 = pgm_read_word(&table_thermocouple_k[i].temp);
294-
int16_t t2 = pgm_read_word(&table_thermocouple_k[i+1].temp);
295-
// Serial.print(" "); Serial.print(t1); Serial.print(" "); Serial.print(t2);
296-
float tempC = t1 + (float) (rawADC - adc1) * (float(t2 - t1) / float(adc2 - adc1)); // TEMP_TABLE_OFFSET + i + frac;
297-
return tempC;
298-
}
299-
// Serial.println("");
286+
int16_t adc1 = pgm_read_word(&table_thermocouple_k[i].adc);
287+
int16_t adc2 = pgm_read_word(&table_thermocouple_k[i + 1].adc);
288+
// Serial.print(i); Serial.print(" "); Serial.print(adc1); Serial.print(" "); Serial.print(adc2);
289+
290+
if (rawADC >= adc1 && rawADC < adc2) { // in-between tableValue and nextValue
291+
// Approximate temperature via linear interpolation
292+
//float frac = float(rawADC - adc2) / float(adc1 - adc2);
293+
int16_t t1 = pgm_read_word(&table_thermocouple_k[i].temp);
294+
int16_t t2 = pgm_read_word(&table_thermocouple_k[i+1].temp);
295+
// Serial.print(" "); Serial.print(t1); Serial.print(" "); Serial.print(t2);
296+
float tempC = t1 + (float) (rawADC - adc1) * (float(t2 - t1) / float(adc2 - adc1)); // TEMP_TABLE_OFFSET + i + frac;
297+
return tempC;
298+
}
299+
// Serial.println("");
300300
}
301301

302302
return TEMP_MIN_TEMP;
303303
}
304304

305305
float ThermocoupleK:: calcTempCelsius() {
306-
_Tcold = ads1118.convertInternalTemp(_raw_cold);
307-
_Thot = tempReadtoCelsius(_raw_hot);
308-
//SERIAL_ECHOPGM("ADS1118 TCold "); SERIAL_ECHOLN(_Tcold);
309-
//SERIAL_ECHOPGM("ADS1118 THot "); SERIAL_ECHOLN(_Thot);
310-
return _Thot + _Tcold;
306+
_Tcold = ads1118.convertInternalTemp(_raw_cold);
307+
_Thot = tempReadtoCelsius(_raw_hot);
308+
//SERIAL_ECHOPGM("ADS1118 TCold "); SERIAL_ECHOLN(_Tcold);
309+
//SERIAL_ECHOPGM("ADS1118 THot "); SERIAL_ECHOLN(_Thot);
310+
return _Thot + _Tcold;
311311
}
312312

313313
void ThermocoupleK::setRawCold(const int16_t raw_cold) {

Marlin/src/module/temperature.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,9 +2629,9 @@ void Temperature::task() {
26292629

26302630
#if ANY_THERMISTOR_IS(-18)
26312631

2632-
// Conversion for ADS1118 in differential mode (K-type)
2633-
// Each LSB bit ≈ 62.5 µV → ~1.5 °C (no calibration).
2634-
// Adjustable with GAIN and OFFSET from Configuration_adv.h
2632+
// Conversion for ADS1118 in differential mode (K-type)
2633+
// Each LSB bit ≈ 62.5 µV → ~1.5 °C (no calibration).
2634+
// Adjustable with GAIN and OFFSET from Configuration_adv.h
26352635

26362636
static constexpr celsius_float_t temp_ads1118(const uint8_t e) {
26372637
celsius_float_t temp = 0;

0 commit comments

Comments
 (0)