Browse Source

Add whole-degree accessors, simplify some temperature-related features (#21685)

Scott Lahteine 4 years ago
parent
commit
c4620bb528
No account linked to committer's email address

+ 6
- 6
Marlin/src/feature/leds/printer_event_leds.cpp View File

40
 
40
 
41
   uint8_t PrinterEventLEDs::old_intensity = 0;
41
   uint8_t PrinterEventLEDs::old_intensity = 0;
42
 
42
 
43
-  inline uint8_t pel_intensity(const_float_t start, const_float_t current, const_float_t target) {
44
-    if (uint16_t(start) == uint16_t(target)) return 255;
45
-    return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
43
+  inline uint8_t pel_intensity(const celsius_t start, const celsius_t current, const celsius_t target) {
44
+    if (start == target) return 255;
45
+    return (uint8_t)map(constrain(current, start, target), start, target, 0, 255);
46
   }
46
   }
47
 
47
 
48
   inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
48
   inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
58
 
58
 
59
 #if HAS_TEMP_HOTEND
59
 #if HAS_TEMP_HOTEND
60
 
60
 
61
-  void PrinterEventLEDs::onHotendHeating(const_float_t start, const_float_t current, const_float_t target) {
61
+  void PrinterEventLEDs::onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
62
     const uint8_t blue = pel_intensity(start, current, target);
62
     const uint8_t blue = pel_intensity(start, current, target);
63
     if (blue != old_intensity) {
63
     if (blue != old_intensity) {
64
       old_intensity = blue;
64
       old_intensity = blue;
70
 
70
 
71
 #if HAS_HEATED_BED
71
 #if HAS_HEATED_BED
72
 
72
 
73
-  void PrinterEventLEDs::onBedHeating(const_float_t start, const_float_t current, const_float_t target) {
73
+  void PrinterEventLEDs::onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
74
     const uint8_t red = pel_intensity(start, current, target);
74
     const uint8_t red = pel_intensity(start, current, target);
75
     if (red != old_intensity) {
75
     if (red != old_intensity) {
76
       old_intensity = red;
76
       old_intensity = red;
82
 
82
 
83
 #if HAS_HEATED_CHAMBER
83
 #if HAS_HEATED_CHAMBER
84
 
84
 
85
-  void PrinterEventLEDs::onChamberHeating(const_float_t start, const_float_t current, const_float_t target) {
85
+  void PrinterEventLEDs::onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
86
     const uint8_t green = pel_intensity(start, current, target);
86
     const uint8_t green = pel_intensity(start, current, target);
87
     if (green != old_intensity) {
87
     if (green != old_intensity) {
88
       old_intensity = green;
88
       old_intensity = green;

+ 4
- 4
Marlin/src/feature/leds/printer_event_leds.h View File

41
 public:
41
 public:
42
   #if HAS_TEMP_HOTEND
42
   #if HAS_TEMP_HOTEND
43
     static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
43
     static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
44
-    static void onHotendHeating(const_float_t start, const_float_t current, const_float_t target);
44
+    static void onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target);
45
   #endif
45
   #endif
46
 
46
 
47
   #if HAS_HEATED_BED
47
   #if HAS_HEATED_BED
48
     static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
48
     static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
49
-    static void onBedHeating(const_float_t start, const_float_t current, const_float_t target);
49
+    static void onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target);
50
   #endif
50
   #endif
51
 
51
 
52
   #if HAS_HEATED_CHAMBER
52
   #if HAS_HEATED_CHAMBER
53
     static inline LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
53
     static inline LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
54
-    static void onChamberHeating(const_float_t start, const_float_t current, const_float_t target);
54
+    static void onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target);
55
   #endif
55
   #endif
56
 
56
 
57
   #if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
57
   #if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
58
-    static inline void onHeatingDone() { leds.set_white(); }
58
+    static inline void onHeatingDone()             { leds.set_white(); }
59
     static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
59
     static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
60
   #endif
60
   #endif
61
 
61
 

+ 3
- 3
Marlin/src/feature/leds/tempstat.cpp View File

36
   static millis_t next_status_led_update_ms = 0;
36
   static millis_t next_status_led_update_ms = 0;
37
   if (ELAPSED(millis(), next_status_led_update_ms)) {
37
   if (ELAPSED(millis(), next_status_led_update_ms)) {
38
     next_status_led_update_ms += 500; // Update every 0.5s
38
     next_status_led_update_ms += 500; // Update every 0.5s
39
-    float max_temp = TERN0(HAS_HEATED_BED, _MAX(thermalManager.degTargetBed(), thermalManager.degBed()));
39
+    celsius_t max_temp = TERN0(HAS_HEATED_BED, _MAX(thermalManager.degTargetBed(), thermalManager.wholeDegBed()));
40
     HOTEND_LOOP()
40
     HOTEND_LOOP()
41
-      max_temp = _MAX(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
42
-    const int8_t new_red = (max_temp > 55.0) ? HIGH : (max_temp < 54.0 || old_red < 0) ? LOW : old_red;
41
+      max_temp = _MAX(max_temp, thermalManager.wholeDegHotend(e), thermalManager.degTargetHotend(e));
42
+    const int8_t new_red = (max_temp > 55) ? HIGH : (max_temp < 54 || old_red < 0) ? LOW : old_red;
43
     if (new_red != old_red) {
43
     if (new_red != old_red) {
44
       old_red = new_red;
44
       old_red = new_red;
45
       #if PIN_EXISTS(STAT_LED_RED)
45
       #if PIN_EXISTS(STAT_LED_RED)

+ 1
- 1
Marlin/src/feature/pause.cpp View File

143
 
143
 
144
   // Allow interruption by Emergency Parser M108
144
   // Allow interruption by Emergency Parser M108
145
   wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
145
   wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
146
-  while (wait_for_heatup && ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW)
146
+  while (wait_for_heatup && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
147
     idle();
147
     idle();
148
   wait_for_heatup = false;
148
   wait_for_heatup = false;
149
 
149
 

+ 14
- 13
Marlin/src/feature/probe_temp_comp.cpp View File

71
 
71
 
72
 void ProbeTempComp::print_offsets() {
72
 void ProbeTempComp::print_offsets() {
73
   LOOP_L_N(s, TSI_COUNT) {
73
   LOOP_L_N(s, TSI_COUNT) {
74
-    float temp = cali_info[s].start_temp;
74
+    celsius_t temp = cali_info[s].start_temp;
75
     for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
75
     for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
76
       SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
76
       SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
77
         #if ENABLED(USE_TEMP_EXT_COMPENSATION)
77
         #if ENABLED(USE_TEMP_EXT_COMPENSATION)
114
   }
114
   }
115
 
115
 
116
   const uint8_t measurements = cali_info[tsi].measurements;
116
   const uint8_t measurements = cali_info[tsi].measurements;
117
-  const float start_temp = cali_info[tsi].start_temp,
118
-                res_temp = cali_info[tsi].temp_res;
117
+  const celsius_t start_temp = cali_info[tsi].start_temp,
118
+                    res_temp = cali_info[tsi].temp_res;
119
   int16_t * const data = sensor_z_offsets[tsi];
119
   int16_t * const data = sensor_z_offsets[tsi];
120
 
120
 
121
   // Extrapolate
121
   // Extrapolate
159
   return true;
159
   return true;
160
 }
160
 }
161
 
161
 
162
-void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const_float_t temp, float &meas_z) {
162
+void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z) {
163
   if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp))
163
   if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp))
164
     meas_z -= get_offset_for_temperature(tsi, temp);
164
     meas_z -= get_offset_for_temperature(tsi, temp);
165
 }
165
 }
166
 
166
 
167
-float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const_float_t temp) {
167
+float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp) {
168
   const uint8_t measurements = cali_info[tsi].measurements;
168
   const uint8_t measurements = cali_info[tsi].measurements;
169
-  const float start_temp = cali_info[tsi].start_temp,
170
-                res_temp = cali_info[tsi].temp_res;
169
+  const celsius_t start_temp = cali_info[tsi].start_temp,
170
+                    res_temp = cali_info[tsi].temp_res;
171
   const int16_t * const data = sensor_z_offsets[tsi];
171
   const int16_t * const data = sensor_z_offsets[tsi];
172
 
172
 
173
-  auto point = [&](uint8_t i) {
174
-    return xy_float_t({start_temp + i*res_temp, static_cast<float>(data[i])});
173
+  auto point = [&](uint8_t i) -> xy_float_t {
174
+    return xy_float_t({ static_cast<float>(start_temp) + i * res_temp, static_cast<float>(data[i]) });
175
   };
175
   };
176
 
176
 
177
   auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) {
177
   auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) {
207
 
207
 
208
   if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false;
208
   if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false;
209
 
209
 
210
-  const float start_temp = cali_info[tsi].start_temp,
211
-                res_temp = cali_info[tsi].temp_res;
210
+  const celsius_t start_temp = cali_info[tsi].start_temp,
211
+                    res_temp = cali_info[tsi].temp_res;
212
   const int16_t * const data = sensor_z_offsets[tsi];
212
   const int16_t * const data = sensor_z_offsets[tsi];
213
 
213
 
214
   float sum_x = start_temp,
214
   float sum_x = start_temp,
215
         sum_x2 = sq(start_temp),
215
         sum_x2 = sq(start_temp),
216
         sum_xy = 0, sum_y = 0;
216
         sum_xy = 0, sum_y = 0;
217
 
217
 
218
+  float xi = static_cast<float>(start_temp);
218
   LOOP_L_N(i, calib_idx) {
219
   LOOP_L_N(i, calib_idx) {
219
-    const float xi = start_temp + (i + 1) * res_temp,
220
-                yi = static_cast<float>(data[i]);
220
+    const float yi = static_cast<float>(data[i]);
221
+    xi += res_temp;
221
     sum_x += xi;
222
     sum_x += xi;
222
     sum_x2 += sq(xi);
223
     sum_x2 += sq(xi);
223
     sum_xy += xi * yi;
224
     sum_xy += xi * yi;

+ 11
- 11
Marlin/src/feature/probe_temp_comp.h View File

34
 
34
 
35
 typedef struct {
35
 typedef struct {
36
   uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C)
36
   uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C)
37
-  float   temp_res,     // Resolution in °C between measurements
38
-          start_temp,   // Base measurement; z-offset == 0
39
-          end_temp;
37
+  celsius_t temp_res,   // Resolution in °C between measurements
38
+            start_temp, // Base measurement; z-offset == 0
39
+            end_temp;
40
 } temp_calib_t;
40
 } temp_calib_t;
41
 
41
 
42
 /**
42
 /**
50
   #define PTC_SAMPLE_COUNT 10U
50
   #define PTC_SAMPLE_COUNT 10U
51
 #endif
51
 #endif
52
 #ifndef PTC_SAMPLE_RES
52
 #ifndef PTC_SAMPLE_RES
53
-  #define PTC_SAMPLE_RES 5.0f
53
+  #define PTC_SAMPLE_RES 5
54
 #endif
54
 #endif
55
 #ifndef PTC_SAMPLE_START
55
 #ifndef PTC_SAMPLE_START
56
-  #define PTC_SAMPLE_START 30.0f
56
+  #define PTC_SAMPLE_START 30
57
 #endif
57
 #endif
58
 #define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES))
58
 #define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES))
59
 
59
 
60
 // Bed temperature calibration constants
60
 // Bed temperature calibration constants
61
 #ifndef BTC_PROBE_TEMP
61
 #ifndef BTC_PROBE_TEMP
62
-  #define BTC_PROBE_TEMP 30.0f
62
+  #define BTC_PROBE_TEMP 30
63
 #endif
63
 #endif
64
 #ifndef BTC_SAMPLE_COUNT
64
 #ifndef BTC_SAMPLE_COUNT
65
   #define BTC_SAMPLE_COUNT 10U
65
   #define BTC_SAMPLE_COUNT 10U
66
 #endif
66
 #endif
67
 #ifndef BTC_SAMPLE_STEP
67
 #ifndef BTC_SAMPLE_STEP
68
-  #define BTC_SAMPLE_RES 5.0f
68
+  #define BTC_SAMPLE_RES 5
69
 #endif
69
 #endif
70
 #ifndef BTC_SAMPLE_START
70
 #ifndef BTC_SAMPLE_START
71
-  #define BTC_SAMPLE_START 60.0f
71
+  #define BTC_SAMPLE_START 60
72
 #endif
72
 #endif
73
 #define BTC_SAMPLE_END ((BTC_SAMPLE_START) + (BTC_SAMPLE_COUNT) * (BTC_SAMPLE_RES))
73
 #define BTC_SAMPLE_END ((BTC_SAMPLE_START) + (BTC_SAMPLE_COUNT) * (BTC_SAMPLE_RES))
74
 
74
 
77
 #endif
77
 #endif
78
 
78
 
79
 #ifndef PTC_PROBE_RAISE
79
 #ifndef PTC_PROBE_RAISE
80
-  #define PTC_PROBE_RAISE 10.0f
80
+  #define PTC_PROBE_RAISE 10
81
 #endif
81
 #endif
82
 
82
 
83
 static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
83
 static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
124
     static void prepare_new_calibration(const_float_t init_meas_z);
124
     static void prepare_new_calibration(const_float_t init_meas_z);
125
     static void push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z);
125
     static void push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z);
126
     static bool finish_calibration(const TempSensorID tsi);
126
     static bool finish_calibration(const TempSensorID tsi);
127
-    static void compensate_measurement(const TempSensorID tsi, const_float_t temp, float &meas_z);
127
+    static void compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z);
128
 
128
 
129
   private:
129
   private:
130
     static uint8_t calib_idx;
130
     static uint8_t calib_idx;
135
      */
135
      */
136
     static float init_measurement;
136
     static float init_measurement;
137
 
137
 
138
-    static float get_offset_for_temperature(const TempSensorID tsi, const_float_t temp);
138
+    static float get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp);
139
 
139
 
140
     /**
140
     /**
141
      * Fit a linear function in measured temperature offsets
141
      * Fit a linear function in measured temperature offsets

+ 5
- 5
Marlin/src/gcode/calibrate/G76_M192_M871.cpp View File

103
     return (timeout && ELAPSED(ms, timeout));
103
     return (timeout && ELAPSED(ms, timeout));
104
   };
104
   };
105
 
105
 
106
-  auto wait_for_temps = [&](const float tb, const float tp, millis_t &ntr, const millis_t timeout=0) {
106
+  auto wait_for_temps = [&](const celsius_t tb, const celsius_t tp, millis_t &ntr, const millis_t timeout=0) {
107
     say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature.");
107
     say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature.");
108
-    while (fabs(thermalManager.degBed() - tb) > 0.1f || thermalManager.degProbe() > tp)
108
+    while (thermalManager.wholeDegBed() != tb || thermalManager.wholeDegProbe() > tp)
109
       if (report_temps(ntr, timeout)) return true;
109
       if (report_temps(ntr, timeout)) return true;
110
     return false;
110
     return false;
111
   };
111
   };
180
             target_probe = temp_comp.bed_calib_probe_temp;
180
             target_probe = temp_comp.bed_calib_probe_temp;
181
 
181
 
182
     say_waiting_for(); SERIAL_ECHOLNPGM(" cooling.");
182
     say_waiting_for(); SERIAL_ECHOLNPGM(" cooling.");
183
-    while (thermalManager.degBed() > target_bed || thermalManager.degProbe() > target_probe)
183
+    while (thermalManager.wholeDegBed() > target_bed || thermalManager.wholeDegProbe() > target_probe)
184
       report_temps(next_temp_report);
184
       report_temps(next_temp_report);
185
 
185
 
186
     // Disable leveling so it won't mess with us
186
     // Disable leveling so it won't mess with us
204
       do_blocking_move_to(noz_pos_xyz);
204
       do_blocking_move_to(noz_pos_xyz);
205
       say_waiting_for_probe_heating();
205
       say_waiting_for_probe_heating();
206
       SERIAL_EOL();
206
       SERIAL_EOL();
207
-      while (thermalManager.degProbe() < target_probe)
207
+      while (thermalManager.wholeDegProbe() < target_probe)
208
         report_temps(next_temp_report);
208
         report_temps(next_temp_report);
209
 
209
 
210
       const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
210
       const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
350
     return;
350
     return;
351
   }
351
   }
352
 
352
 
353
-  const float target_temp = parser.value_celsius();
353
+  const celsius_t target_temp = parser.value_celsius();
354
   ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING));
354
   ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING));
355
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
355
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
356
 }
356
 }

+ 5
- 5
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp View File

525
 FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
525
 FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
526
   #if HAS_HEATED_BED
526
   #if HAS_HEATED_BED
527
     const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0);
527
     const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0);
528
-    const celsius_t t1 = (isBed ? thermalManager.degBed()       : thermalManager.degHotend(heater_id)),
528
+    const celsius_t t1 = (isBed ? thermalManager.wholeDegBed()  : thermalManager.wholeDegHotend(heater_id)),
529
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
529
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
530
   #else
530
   #else
531
-    const celsius_t t1 = thermalManager.degHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
531
+    const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
532
   #endif
532
   #endif
533
 
533
 
534
   if (prefix >= 0) lcd_put_wchar(prefix);
534
   if (prefix >= 0) lcd_put_wchar(prefix);
557
 
557
 
558
 #if HAS_COOLER
558
 #if HAS_COOLER
559
 FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
559
 FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
560
-  const float t1 = thermalManager.degCooler(), t2 = thermalManager.degTargetCooler();
560
+  const celsius_t t2 = thermalManager.degTargetCooler();
561
 
561
 
562
   if (prefix >= 0) lcd_put_wchar(prefix);
562
   if (prefix >= 0) lcd_put_wchar(prefix);
563
 
563
 
564
-  lcd_put_u8str(i16tostr3rj(t1 + 0.5));
564
+  lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
565
   lcd_put_wchar('/');
565
   lcd_put_wchar('/');
566
 
566
 
567
   #if !HEATER_IDLE_HANDLER
567
   #if !HEATER_IDLE_HANDLER
574
     }
574
     }
575
     else
575
     else
576
   #endif
576
   #endif
577
-      lcd_put_u8str(i16tostr3left(t2 + 0.5));
577
+      lcd_put_u8str(i16tostr3left(t2));
578
 
578
 
579
   if (prefix >= 0) {
579
   if (prefix >= 0) {
580
     lcd_put_wchar(LCD_STR_DEGREE[0]);
580
     lcd_put_wchar(LCD_STR_DEGREE[0]);

+ 3
- 3
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp View File

434
   uint8_t pic_hot_bits;
434
   uint8_t pic_hot_bits;
435
   #if HAS_HEATED_BED
435
   #if HAS_HEATED_BED
436
     const bool isBed = heater_id < 0;
436
     const bool isBed = heater_id < 0;
437
-    const celsius_t t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater_id)),
437
+    const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
438
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
438
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
439
   #else
439
   #else
440
-    const celsius_t t1 = thermalManager.degHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
440
+    const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
441
   #endif
441
   #endif
442
 
442
 
443
   #if HOTENDS < 2
443
   #if HOTENDS < 2
803
       if (!PanelDetected) return;
803
       if (!PanelDetected) return;
804
       lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
804
       lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
805
       lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str_P(PSTR(" E")); lcd.write('1' + extruder); lcd.write(' ');
805
       lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str_P(PSTR(" E")); lcd.write('1' + extruder); lcd.write(' ');
806
-      lcd.print(i16tostr3rj(thermalManager.degHotend(extruder)));       lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
806
+      lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
807
       lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
807
       lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
808
       lcd.print_line();
808
       lcd.print_line();
809
     }
809
     }

+ 1
- 1
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

324
       lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
324
       lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
325
       lcd_put_wchar((char)('1' + extruder));
325
       lcd_put_wchar((char)('1' + extruder));
326
       lcd_put_wchar(' ');
326
       lcd_put_wchar(' ');
327
-      lcd_put_u8str(i16tostr3rj(thermalManager.degHotend(extruder)));
327
+      lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
328
       lcd_put_wchar('/');
328
       lcd_put_wchar('/');
329
 
329
 
330
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
330
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)

+ 4
- 4
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

213
 
213
 
214
     const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
214
     const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
215
 
215
 
216
-    const celsius_t temp = thermalManager.degHotend(heater_id),
216
+    const celsius_t temp = thermalManager.wholeDegHotend(heater_id),
217
                   target = thermalManager.degTargetHotend(heater_id);
217
                   target = thermalManager.degTargetHotend(heater_id);
218
 
218
 
219
     #if DISABLED(STATUS_HOTEND_ANIM)
219
     #if DISABLED(STATUS_HOTEND_ANIM)
310
 
310
 
311
     const uint8_t tx = STATUS_BED_TEXT_X;
311
     const uint8_t tx = STATUS_BED_TEXT_X;
312
 
312
 
313
-    const celsius_t temp = thermalManager.degBed(),
313
+    const celsius_t temp = thermalManager.wholeDegBed(),
314
                   target = thermalManager.degTargetBed();
314
                   target = thermalManager.degTargetBed();
315
 
315
 
316
     #if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
316
     #if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
380
         _draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
380
         _draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
381
     #endif
381
     #endif
382
     if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
382
     if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
383
-      _draw_centered_temp(thermalManager.degChamber(), STATUS_CHAMBER_TEXT_X, 28);
383
+      _draw_centered_temp(thermalManager.wholeDegChamber(), STATUS_CHAMBER_TEXT_X, 28);
384
   }
384
   }
385
 #endif
385
 #endif
386
 
386
 
387
 #if DO_DRAW_COOLER
387
 #if DO_DRAW_COOLER
388
   FORCE_INLINE void _draw_cooler_status() {
388
   FORCE_INLINE void _draw_cooler_status() {
389
     if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
389
     if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
390
-      _draw_centered_temp(thermalManager.degCooler(), STATUS_COOLER_TEXT_X, 28);
390
+      _draw_centered_temp(thermalManager.wholeDegCooler(), STATUS_COOLER_TEXT_X, 28);
391
   }
391
   }
392
 #endif
392
 #endif
393
 
393
 

+ 3
- 3
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp View File

721
     const duration_t elapsed            = print_job_timer.duration();
721
     const duration_t elapsed            = print_job_timer.duration();
722
     duration_t       remaining          = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
722
     duration_t       remaining          = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
723
     const uint16_t   feedrate_perc      = feedrate_percentage;
723
     const uint16_t   feedrate_perc      = feedrate_percentage;
724
-    const celsius_t  extruder_1_temp    = thermalManager.degHotend(0),
724
+    const celsius_t  extruder_1_temp    = thermalManager.wholeDegHotend(0),
725
                      extruder_1_target  = thermalManager.degTargetHotend(0);
725
                      extruder_1_target  = thermalManager.degTargetHotend(0);
726
     #if HAS_MULTI_HOTEND
726
     #if HAS_MULTI_HOTEND
727
-      const celsius_t extruder_2_temp   = thermalManager.degHotend(1),
727
+      const celsius_t extruder_2_temp   = thermalManager.wholeDegHotend(1),
728
                       extruder_2_target = thermalManager.degTargetHotend(1);
728
                       extruder_2_target = thermalManager.degTargetHotend(1);
729
     #endif
729
     #endif
730
     #if HAS_HEATED_BED
730
     #if HAS_HEATED_BED
731
-      const celsius_t bed_temp          = thermalManager.degBed(),
731
+      const celsius_t bed_temp          = thermalManager.wholeDegBed(),
732
                       bed_target        = thermalManager.degTargetBed();
732
                       bed_target        = thermalManager.degTargetBed();
733
     #endif
733
     #endif
734
 
734
 

+ 5
- 5
Marlin/src/lcd/dwin/e3v2/dwin.cpp View File

1583
 void update_variable() {
1583
 void update_variable() {
1584
   #if HAS_HOTEND
1584
   #if HAS_HOTEND
1585
     static celsius_t _hotendtemp = 0, _hotendtarget = 0;
1585
     static celsius_t _hotendtemp = 0, _hotendtarget = 0;
1586
-    const celsius_t hc = thermalManager.degHotend(0),
1586
+    const celsius_t hc = thermalManager.wholeDegHotend(0),
1587
                     ht = thermalManager.degTargetHotend(0);
1587
                     ht = thermalManager.degTargetHotend(0);
1588
     const bool _new_hotend_temp = _hotendtemp != hc,
1588
     const bool _new_hotend_temp = _hotendtemp != hc,
1589
                _new_hotend_target = _hotendtarget != ht;
1589
                _new_hotend_target = _hotendtarget != ht;
1592
   #endif
1592
   #endif
1593
   #if HAS_HEATED_BED
1593
   #if HAS_HEATED_BED
1594
     static celsius_t _bedtemp = 0, _bedtarget = 0;
1594
     static celsius_t _bedtemp = 0, _bedtarget = 0;
1595
-    const celsius_t bc = thermalManager.degBed(),
1595
+    const celsius_t bc = thermalManager.wholeDegBed(),
1596
                     bt = thermalManager.degTargetBed();
1596
                     bt = thermalManager.degTargetBed();
1597
     const bool _new_bed_temp = _bedtemp != bc,
1597
     const bool _new_bed_temp = _bedtemp != bc,
1598
                _new_bed_target = _bedtarget != bt;
1598
                _new_bed_target = _bedtarget != bt;
1880
 
1880
 
1881
   #if HAS_HOTEND
1881
   #if HAS_HOTEND
1882
     DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
1882
     DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
1883
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.degHotend(0));
1883
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.wholeDegHotend(0));
1884
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1884
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1885
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
1885
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
1886
 
1886
 
1891
 
1891
 
1892
   #if HAS_HEATED_BED
1892
   #if HAS_HEATED_BED
1893
     DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
1893
     DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
1894
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.degBed());
1894
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.wholeDegBed());
1895
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1895
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1896
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
1896
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
1897
   #endif
1897
   #endif
2709
           case 4: // Extruder
2709
           case 4: // Extruder
2710
             // window tips
2710
             // window tips
2711
             #ifdef PREVENT_COLD_EXTRUSION
2711
             #ifdef PREVENT_COLD_EXTRUSION
2712
-              if (thermalManager.degHotend(0) < EXTRUDE_MINTEMP) {
2712
+              if (thermalManager.wholeDegHotend(0) < (EXTRUDE_MINTEMP)) {
2713
                 HMI_flag.ETempTooLow_flag = true;
2713
                 HMI_flag.ETempTooLow_flag = true;
2714
                 Popup_Window_ETempTooLow();
2714
                 Popup_Window_ETempTooLow();
2715
                 DWIN_UpdateLCD();
2715
                 DWIN_UpdateLCD();

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp View File

486
 
486
 
487
 void filament_sprayer_temp() {
487
 void filament_sprayer_temp() {
488
   char buf[20] = {0};
488
   char buf[20] = {0};
489
-  sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
489
+  sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
490
 
490
 
491
   strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
491
   strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
492
   strcat_P(public_buf_l, PSTR(": "));
492
   strcat_P(public_buf_l, PSTR(": "));
522
   }
522
   }
523
 
523
 
524
   if (uiCfg.filament_load_heat_flg) {
524
   if (uiCfg.filament_load_heat_flg) {
525
-    const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
525
+    const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
526
     if (abs(diff) < 2 || diff > 0) {
526
     if (abs(diff) < 2 || diff > 0) {
527
       uiCfg.filament_load_heat_flg = false;
527
       uiCfg.filament_load_heat_flg = false;
528
       lv_clear_dialog();
528
       lv_clear_dialog();
538
   }
538
   }
539
 
539
 
540
   if (uiCfg.filament_unload_heat_flg) {
540
   if (uiCfg.filament_unload_heat_flg) {
541
-    const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
541
+    const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
542
     if (abs(diff) < 2 || diff > 0) {
542
     if (abs(diff) < 2 || diff > 0) {
543
       uiCfg.filament_unload_heat_flg = false;
543
       uiCfg.filament_unload_heat_flg = false;
544
       lv_clear_dialog();
544
       lv_clear_dialog();

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp View File

195
 
195
 
196
 void disp_hotend_temp() {
196
 void disp_hotend_temp() {
197
   char buf[20] = {0};
197
   char buf[20] = {0};
198
-  sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
198
+  sprintf(buf, extrude_menu.temp_value, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
199
   strcpy(public_buf_l, extrude_menu.temper_text);
199
   strcpy(public_buf_l, extrude_menu.temper_text);
200
   strcat(public_buf_l, buf);
200
   strcat(public_buf_l, buf);
201
   lv_label_set_text(tempText, public_buf_l);
201
   lv_label_set_text(tempText, public_buf_l);

+ 5
- 5
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp View File

50
   switch (obj->mks_obj_id) {
50
   switch (obj->mks_obj_id) {
51
     case ID_FILAMNT_IN:
51
     case ID_FILAMNT_IN:
52
       uiCfg.filament_load_heat_flg = true;
52
       uiCfg.filament_load_heat_flg = true;
53
-      if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1
54
-          || gCfgItems.filament_limit_temp <= thermalManager.degHotend(uiCfg.extruderIndex)) {
53
+      if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
54
+          || gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)) {
55
         lv_clear_filament_change();
55
         lv_clear_filament_change();
56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
57
       }
57
       }
67
     case ID_FILAMNT_OUT:
67
     case ID_FILAMNT_OUT:
68
       uiCfg.filament_unload_heat_flg = true;
68
       uiCfg.filament_unload_heat_flg = true;
69
       if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
69
       if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
70
-          && (abs((int)(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1
71
-              || thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
70
+          && (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
71
+              || thermalManager.wholeDegHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
72
       ) {
72
       ) {
73
         lv_clear_filament_change();
73
         lv_clear_filament_change();
74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
154
   public_buf_l[0] = '\0';
154
   public_buf_l[0] = '\0';
155
 
155
 
156
   strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
156
   strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
157
-  sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
157
+  sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
158
 
158
 
159
   strcat_P(public_buf_l, PSTR(": "));
159
   strcat_P(public_buf_l, PSTR(": "));
160
   strcat(public_buf_l, buf);
160
   strcat(public_buf_l, buf);

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp View File

216
 
216
 
217
   if (uiCfg.curTempType == 0) {
217
   if (uiCfg.curTempType == 0) {
218
     strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
218
     strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
219
-    sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
219
+    sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
220
   }
220
   }
221
   else {
221
   else {
222
     #if HAS_HEATED_BED
222
     #if HAS_HEATED_BED
223
       strcat(public_buf_l, preheat_menu.hotbed);
223
       strcat(public_buf_l, preheat_menu.hotbed);
224
-      sprintf(buf, preheat_menu.value_state, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
224
+      sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
225
     #endif
225
     #endif
226
   }
226
   }
227
   strcat_P(public_buf_l, PSTR(": "));
227
   strcat_P(public_buf_l, PSTR(": "));

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp View File

219
 }
219
 }
220
 
220
 
221
 void disp_ext_temp() {
221
 void disp_ext_temp() {
222
-  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
222
+  sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
223
   lv_label_set_text(labelExt1, public_buf_l);
223
   lv_label_set_text(labelExt1, public_buf_l);
224
 
224
 
225
   #if HAS_MULTI_EXTRUDER
225
   #if HAS_MULTI_EXTRUDER
226
-    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
226
+    sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
227
     lv_label_set_text(labelExt2, public_buf_l);
227
     lv_label_set_text(labelExt2, public_buf_l);
228
   #endif
228
   #endif
229
 }
229
 }
230
 
230
 
231
 void disp_bed_temp() {
231
 void disp_bed_temp() {
232
   #if HAS_HEATED_BED
232
   #if HAS_HEATED_BED
233
-    sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
233
+    sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
234
     lv_label_set_text(labelBed, public_buf_l);
234
     lv_label_set_text(labelBed, public_buf_l);
235
   #endif
235
   #endif
236
 }
236
 }

+ 12
- 12
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp View File

104
 lv_obj_t *e1, *e2, *e3, *bed;
104
 lv_obj_t *e1, *e2, *e3, *bed;
105
 void mks_disp_test() {
105
 void mks_disp_test() {
106
   char buf[30] = {0};
106
   char buf[30] = {0};
107
-  sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
107
+  sprintf_P(buf, PSTR("e1:%d"), thermalManager.wholeDegHotend(0));
108
   lv_label_set_text(e1, buf);
108
   lv_label_set_text(e1, buf);
109
   #if HAS_MULTI_HOTEND
109
   #if HAS_MULTI_HOTEND
110
-    sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
110
+    sprintf_P(buf, PSTR("e2:%d"), thermalManager.wholeDegHotend(1));
111
     lv_label_set_text(e2, buf);
111
     lv_label_set_text(e2, buf);
112
   #endif
112
   #endif
113
   #if HAS_HEATED_BED
113
   #if HAS_HEATED_BED
114
-    sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.degBed());
114
+    sprintf_P(buf, PSTR("bed:%d"), thermalManager.wholeDegBed());
115
     lv_label_set_text(bed, buf);
115
     lv_label_set_text(bed, buf);
116
   #endif
116
   #endif
117
 }
117
 }
138
 
138
 
139
     e1 = lv_label_create_empty(scr);
139
     e1 = lv_label_create_empty(scr);
140
     lv_obj_set_pos(e1, 20, 20);
140
     lv_obj_set_pos(e1, 20, 20);
141
-    sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(0));
141
+    sprintf_P(buf, PSTR("e1:  %d"), thermalManager.wholeDegHotend(0));
142
     lv_label_set_text(e1, buf);
142
     lv_label_set_text(e1, buf);
143
 
143
 
144
     #if HAS_MULTI_HOTEND
144
     #if HAS_MULTI_HOTEND
145
       e2 = lv_label_create_empty(scr);
145
       e2 = lv_label_create_empty(scr);
146
       lv_obj_set_pos(e2, 20, 45);
146
       lv_obj_set_pos(e2, 20, 45);
147
-      sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(1));
147
+      sprintf_P(buf, PSTR("e1:  %d"), thermalManager.wholeDegHotend(1));
148
       lv_label_set_text(e2, buf);
148
       lv_label_set_text(e2, buf);
149
     #endif
149
     #endif
150
 
150
 
151
     #if HAS_HEATED_BED
151
     #if HAS_HEATED_BED
152
       bed = lv_label_create_empty(scr);
152
       bed = lv_label_create_empty(scr);
153
       lv_obj_set_pos(bed, 20, 95);
153
       lv_obj_set_pos(bed, 20, 95);
154
-      sprintf_P(buf, PSTR("bed:  %d"), (int)thermalManager.degBed());
154
+      sprintf_P(buf, PSTR("bed:  %d"), thermalManager.wholeDegBed());
155
       lv_label_set_text(bed, buf);
155
       lv_label_set_text(bed, buf);
156
     #endif
156
     #endif
157
 
157
 
219
     itoa(thermalManager.degHotend(0), buf, 10);
219
     itoa(thermalManager.degHotend(0), buf, 10);
220
     lv_label_set_text(labelExt1, buf);
220
     lv_label_set_text(labelExt1, buf);
221
     lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
221
     lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
222
-    sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
222
+    sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
223
     lv_label_set_text(labelExt1Target, buf);
223
     lv_label_set_text(labelExt1Target, buf);
224
     lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
224
     lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
225
 
225
 
227
       itoa(thermalManager.degHotend(1), buf, 10);
227
       itoa(thermalManager.degHotend(1), buf, 10);
228
       lv_label_set_text(labelExt2, buf);
228
       lv_label_set_text(labelExt2, buf);
229
       lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
229
       lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
230
-      sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
230
+      sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
231
       lv_label_set_text(labelExt2Target, buf);
231
       lv_label_set_text(labelExt2Target, buf);
232
       lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
232
       lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
233
     #endif
233
     #endif
236
       itoa(thermalManager.degBed(), buf, 10);
236
       itoa(thermalManager.degBed(), buf, 10);
237
       lv_label_set_text(labelBed, buf);
237
       lv_label_set_text(labelBed, buf);
238
       lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
238
       lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
239
-      sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
239
+      sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
240
       lv_label_set_text(labelBedTarget, buf);
240
       lv_label_set_text(labelBedTarget, buf);
241
       lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
241
       lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
242
     #endif
242
     #endif
257
 
257
 
258
 void lv_temp_refr() {
258
 void lv_temp_refr() {
259
   #if HAS_HEATED_BED
259
   #if HAS_HEATED_BED
260
-    sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
260
+    sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
261
     lv_label_set_text(labelBed, public_buf_l);
261
     lv_label_set_text(labelBed, public_buf_l);
262
   #endif
262
   #endif
263
 
263
 
264
-  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
264
+  sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
265
   lv_label_set_text(labelExt1, public_buf_l);
265
   lv_label_set_text(labelExt1, public_buf_l);
266
 
266
 
267
   #if HAS_MULTI_EXTRUDER
267
   #if HAS_MULTI_EXTRUDER
268
-    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
268
+    sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
269
     lv_label_set_text(labelExt2, public_buf_l);
269
     lv_label_set_text(labelExt2, public_buf_l);
270
   #endif
270
   #endif
271
 }
271
 }

+ 7
- 7
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp View File

885
             char *outBuf = (char *)tempBuf;
885
             char *outBuf = (char *)tempBuf;
886
             char tbuf[34];
886
             char tbuf[34];
887
 
887
 
888
-            sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
888
+            sprintf_P(tbuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
889
 
889
 
890
             const int tlen = strlen(tbuf);
890
             const int tlen = strlen(tbuf);
891
 
891
 
895
             strcpy_P(outBuf, PSTR(" B:"));
895
             strcpy_P(outBuf, PSTR(" B:"));
896
             outBuf += 3;
896
             outBuf += 3;
897
             #if HAS_HEATED_BED
897
             #if HAS_HEATED_BED
898
-              sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
898
+              sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegBed(), thermalManager.degTargetBed());
899
             #else
899
             #else
900
               strcpy_P(outBuf, PSTR("0 /0"));
900
               strcpy_P(outBuf, PSTR("0 /0"));
901
             #endif
901
             #endif
908
             strcat_P(outBuf, PSTR(" T1:"));
908
             strcat_P(outBuf, PSTR(" T1:"));
909
             outBuf += 4;
909
             outBuf += 4;
910
             #if HAS_MULTI_HOTEND
910
             #if HAS_MULTI_HOTEND
911
-              sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
911
+              sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
912
             #else
912
             #else
913
               strcat_P(outBuf, PSTR("0 /0"));
913
               strcat_P(outBuf, PSTR("0 /0"));
914
             #endif
914
             #endif
918
           }
918
           }
919
           else {
919
           else {
920
             sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
920
             sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
921
-              thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
921
+              thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
922
               #if HAS_HEATED_BED
922
               #if HAS_HEATED_BED
923
-                thermalManager.degBed(), thermalManager.degTargetBed(),
923
+                thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
924
               #else
924
               #else
925
                 0, 0,
925
                 0, 0,
926
               #endif
926
               #endif
927
-              thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
927
+              thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
928
               #if HAS_MULTI_HOTEND
928
               #if HAS_MULTI_HOTEND
929
-                thermalManager.degHotend(1), thermalManager.degTargetHotend(1)
929
+                thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)
930
               #else
930
               #else
931
                 0, 0
931
                 0, 0
932
               #endif
932
               #endif

+ 4
- 4
Marlin/src/lcd/extui/malyan_lcd.cpp View File

172
 
172
 
173
       sprintf_P(message_buffer,
173
       sprintf_P(message_buffer,
174
         PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}{TQ:%03i}{TT:%s}"),
174
         PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}{TQ:%03i}{TT:%s}"),
175
-        int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
175
+        thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
176
         #if HAS_HEATED_BED
176
         #if HAS_HEATED_BED
177
-          int(thermalManager.degBed()), thermalManager.degTargetBed(),
177
+          thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
178
         #else
178
         #else
179
           0, 0,
179
           0, 0,
180
         #endif
180
         #endif
303
       // temperature information
303
       // temperature information
304
       char message_buffer[MAX_CURLY_COMMAND];
304
       char message_buffer[MAX_CURLY_COMMAND];
305
       sprintf_P(message_buffer, PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}"),
305
       sprintf_P(message_buffer, PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}"),
306
-        int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
306
+        thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
307
         #if HAS_HEATED_BED
307
         #if HAS_HEATED_BED
308
-          int(thermalManager.degBed()), thermalManager.degTargetBed()
308
+          thermalManager.wholeDegBed(), thermalManager.degTargetBed()
309
         #else
309
         #else
310
           0, 0
310
           0, 0
311
         #endif
311
         #endif

+ 2
- 2
Marlin/src/lcd/extui/ui_api.cpp View File

918
       thermalManager.updatePID();
918
       thermalManager.updatePID();
919
     }
919
     }
920
 
920
 
921
-    void startPIDTune(const_float_t temp, extruder_t tool) {
921
+    void startPIDTune(const celsius_t temp, extruder_t tool) {
922
       thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
922
       thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
923
     }
923
     }
924
   #endif
924
   #endif
935
       thermalManager.updatePID();
935
       thermalManager.updatePID();
936
     }
936
     }
937
 
937
 
938
-    void startBedPIDTune(const_float_t temp) {
938
+    void startBedPIDTune(const celsius_t temp) {
939
       thermalManager.PID_autotune(temp, H_BED, 4, true);
939
       thermalManager.PID_autotune(temp, H_BED, 4, true);
940
     }
940
     }
941
   #endif
941
   #endif

+ 5
- 5
Marlin/src/lcd/tft/ui_1024x600.cpp View File

117
   celsius_t currentTemperature, targetTemperature;
117
   celsius_t currentTemperature, targetTemperature;
118
 
118
 
119
   if (Heater >= 0) { // HotEnd
119
   if (Heater >= 0) { // HotEnd
120
-    currentTemperature = thermalManager.degHotend(Heater);
120
+    currentTemperature = thermalManager.wholeDegHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
122
   }
122
   }
123
   #if HAS_HEATED_BED
123
   #if HAS_HEATED_BED
124
     else if (Heater == H_BED) {
124
     else if (Heater == H_BED) {
125
-      currentTemperature = thermalManager.degBed();
125
+      currentTemperature = thermalManager.wholeDegBed();
126
       targetTemperature = thermalManager.degTargetBed();
126
       targetTemperature = thermalManager.degTargetBed();
127
     }
127
     }
128
   #endif
128
   #endif
129
   #if HAS_TEMP_CHAMBER
129
   #if HAS_TEMP_CHAMBER
130
     else if (Heater == H_CHAMBER) {
130
     else if (Heater == H_CHAMBER) {
131
-      currentTemperature = thermalManager.degChamber();
131
+      currentTemperature = thermalManager.wholeDegChamber();
132
       #if HAS_HEATED_CHAMBER
132
       #if HAS_HEATED_CHAMBER
133
         targetTemperature = thermalManager.degTargetChamber();
133
         targetTemperature = thermalManager.degTargetChamber();
134
       #else
134
       #else
138
   #endif
138
   #endif
139
   #if HAS_TEMP_COOLER
139
   #if HAS_TEMP_COOLER
140
     else if (Heater == H_COOLER) {
140
     else if (Heater == H_COOLER) {
141
-      currentTemperature = thermalManager.degCooler();
141
+      currentTemperature = thermalManager.wholeDegCooler();
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
143
     }
143
     }
144
   #endif
144
   #endif
451
     tft_string.add('E');
451
     tft_string.add('E');
452
     tft_string.add((char)('1' + extruder));
452
     tft_string.add((char)('1' + extruder));
453
     tft_string.add(' ');
453
     tft_string.add(' ');
454
-    tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
454
+    tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
455
     tft_string.add(LCD_STR_DEGREE);
455
     tft_string.add(LCD_STR_DEGREE);
456
     tft_string.add(" / ");
456
     tft_string.add(" / ");
457
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
457
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));

+ 5
- 5
Marlin/src/lcd/tft/ui_320x240.cpp View File

117
   celsius_t currentTemperature, targetTemperature;
117
   celsius_t currentTemperature, targetTemperature;
118
 
118
 
119
   if (Heater >= 0) { // HotEnd
119
   if (Heater >= 0) { // HotEnd
120
-    currentTemperature = thermalManager.degHotend(Heater);
120
+    currentTemperature = thermalManager.wholeDegHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
122
   }
122
   }
123
   #if HAS_HEATED_BED
123
   #if HAS_HEATED_BED
124
     else if (Heater == H_BED) {
124
     else if (Heater == H_BED) {
125
-      currentTemperature = thermalManager.degBed();
125
+      currentTemperature = thermalManager.wholeDegBed();
126
       targetTemperature = thermalManager.degTargetBed();
126
       targetTemperature = thermalManager.degTargetBed();
127
     }
127
     }
128
   #endif
128
   #endif
129
   #if HAS_TEMP_CHAMBER
129
   #if HAS_TEMP_CHAMBER
130
     else if (Heater == H_CHAMBER) {
130
     else if (Heater == H_CHAMBER) {
131
-      currentTemperature = thermalManager.degChamber();
131
+      currentTemperature = thermalManager.wholeDegChamber();
132
       #if HAS_HEATED_CHAMBER
132
       #if HAS_HEATED_CHAMBER
133
         targetTemperature = thermalManager.degTargetChamber();
133
         targetTemperature = thermalManager.degTargetChamber();
134
       #else
134
       #else
138
   #endif
138
   #endif
139
   #if HAS_TEMP_COOLER
139
   #if HAS_TEMP_COOLER
140
     else if (Heater == H_COOLER) {
140
     else if (Heater == H_COOLER) {
141
-      currentTemperature = thermalManager.degCooler();
141
+      currentTemperature = thermalManager.wholeDegCooler();
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
143
     }
143
     }
144
   #endif
144
   #endif
438
     tft_string.add('E');
438
     tft_string.add('E');
439
     tft_string.add((char)('1' + extruder));
439
     tft_string.add((char)('1' + extruder));
440
     tft_string.add(' ');
440
     tft_string.add(' ');
441
-    tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
441
+    tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
442
     tft_string.add(LCD_STR_DEGREE);
442
     tft_string.add(LCD_STR_DEGREE);
443
     tft_string.add(" / ");
443
     tft_string.add(" / ");
444
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
444
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));

+ 5
- 5
Marlin/src/lcd/tft/ui_480x320.cpp View File

117
   celsius_t currentTemperature, targetTemperature;
117
   celsius_t currentTemperature, targetTemperature;
118
 
118
 
119
   if (Heater >= 0) { // HotEnd
119
   if (Heater >= 0) { // HotEnd
120
-    currentTemperature = thermalManager.degHotend(Heater);
120
+    currentTemperature = thermalManager.wholeDegHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
121
     targetTemperature = thermalManager.degTargetHotend(Heater);
122
   }
122
   }
123
   #if HAS_HEATED_BED
123
   #if HAS_HEATED_BED
124
     else if (Heater == H_BED) {
124
     else if (Heater == H_BED) {
125
-      currentTemperature = thermalManager.degBed();
125
+      currentTemperature = thermalManager.wholeDegBed();
126
       targetTemperature = thermalManager.degTargetBed();
126
       targetTemperature = thermalManager.degTargetBed();
127
     }
127
     }
128
   #endif
128
   #endif
129
   #if HAS_TEMP_CHAMBER
129
   #if HAS_TEMP_CHAMBER
130
     else if (Heater == H_CHAMBER) {
130
     else if (Heater == H_CHAMBER) {
131
-      currentTemperature = thermalManager.degChamber();
131
+      currentTemperature = thermalManager.wholeDegChamber();
132
       #if HAS_HEATED_CHAMBER
132
       #if HAS_HEATED_CHAMBER
133
         targetTemperature = thermalManager.degTargetChamber();
133
         targetTemperature = thermalManager.degTargetChamber();
134
       #else
134
       #else
138
   #endif
138
   #endif
139
   #if HAS_TEMP_COOLER
139
   #if HAS_TEMP_COOLER
140
     else if (Heater == H_COOLER) {
140
     else if (Heater == H_COOLER) {
141
-      currentTemperature = thermalManager.degCooler();
141
+      currentTemperature = thermalManager.wholeDegCooler();
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
142
       targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
143
     }
143
     }
144
   #endif
144
   #endif
438
     tft_string.add('E');
438
     tft_string.add('E');
439
     tft_string.add((char)('1' + extruder));
439
     tft_string.add((char)('1' + extruder));
440
     tft_string.add(' ');
440
     tft_string.add(' ');
441
-    tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
441
+    tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
442
     tft_string.add(LCD_STR_DEGREE);
442
     tft_string.add(LCD_STR_DEGREE);
443
     tft_string.add(" / ");
443
     tft_string.add(" / ");
444
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
444
     tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));

+ 2
- 2
Marlin/src/module/probe.cpp View File

383
 
383
 
384
     DEBUG_EOL();
384
     DEBUG_EOL();
385
 
385
 
386
-    TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.degHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
387
-    TERN_(WAIT_FOR_BED_HEAT,    if (bed_temp > thermalManager.degBed() + (TEMP_BED_WINDOW))    thermalManager.wait_for_bed_heating());
386
+    TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.wholeDegHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
387
+    TERN_(WAIT_FOR_BED_HEAT,    if (bed_temp > thermalManager.wholeDegBed() + (TEMP_BED_WINDOW))    thermalManager.wait_for_bed_heating());
388
   }
388
   }
389
 
389
 
390
 #endif
390
 #endif

+ 4
- 4
Marlin/src/module/temperature.cpp View File

499
    * Needs sufficient heater power to make some overshoot at target
499
    * Needs sufficient heater power to make some overshoot at target
500
    * temperature to succeed.
500
    * temperature to succeed.
501
    */
501
    */
502
-  void Temperature::PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
502
+  void Temperature::PID_autotune(const celsius_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
503
     float current_temp = 0.0;
503
     float current_temp = 0.0;
504
     int cycles = 0;
504
     int cycles = 0;
505
     bool heating = true;
505
     bool heating = true;
3815
       #define MIN_DELTA_SLOPE_TIME_PROBE 600
3815
       #define MIN_DELTA_SLOPE_TIME_PROBE 600
3816
     #endif
3816
     #endif
3817
 
3817
 
3818
-    bool Temperature::wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling/*=true*/) {
3818
+    bool Temperature::wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling/*=true*/) {
3819
 
3819
 
3820
-      const bool wants_to_cool = isProbeAboveTemp(target_temp);
3821
-      const bool will_wait = !(wants_to_cool && no_wait_for_cooling);
3820
+      const bool wants_to_cool = isProbeAboveTemp(target_temp),
3821
+                 will_wait = !(wants_to_cool && no_wait_for_cooling);
3822
       if (will_wait)
3822
       if (will_wait)
3823
         SERIAL_ECHOLNPAIR("Waiting for probe to ", (wants_to_cool ? PSTR("cool down") : PSTR("heat up")), " to ", target_temp, " degrees.");
3823
         SERIAL_ECHOLNPAIR("Waiting for probe to ", (wants_to_cool ? PSTR("cool down") : PSTR("heat up")), " to ", target_temp, " degrees.");
3824
 
3824
 

+ 19
- 15
Marlin/src/module/temperature.h View File

358
       static bool allow_cold_extrude;
358
       static bool allow_cold_extrude;
359
       static celsius_t extrude_min_temp;
359
       static celsius_t extrude_min_temp;
360
       static inline bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
360
       static inline bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
361
-      static inline bool tooColdToExtrude(const uint8_t E_NAME) {
362
-        return tooCold(degHotend(HOTEND_INDEX));
363
-      }
364
-      static inline bool targetTooColdToExtrude(const uint8_t E_NAME) {
365
-        return tooCold(degTargetHotend(HOTEND_INDEX));
366
-      }
361
+      static inline bool tooColdToExtrude(const uint8_t E_NAME)       { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
362
+      static inline bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
367
     #else
363
     #else
368
       static inline bool tooColdToExtrude(const uint8_t) { return false; }
364
       static inline bool tooColdToExtrude(const uint8_t) { return false; }
369
       static inline bool targetTooColdToExtrude(const uint8_t) { return false; }
365
       static inline bool targetTooColdToExtrude(const uint8_t) { return false; }
635
       return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
631
       return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
636
     }
632
     }
637
 
633
 
634
+    static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
635
+      return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
636
+    }
637
+
638
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
638
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
639
       static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
639
       static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
640
         return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
640
         return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
687
       #endif
687
       #endif
688
 
688
 
689
       static inline bool still_heating(const uint8_t e) {
689
       static inline bool still_heating(const uint8_t e) {
690
-        return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
690
+        return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(wholeDegHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
691
       }
691
       }
692
 
692
 
693
-      static inline bool degHotendNear(const uint8_t e, const_float_t temp) {
694
-        return ABS(degHotend(e) - temp) < (TEMP_HYSTERESIS);
693
+      static inline bool degHotendNear(const uint8_t e, const celsius_t temp) {
694
+        return ABS(wholeDegHotend(e) - temp) < (TEMP_HYSTERESIS);
695
       }
695
       }
696
 
696
 
697
     #endif // HAS_HOTEND
697
     #endif // HAS_HOTEND
702
         static inline int16_t rawBedTemp()    { return temp_bed.raw; }
702
         static inline int16_t rawBedTemp()    { return temp_bed.raw; }
703
       #endif
703
       #endif
704
       static inline celsius_t degBed()        { return temp_bed.celsius; }
704
       static inline celsius_t degBed()        { return temp_bed.celsius; }
705
+      static inline celsius_t wholeDegBed()   { return static_cast<celsius_t>(degBed() + 0.5f); }
705
       static inline celsius_t degTargetBed()  { return temp_bed.target; }
706
       static inline celsius_t degTargetBed()  { return temp_bed.target; }
706
       static inline bool isHeatingBed()       { return temp_bed.target > temp_bed.celsius; }
707
       static inline bool isHeatingBed()       { return temp_bed.target > temp_bed.celsius; }
707
       static inline bool isCoolingBed()       { return temp_bed.target < temp_bed.celsius; }
708
       static inline bool isCoolingBed()       { return temp_bed.target < temp_bed.celsius; }
726
 
727
 
727
       static void wait_for_bed_heating();
728
       static void wait_for_bed_heating();
728
 
729
 
729
-      static inline bool degBedNear(const_float_t temp) {
730
-        return ABS(degBed() - temp) < (TEMP_BED_HYSTERESIS);
730
+      static inline bool degBedNear(const celsius_t temp) {
731
+        return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS);
731
       }
732
       }
732
 
733
 
733
     #endif // HAS_HEATED_BED
734
     #endif // HAS_HEATED_BED
737
         static inline int16_t rawProbeTemp()    { return temp_probe.raw; }
738
         static inline int16_t rawProbeTemp()    { return temp_probe.raw; }
738
       #endif
739
       #endif
739
       static inline celsius_t degProbe()        { return temp_probe.celsius; }
740
       static inline celsius_t degProbe()        { return temp_probe.celsius; }
740
-      static inline bool isProbeBelowTemp(const_float_t target_temp) { return temp_probe.celsius < target_temp; }
741
-      static inline bool isProbeAboveTemp(const_float_t target_temp) { return temp_probe.celsius > target_temp; }
742
-      static bool wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling=true);
741
+      static inline celsius_t wholeDegProbe()   { return static_cast<celsius_t>(degProbe() + 0.5f); }
742
+      static inline bool isProbeBelowTemp(const celsius_t target_temp) { return wholeDegProbe() < target_temp; }
743
+      static inline bool isProbeAboveTemp(const celsius_t target_temp) { return wholeDegProbe() > target_temp; }
744
+      static bool wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling=true);
743
     #endif
745
     #endif
744
 
746
 
745
     #if WATCH_PROBE
747
     #if WATCH_PROBE
753
         static inline int16_t rawChamberTemp()      { return temp_chamber.raw; }
755
         static inline int16_t rawChamberTemp()      { return temp_chamber.raw; }
754
       #endif
756
       #endif
755
       static inline celsius_t degChamber()          { return temp_chamber.celsius; }
757
       static inline celsius_t degChamber()          { return temp_chamber.celsius; }
758
+      static inline celsius_t wholeDegChamber()     { return static_cast<celsius_t>(degChamber() + 0.5f); }
756
       #if HAS_HEATED_CHAMBER
759
       #if HAS_HEATED_CHAMBER
757
         static inline celsius_t degTargetChamber()  { return temp_chamber.target; }
760
         static inline celsius_t degTargetChamber()  { return temp_chamber.target; }
758
         static inline bool isHeatingChamber()       { return temp_chamber.target > temp_chamber.celsius; }
761
         static inline bool isHeatingChamber()       { return temp_chamber.target > temp_chamber.celsius; }
779
         static inline int16_t rawCoolerTemp()     { return temp_cooler.raw; }
782
         static inline int16_t rawCoolerTemp()     { return temp_cooler.raw; }
780
       #endif
783
       #endif
781
       static inline celsius_t degCooler()         { return temp_cooler.celsius; }
784
       static inline celsius_t degCooler()         { return temp_cooler.celsius; }
785
+      static inline celsius_t wholeDegCooler()    { return static_cast<celsius_t>(temp_cooler.celsius + 0.5f); }
782
       #if HAS_COOLER
786
       #if HAS_COOLER
783
         static inline celsius_t degTargetCooler() { return temp_cooler.target; }
787
         static inline celsius_t degTargetCooler() { return temp_cooler.target; }
784
         static inline bool isLaserHeating()       { return temp_cooler.target > temp_cooler.celsius; }
788
         static inline bool isLaserHeating()       { return temp_cooler.target > temp_cooler.celsius; }
827
         static bool pid_debug_flag;
831
         static bool pid_debug_flag;
828
       #endif
832
       #endif
829
 
833
 
830
-      static void PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
834
+      static void PID_autotune(const celsius_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
831
 
835
 
832
       #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
836
       #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
833
         static bool adaptive_fan_slowing;
837
         static bool adaptive_fan_slowing;

Loading…
Cancel
Save