Add typedef celsius_t (#21374)

This commit is contained in:
Scott Lahteine
2021-03-24 04:11:43 -05:00
committed by GitHub
parent 07c24e72ac
commit e5ff55a1be
35 changed files with 252 additions and 298 deletions

View File

@ -187,7 +187,7 @@
#define PROGRESS_BAR_Y (EXTRAS_BASELINE + 1)
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, const uint8_t ty) {
FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
const char *str = i16tostr3rj(temp);
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
@ -206,8 +206,8 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
const float temp = thermalManager.degHotend(heater_id),
target = thermalManager.degTargetHotend(heater_id);
const celsius_t temp = thermalManager.degHotend(heater_id),
target = thermalManager.degTargetHotend(heater_id);
#if DISABLED(STATUS_HOTEND_ANIM)
#define STATIC_HOTEND true
@ -277,11 +277,11 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#else
constexpr bool dodraw = true;
#endif
if (dodraw) _draw_centered_temp(target + 0.5, tx, 7);
if (dodraw) _draw_centered_temp(target, tx, 7);
}
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(temp + 0.5f, tx, 28);
_draw_centered_temp(temp, tx, 28);
if (STATIC_HOTEND && HOTEND_DOT && PAGE_CONTAINS(17, 19)) {
u8g.setColorIndex(0); // set to white on black
@ -303,8 +303,8 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
const uint8_t tx = STATUS_BED_TEXT_X;
const float temp = thermalManager.degBed(),
target = thermalManager.degTargetBed();
const celsius_t temp = thermalManager.degBed(),
target = thermalManager.degTargetBed();
#if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
const bool isHeat = BED_ALT();
@ -350,11 +350,11 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#else
constexpr bool dodraw = true;
#endif
if (dodraw) _draw_centered_temp(target + 0.5, tx, 7);
if (dodraw) _draw_centered_temp(target, tx, 7);
}
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(temp + 0.5f, tx, 28);
_draw_centered_temp(temp, tx, 28);
if (STATIC_BED && BED_DOT && PAGE_CONTAINS(17, 19)) {
u8g.setColorIndex(0); // set to white on black
@ -370,10 +370,10 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
FORCE_INLINE void _draw_chamber_status() {
#if HAS_HEATED_CHAMBER
if (PAGE_UNDER(7))
_draw_centered_temp(thermalManager.degTargetChamber() + 0.5f, STATUS_CHAMBER_TEXT_X, 7);
_draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
#endif
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(thermalManager.degChamber() + 0.5f, STATUS_CHAMBER_TEXT_X, 28);
_draw_centered_temp(thermalManager.degChamber(), STATUS_CHAMBER_TEXT_X, 28);
}
#endif

View File

@ -691,15 +691,15 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
// We only add the target temperatures to the checksum
// because the actual temps fluctuate so by updating
// them only during blinks we gain a bit of stability.
const bool blink = ui.get_blink();
const uint16_t feedrate_perc = feedrate_percentage;
const uint16_t fs = thermalManager.scaledFanSpeed(0);
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
const bool blink = ui.get_blink();
const uint16_t feedrate_perc = feedrate_percentage;
const uint16_t fs = thermalManager.scaledFanSpeed(0);
const celsius_t extruder_1_target = thermalManager.degTargetHotend(0);
#if HAS_MULTI_HOTEND
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
const celsius_t extruder_2_target = thermalManager.degTargetHotend(1);
#endif
#if HAS_HEATED_BED
const int16_t bed_target = thermalManager.degTargetBed();
const celsius_t bed_target = thermalManager.degTargetBed();
#endif
static uint16_t last_checksum = 0;
const uint16_t checksum = blink ^ feedrate_perc ^ fs ^ extruder_1_target
@ -712,19 +712,19 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
if (forceUpdate || indicators_changed()) {
const bool blink = ui.get_blink();
const duration_t elapsed = print_job_timer.duration();
duration_t remaining = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
const uint16_t feedrate_perc = feedrate_percentage;
const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0);
const bool blink = ui.get_blink();
const duration_t elapsed = print_job_timer.duration();
duration_t remaining = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
const uint16_t feedrate_perc = feedrate_percentage;
const celsius_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0);
#if HAS_MULTI_HOTEND
const int16_t extruder_2_temp = thermalManager.degHotend(1),
extruder_2_target = thermalManager.degTargetHotend(1);
const celsius_t extruder_2_temp = thermalManager.degHotend(1),
extruder_2_target = thermalManager.degTargetHotend(1);
#endif
#if HAS_HEATED_BED
const int16_t bed_temp = thermalManager.degBed(),
bed_target = thermalManager.degTargetBed();
const celsius_t bed_temp = thermalManager.degBed(),
bed_target = thermalManager.degTargetBed();
#endif
draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate);