瀏覽代碼

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

Scott Lahteine 3 年之前
父節點
當前提交
c4620bb528
No account linked to committer's email address

+ 6
- 6
Marlin/src/feature/leds/printer_event_leds.cpp 查看文件

@@ -40,9 +40,9 @@ PrinterEventLEDs printerEventLEDs;
40 40
 
41 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 48
   inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
@@ -58,7 +58,7 @@ PrinterEventLEDs printerEventLEDs;
58 58
 
59 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 62
     const uint8_t blue = pel_intensity(start, current, target);
63 63
     if (blue != old_intensity) {
64 64
       old_intensity = blue;
@@ -70,7 +70,7 @@ PrinterEventLEDs printerEventLEDs;
70 70
 
71 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 74
     const uint8_t red = pel_intensity(start, current, target);
75 75
     if (red != old_intensity) {
76 76
       old_intensity = red;
@@ -82,7 +82,7 @@ PrinterEventLEDs printerEventLEDs;
82 82
 
83 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 86
     const uint8_t green = pel_intensity(start, current, target);
87 87
     if (green != old_intensity) {
88 88
       old_intensity = green;

+ 4
- 4
Marlin/src/feature/leds/printer_event_leds.h 查看文件

@@ -41,21 +41,21 @@ private:
41 41
 public:
42 42
   #if HAS_TEMP_HOTEND
43 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 45
   #endif
46 46
 
47 47
   #if HAS_HEATED_BED
48 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 50
   #endif
51 51
 
52 52
   #if HAS_HEATED_CHAMBER
53 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 55
   #endif
56 56
 
57 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 59
     static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
60 60
   #endif
61 61
 

+ 3
- 3
Marlin/src/feature/leds/tempstat.cpp 查看文件

@@ -36,10 +36,10 @@ void handle_status_leds() {
36 36
   static millis_t next_status_led_update_ms = 0;
37 37
   if (ELAPSED(millis(), next_status_led_update_ms)) {
38 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 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 43
     if (new_red != old_red) {
44 44
       old_red = new_red;
45 45
       #if PIN_EXISTS(STAT_LED_RED)

+ 1
- 1
Marlin/src/feature/pause.cpp 查看文件

@@ -143,7 +143,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
143 143
 
144 144
   // Allow interruption by Emergency Parser M108
145 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 147
     idle();
148 148
   wait_for_heatup = false;
149 149
 

+ 14
- 13
Marlin/src/feature/probe_temp_comp.cpp 查看文件

@@ -71,7 +71,7 @@ bool ProbeTempComp::set_offset(const TempSensorID tsi, const uint8_t idx, const
71 71
 
72 72
 void ProbeTempComp::print_offsets() {
73 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 75
     for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
76 76
       SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
77 77
         #if ENABLED(USE_TEMP_EXT_COMPENSATION)
@@ -114,8 +114,8 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
114 114
   }
115 115
 
116 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 119
   int16_t * const data = sensor_z_offsets[tsi];
120 120
 
121 121
   // Extrapolate
@@ -159,19 +159,19 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
159 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 163
   if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp))
164 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 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 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 177
   auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) {
@@ -207,17 +207,18 @@ bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d
207 207
 
208 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 212
   const int16_t * const data = sensor_z_offsets[tsi];
213 213
 
214 214
   float sum_x = start_temp,
215 215
         sum_x2 = sq(start_temp),
216 216
         sum_xy = 0, sum_y = 0;
217 217
 
218
+  float xi = static_cast<float>(start_temp);
218 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 222
     sum_x += xi;
222 223
     sum_x2 += sq(xi);
223 224
     sum_xy += xi * yi;

+ 11
- 11
Marlin/src/feature/probe_temp_comp.h 查看文件

@@ -34,9 +34,9 @@ enum TempSensorID : uint8_t {
34 34
 
35 35
 typedef struct {
36 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 40
 } temp_calib_t;
41 41
 
42 42
 /**
@@ -50,25 +50,25 @@ typedef struct {
50 50
   #define PTC_SAMPLE_COUNT 10U
51 51
 #endif
52 52
 #ifndef PTC_SAMPLE_RES
53
-  #define PTC_SAMPLE_RES 5.0f
53
+  #define PTC_SAMPLE_RES 5
54 54
 #endif
55 55
 #ifndef PTC_SAMPLE_START
56
-  #define PTC_SAMPLE_START 30.0f
56
+  #define PTC_SAMPLE_START 30
57 57
 #endif
58 58
 #define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES))
59 59
 
60 60
 // Bed temperature calibration constants
61 61
 #ifndef BTC_PROBE_TEMP
62
-  #define BTC_PROBE_TEMP 30.0f
62
+  #define BTC_PROBE_TEMP 30
63 63
 #endif
64 64
 #ifndef BTC_SAMPLE_COUNT
65 65
   #define BTC_SAMPLE_COUNT 10U
66 66
 #endif
67 67
 #ifndef BTC_SAMPLE_STEP
68
-  #define BTC_SAMPLE_RES 5.0f
68
+  #define BTC_SAMPLE_RES 5
69 69
 #endif
70 70
 #ifndef BTC_SAMPLE_START
71
-  #define BTC_SAMPLE_START 60.0f
71
+  #define BTC_SAMPLE_START 60
72 72
 #endif
73 73
 #define BTC_SAMPLE_END ((BTC_SAMPLE_START) + (BTC_SAMPLE_COUNT) * (BTC_SAMPLE_RES))
74 74
 
@@ -77,7 +77,7 @@ typedef struct {
77 77
 #endif
78 78
 
79 79
 #ifndef PTC_PROBE_RAISE
80
-  #define PTC_PROBE_RAISE 10.0f
80
+  #define PTC_PROBE_RAISE 10
81 81
 #endif
82 82
 
83 83
 static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
@@ -124,7 +124,7 @@ class ProbeTempComp {
124 124
     static void prepare_new_calibration(const_float_t init_meas_z);
125 125
     static void push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z);
126 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 129
   private:
130 130
     static uint8_t calib_idx;
@@ -135,7 +135,7 @@ class ProbeTempComp {
135 135
      */
136 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 141
      * Fit a linear function in measured temperature offsets

+ 5
- 5
Marlin/src/gcode/calibrate/G76_M192_M871.cpp 查看文件

@@ -103,9 +103,9 @@ void GcodeSuite::G76() {
103 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 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 109
       if (report_temps(ntr, timeout)) return true;
110 110
     return false;
111 111
   };
@@ -180,7 +180,7 @@ void GcodeSuite::G76() {
180 180
             target_probe = temp_comp.bed_calib_probe_temp;
181 181
 
182 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 184
       report_temps(next_temp_report);
185 185
 
186 186
     // Disable leveling so it won't mess with us
@@ -204,7 +204,7 @@ void GcodeSuite::G76() {
204 204
       do_blocking_move_to(noz_pos_xyz);
205 205
       say_waiting_for_probe_heating();
206 206
       SERIAL_EOL();
207
-      while (thermalManager.degProbe() < target_probe)
207
+      while (thermalManager.wholeDegProbe() < target_probe)
208 208
         report_temps(next_temp_report);
209 209
 
210 210
       const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
@@ -350,7 +350,7 @@ void GcodeSuite::M192() {
350 350
     return;
351 351
   }
352 352
 
353
-  const float target_temp = parser.value_celsius();
353
+  const celsius_t target_temp = parser.value_celsius();
354 354
   ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING));
355 355
   thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
356 356
 }

+ 5
- 5
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp 查看文件

@@ -525,10 +525,10 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
525 525
 FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
526 526
   #if HAS_HEATED_BED
527 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 529
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
530 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 532
   #endif
533 533
 
534 534
   if (prefix >= 0) lcd_put_wchar(prefix);
@@ -557,11 +557,11 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
557 557
 
558 558
 #if HAS_COOLER
559 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 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 565
   lcd_put_wchar('/');
566 566
 
567 567
   #if !HEATER_IDLE_HANDLER
@@ -574,7 +574,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
574 574
     }
575 575
     else
576 576
   #endif
577
-      lcd_put_u8str(i16tostr3left(t2 + 0.5));
577
+      lcd_put_u8str(i16tostr3left(t2));
578 578
 
579 579
   if (prefix >= 0) {
580 580
     lcd_put_wchar(LCD_STR_DEGREE[0]);

+ 3
- 3
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp 查看文件

@@ -434,10 +434,10 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
434 434
   uint8_t pic_hot_bits;
435 435
   #if HAS_HEATED_BED
436 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 438
                     t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
439 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 441
   #endif
442 442
 
443 443
   #if HOTENDS < 2
@@ -803,7 +803,7 @@ void MarlinUI::draw_status_screen() {
803 803
       if (!PanelDetected) return;
804 804
       lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
805 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 807
       lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
808 808
       lcd.print_line();
809 809
     }

+ 1
- 1
Marlin/src/lcd/dogm/marlinui_DOGM.cpp 查看文件

@@ -324,7 +324,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
324 324
       lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
325 325
       lcd_put_wchar((char)('1' + extruder));
326 326
       lcd_put_wchar(' ');
327
-      lcd_put_u8str(i16tostr3rj(thermalManager.degHotend(extruder)));
327
+      lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
328 328
       lcd_put_wchar('/');
329 329
 
330 330
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)

+ 4
- 4
Marlin/src/lcd/dogm/status_screen_DOGM.cpp 查看文件

@@ -213,7 +213,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
213 213
 
214 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 217
                   target = thermalManager.degTargetHotend(heater_id);
218 218
 
219 219
     #if DISABLED(STATUS_HOTEND_ANIM)
@@ -310,7 +310,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
310 310
 
311 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 314
                   target = thermalManager.degTargetBed();
315 315
 
316 316
     #if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
@@ -380,14 +380,14 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
380 380
         _draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
381 381
     #endif
382 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 385
 #endif
386 386
 
387 387
 #if DO_DRAW_COOLER
388 388
   FORCE_INLINE void _draw_cooler_status() {
389 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 392
 #endif
393 393
 

+ 3
- 3
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp 查看文件

@@ -721,14 +721,14 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
721 721
     const duration_t elapsed            = print_job_timer.duration();
722 722
     duration_t       remaining          = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
723 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 725
                      extruder_1_target  = thermalManager.degTargetHotend(0);
726 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 728
                       extruder_2_target = thermalManager.degTargetHotend(1);
729 729
     #endif
730 730
     #if HAS_HEATED_BED
731
-      const celsius_t bed_temp          = thermalManager.degBed(),
731
+      const celsius_t bed_temp          = thermalManager.wholeDegBed(),
732 732
                       bed_target        = thermalManager.degTargetBed();
733 733
     #endif
734 734
 

+ 5
- 5
Marlin/src/lcd/dwin/e3v2/dwin.cpp 查看文件

@@ -1583,7 +1583,7 @@ void _draw_xyz_position(const bool force) {
1583 1583
 void update_variable() {
1584 1584
   #if HAS_HOTEND
1585 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 1587
                     ht = thermalManager.degTargetHotend(0);
1588 1588
     const bool _new_hotend_temp = _hotendtemp != hc,
1589 1589
                _new_hotend_target = _hotendtarget != ht;
@@ -1592,7 +1592,7 @@ void update_variable() {
1592 1592
   #endif
1593 1593
   #if HAS_HEATED_BED
1594 1594
     static celsius_t _bedtemp = 0, _bedtarget = 0;
1595
-    const celsius_t bc = thermalManager.degBed(),
1595
+    const celsius_t bc = thermalManager.wholeDegBed(),
1596 1596
                     bt = thermalManager.degTargetBed();
1597 1597
     const bool _new_bed_temp = _bedtemp != bc,
1598 1598
                _new_bed_target = _bedtarget != bt;
@@ -1880,7 +1880,7 @@ void Draw_Status_Area(const bool with_update) {
1880 1880
 
1881 1881
   #if HAS_HOTEND
1882 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 1884
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1885 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,7 +1891,7 @@ void Draw_Status_Area(const bool with_update) {
1891 1891
 
1892 1892
   #if HAS_HEATED_BED
1893 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 1895
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1896 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 1897
   #endif
@@ -2709,7 +2709,7 @@ void HMI_AxisMove() {
2709 2709
           case 4: // Extruder
2710 2710
             // window tips
2711 2711
             #ifdef PREVENT_COLD_EXTRUSION
2712
-              if (thermalManager.degHotend(0) < EXTRUDE_MINTEMP) {
2712
+              if (thermalManager.wholeDegHotend(0) < (EXTRUDE_MINTEMP)) {
2713 2713
                 HMI_flag.ETempTooLow_flag = true;
2714 2714
                 Popup_Window_ETempTooLow();
2715 2715
                 DWIN_UpdateLCD();

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp 查看文件

@@ -486,7 +486,7 @@ void lv_draw_dialog(uint8_t type) {
486 486
 
487 487
 void filament_sprayer_temp() {
488 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 491
   strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
492 492
   strcat_P(public_buf_l, PSTR(": "));
@@ -522,7 +522,7 @@ void filament_dialog_handle() {
522 522
   }
523 523
 
524 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 526
     if (abs(diff) < 2 || diff > 0) {
527 527
       uiCfg.filament_load_heat_flg = false;
528 528
       lv_clear_dialog();
@@ -538,7 +538,7 @@ void filament_dialog_handle() {
538 538
   }
539 539
 
540 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 542
     if (abs(diff) < 2 || diff > 0) {
543 543
       uiCfg.filament_unload_heat_flg = false;
544 544
       lv_clear_dialog();

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp 查看文件

@@ -195,7 +195,7 @@ void disp_ext_speed() {
195 195
 
196 196
 void disp_hotend_temp() {
197 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 199
   strcpy(public_buf_l, extrude_menu.temper_text);
200 200
   strcat(public_buf_l, buf);
201 201
   lv_label_set_text(tempText, public_buf_l);

+ 5
- 5
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp 查看文件

@@ -50,8 +50,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
50 50
   switch (obj->mks_obj_id) {
51 51
     case ID_FILAMNT_IN:
52 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 55
         lv_clear_filament_change();
56 56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
57 57
       }
@@ -67,8 +67,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
67 67
     case ID_FILAMNT_OUT:
68 68
       uiCfg.filament_unload_heat_flg = true;
69 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 73
         lv_clear_filament_change();
74 74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
@@ -154,7 +154,7 @@ void disp_filament_temp() {
154 154
   public_buf_l[0] = '\0';
155 155
 
156 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 159
   strcat_P(public_buf_l, PSTR(": "));
160 160
   strcat(public_buf_l, buf);

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp 查看文件

@@ -216,12 +216,12 @@ void disp_desire_temp() {
216 216
 
217 217
   if (uiCfg.curTempType == 0) {
218 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 221
   else {
222 222
     #if HAS_HEATED_BED
223 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 225
     #endif
226 226
   }
227 227
   strcat_P(public_buf_l, PSTR(": "));

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp 查看文件

@@ -219,18 +219,18 @@ void lv_draw_printing() {
219 219
 }
220 220
 
221 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 223
   lv_label_set_text(labelExt1, public_buf_l);
224 224
 
225 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 227
     lv_label_set_text(labelExt2, public_buf_l);
228 228
   #endif
229 229
 }
230 230
 
231 231
 void disp_bed_temp() {
232 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 234
     lv_label_set_text(labelBed, public_buf_l);
235 235
   #endif
236 236
 }

+ 12
- 12
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp 查看文件

@@ -104,14 +104,14 @@ void disp_det_error() {
104 104
 lv_obj_t *e1, *e2, *e3, *bed;
105 105
 void mks_disp_test() {
106 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 108
   lv_label_set_text(e1, buf);
109 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 111
     lv_label_set_text(e2, buf);
112 112
   #endif
113 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 115
     lv_label_set_text(bed, buf);
116 116
   #endif
117 117
 }
@@ -138,20 +138,20 @@ void lv_draw_ready_print() {
138 138
 
139 139
     e1 = lv_label_create_empty(scr);
140 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 142
     lv_label_set_text(e1, buf);
143 143
 
144 144
     #if HAS_MULTI_HOTEND
145 145
       e2 = lv_label_create_empty(scr);
146 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 148
       lv_label_set_text(e2, buf);
149 149
     #endif
150 150
 
151 151
     #if HAS_HEATED_BED
152 152
       bed = lv_label_create_empty(scr);
153 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 155
       lv_label_set_text(bed, buf);
156 156
     #endif
157 157
 
@@ -219,7 +219,7 @@ void lv_draw_ready_print() {
219 219
     itoa(thermalManager.degHotend(0), buf, 10);
220 220
     lv_label_set_text(labelExt1, buf);
221 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 223
     lv_label_set_text(labelExt1Target, buf);
224 224
     lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
225 225
 
@@ -227,7 +227,7 @@ void lv_draw_ready_print() {
227 227
       itoa(thermalManager.degHotend(1), buf, 10);
228 228
       lv_label_set_text(labelExt2, buf);
229 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 231
       lv_label_set_text(labelExt2Target, buf);
232 232
       lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
233 233
     #endif
@@ -236,7 +236,7 @@ void lv_draw_ready_print() {
236 236
       itoa(thermalManager.degBed(), buf, 10);
237 237
       lv_label_set_text(labelBed, buf);
238 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 240
       lv_label_set_text(labelBedTarget, buf);
241 241
       lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
242 242
     #endif
@@ -257,15 +257,15 @@ void lv_draw_ready_print() {
257 257
 
258 258
 void lv_temp_refr() {
259 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 261
     lv_label_set_text(labelBed, public_buf_l);
262 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 265
   lv_label_set_text(labelExt1, public_buf_l);
266 266
 
267 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 269
     lv_label_set_text(labelExt2, public_buf_l);
270 270
   #endif
271 271
 }

+ 7
- 7
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp 查看文件

@@ -885,7 +885,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
885 885
             char *outBuf = (char *)tempBuf;
886 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 890
             const int tlen = strlen(tbuf);
891 891
 
@@ -895,7 +895,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
895 895
             strcpy_P(outBuf, PSTR(" B:"));
896 896
             outBuf += 3;
897 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 899
             #else
900 900
               strcpy_P(outBuf, PSTR("0 /0"));
901 901
             #endif
@@ -908,7 +908,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
908 908
             strcat_P(outBuf, PSTR(" T1:"));
909 909
             outBuf += 4;
910 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 912
             #else
913 913
               strcat_P(outBuf, PSTR("0 /0"));
914 914
             #endif
@@ -918,15 +918,15 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
918 918
           }
919 919
           else {
920 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 922
               #if HAS_HEATED_BED
923
-                thermalManager.degBed(), thermalManager.degTargetBed(),
923
+                thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
924 924
               #else
925 925
                 0, 0,
926 926
               #endif
927
-              thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
927
+              thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
928 928
               #if HAS_MULTI_HOTEND
929
-                thermalManager.degHotend(1), thermalManager.degTargetHotend(1)
929
+                thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)
930 930
               #else
931 931
                 0, 0
932 932
               #endif

+ 4
- 4
Marlin/src/lcd/extui/malyan_lcd.cpp 查看文件

@@ -172,9 +172,9 @@ void process_lcd_eb_command(const char *command) {
172 172
 
173 173
       sprintf_P(message_buffer,
174 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 176
         #if HAS_HEATED_BED
177
-          int(thermalManager.degBed()), thermalManager.degTargetBed(),
177
+          thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
178 178
         #else
179 179
           0, 0,
180 180
         #endif
@@ -303,9 +303,9 @@ void process_lcd_s_command(const char *command) {
303 303
       // temperature information
304 304
       char message_buffer[MAX_CURLY_COMMAND];
305 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 307
         #if HAS_HEATED_BED
308
-          int(thermalManager.degBed()), thermalManager.degTargetBed()
308
+          thermalManager.wholeDegBed(), thermalManager.degTargetBed()
309 309
         #else
310 310
           0, 0
311 311
         #endif

+ 2
- 2
Marlin/src/lcd/extui/ui_api.cpp 查看文件

@@ -918,7 +918,7 @@ namespace ExtUI {
918 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 922
       thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
923 923
     }
924 924
   #endif
@@ -935,7 +935,7 @@ namespace ExtUI {
935 935
       thermalManager.updatePID();
936 936
     }
937 937
 
938
-    void startBedPIDTune(const_float_t temp) {
938
+    void startBedPIDTune(const celsius_t temp) {
939 939
       thermalManager.PID_autotune(temp, H_BED, 4, true);
940 940
     }
941 941
   #endif

+ 5
- 5
Marlin/src/lcd/tft/ui_1024x600.cpp 查看文件

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

+ 5
- 5
Marlin/src/lcd/tft/ui_320x240.cpp 查看文件

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

+ 5
- 5
Marlin/src/lcd/tft/ui_480x320.cpp 查看文件

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

+ 2
- 2
Marlin/src/module/probe.cpp 查看文件

@@ -383,8 +383,8 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
383 383
 
384 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 390
 #endif

+ 4
- 4
Marlin/src/module/temperature.cpp 查看文件

@@ -499,7 +499,7 @@ volatile bool Temperature::raw_temps_ready = false;
499 499
    * Needs sufficient heater power to make some overshoot at target
500 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 503
     float current_temp = 0.0;
504 504
     int cycles = 0;
505 505
     bool heating = true;
@@ -3815,10 +3815,10 @@ void Temperature::isr() {
3815 3815
       #define MIN_DELTA_SLOPE_TIME_PROBE 600
3816 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 3822
       if (will_wait)
3823 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 查看文件

@@ -358,12 +358,8 @@ class Temperature {
358 358
       static bool allow_cold_extrude;
359 359
       static celsius_t extrude_min_temp;
360 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 363
     #else
368 364
       static inline bool tooColdToExtrude(const uint8_t) { return false; }
369 365
       static inline bool targetTooColdToExtrude(const uint8_t) { return false; }
@@ -635,6 +631,10 @@ class Temperature {
635 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 638
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
639 639
       static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
640 640
         return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
@@ -687,11 +687,11 @@ class Temperature {
687 687
       #endif
688 688
 
689 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 697
     #endif // HAS_HOTEND
@@ -702,6 +702,7 @@ class Temperature {
702 702
         static inline int16_t rawBedTemp()    { return temp_bed.raw; }
703 703
       #endif
704 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 706
       static inline celsius_t degTargetBed()  { return temp_bed.target; }
706 707
       static inline bool isHeatingBed()       { return temp_bed.target > temp_bed.celsius; }
707 708
       static inline bool isCoolingBed()       { return temp_bed.target < temp_bed.celsius; }
@@ -726,8 +727,8 @@ class Temperature {
726 727
 
727 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 734
     #endif // HAS_HEATED_BED
@@ -737,9 +738,10 @@ class Temperature {
737 738
         static inline int16_t rawProbeTemp()    { return temp_probe.raw; }
738 739
       #endif
739 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 745
     #endif
744 746
 
745 747
     #if WATCH_PROBE
@@ -753,6 +755,7 @@ class Temperature {
753 755
         static inline int16_t rawChamberTemp()      { return temp_chamber.raw; }
754 756
       #endif
755 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 759
       #if HAS_HEATED_CHAMBER
757 760
         static inline celsius_t degTargetChamber()  { return temp_chamber.target; }
758 761
         static inline bool isHeatingChamber()       { return temp_chamber.target > temp_chamber.celsius; }
@@ -779,6 +782,7 @@ class Temperature {
779 782
         static inline int16_t rawCoolerTemp()     { return temp_cooler.raw; }
780 783
       #endif
781 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 786
       #if HAS_COOLER
783 787
         static inline celsius_t degTargetCooler() { return temp_cooler.target; }
784 788
         static inline bool isLaserHeating()       { return temp_cooler.target > temp_cooler.celsius; }
@@ -827,7 +831,7 @@ class Temperature {
827 831
         static bool pid_debug_flag;
828 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 836
       #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
833 837
         static bool adaptive_fan_slowing;

Loading…
取消
儲存