Skip to content

Commit 2427499

Browse files
committed
tweak, no "err°", HD44780
1 parent c3f38f4 commit 2427499

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

Marlin/src/lcd/HD44780/marlinui_HD44780.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
537537
*/
538538
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
539539
#if HAS_HEATED_BED
540-
const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0);
540+
const bool isBed = heater_id == H_BED;
541541
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
542542
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
543543
#else
@@ -546,7 +546,17 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
546546

547547
if (prefix >= 0) lcd_put_lchar(prefix);
548548

549-
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
549+
if (t1 < 0) {
550+
#if ENABLED(SHOW_TEMPERATURE_BELOW_ZERO)
551+
char * const str = i16tostr3rj(t1);
552+
lcd_put_u8str(&str[1]);
553+
#else
554+
lcd_put_u8str(F("err"));
555+
#endif
556+
}
557+
else
558+
lcd_put_u8str(ui16tostr3rj(t1));
559+
550560
lcd_put_u8str(F("/"));
551561

552562
#if !HEATER_IDLE_HANDLER

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+15-7
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,24 @@
194194
FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
195195
const char *str;
196196
uint8_t len;
197-
if (temp > 0) {
198-
str = i16tostr3rj(temp);
199-
len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
197+
if (temp < 0) {
198+
#if ENABLED(SHOW_TEMPERATURE_BELOW_ZERO)
199+
str = i16tostr3left((-temp) % 100);
200+
len = strlen(str) + 1;
201+
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
202+
lcd_put_lchar('-');
203+
#else
204+
lcd_put_u8str(tx + 1 - 3 * (INFO_FONT_WIDTH) / 2, ty, F("err"));
205+
return;
206+
#endif
200207
}
201208
else {
202-
str = "err";
203-
len = 3;
209+
str = i16tostr3left(temp);
210+
len = strlen(str);
211+
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
204212
}
205-
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
206-
if (temp > 0) lcd_put_lchar(LCD_STR_DEGREE[0]);
213+
lcd_put_u8str(str);
214+
lcd_put_lchar(LCD_STR_DEGREE[0]);
207215
}
208216

209217
#if DO_DRAW_FLOWMETER

0 commit comments

Comments
 (0)