Skip to content

Commit

Permalink
tweak, no "err°"
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 3, 2023
1 parent c3f38f4 commit 46727c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
1 change: 1 addition & 0 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr

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

// TODO: Option to allow negative temperature
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
lcd_put_u8str(F("/"));

Expand Down
31 changes: 20 additions & 11 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,27 @@
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)

FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
const char *str;
uint8_t len;
if (temp > 0) {
str = i16tostr3rj(temp);
len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
}
else {
str = "err";
len = 3;
const char *str;
uint8_t len;
if (temp < 0) {
#if DISABLED(SHOW_TEMPERATURE_ERROR_BELOW_ZERO)
lcd_put_u8str(tx + 1 - 3 * (INFO_FONT_WIDTH) / 2, ty, F("err"));
return;
#else
str = i16tostr3left(-temp);
len = strlen(str) + 1;
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
lcd_put_lchar('-');
#endif
}
else {
str = i16tostr3left(temp);
len = strlen(str);
lcd_moveto(tx + 1 - len * (INFO_FONT_WIDTH) / 2, ty);
}
lcd_put_u8str(str);
lcd_put_lchar(LCD_STR_DEGREE[0]);
}
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
if (temp > 0) lcd_put_lchar(LCD_STR_DEGREE[0]);
}

#if DO_DRAW_FLOWMETER
Expand Down

0 comments on commit 46727c2

Please sign in to comment.