Skip to content

Commit 46727c2

Browse files
committed
tweak, no "err°"
1 parent c3f38f4 commit 46727c2

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

Marlin/src/lcd/HD44780/marlinui_HD44780.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ 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+
// TODO: Option to allow negative temperature
549550
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
550551
lcd_put_u8str(F("/"));
551552

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+20-11
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,27 @@
192192
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
193193

194194
FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
195-
const char *str;
196-
uint8_t len;
197-
if (temp > 0) {
198-
str = i16tostr3rj(temp);
199-
len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
200-
}
201-
else {
202-
str = "err";
203-
len = 3;
195+
const char *str;
196+
uint8_t len;
197+
if (temp < 0) {
198+
#if DISABLED(SHOW_TEMPERATURE_ERROR_BELOW_ZERO)
199+
lcd_put_u8str(tx + 1 - 3 * (INFO_FONT_WIDTH) / 2, ty, F("err"));
200+
return;
201+
#else
202+
str = i16tostr3left(-temp);
203+
len = strlen(str) + 1;
204+
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
205+
lcd_put_lchar('-');
206+
#endif
207+
}
208+
else {
209+
str = i16tostr3left(temp);
210+
len = strlen(str);
211+
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
212+
}
213+
lcd_put_u8str(str);
214+
lcd_put_lchar(LCD_STR_DEGREE[0]);
204215
}
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]);
207216
}
208217

209218
#if DO_DRAW_FLOWMETER

0 commit comments

Comments
 (0)