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

This commit is contained in:
Scott Lahteine
2021-04-23 20:19:23 -05:00
committed by GitHub
parent 384e09aa7c
commit c4620bb528
28 changed files with 144 additions and 139 deletions

View File

@ -486,7 +486,7 @@ void lv_draw_dialog(uint8_t type) {
void filament_sprayer_temp() {
char buf[20] = {0};
sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
strcat_P(public_buf_l, PSTR(": "));
@ -522,7 +522,7 @@ void filament_dialog_handle() {
}
if (uiCfg.filament_load_heat_flg) {
const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
if (abs(diff) < 2 || diff > 0) {
uiCfg.filament_load_heat_flg = false;
lv_clear_dialog();
@ -538,7 +538,7 @@ void filament_dialog_handle() {
}
if (uiCfg.filament_unload_heat_flg) {
const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
if (abs(diff) < 2 || diff > 0) {
uiCfg.filament_unload_heat_flg = false;
lv_clear_dialog();

View File

@ -195,7 +195,7 @@ void disp_ext_speed() {
void disp_hotend_temp() {
char buf[20] = {0};
sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
sprintf(buf, extrude_menu.temp_value, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcpy(public_buf_l, extrude_menu.temper_text);
strcat(public_buf_l, buf);
lv_label_set_text(tempText, public_buf_l);

View File

@ -50,8 +50,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_FILAMNT_IN:
uiCfg.filament_load_heat_flg = true;
if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1
|| gCfgItems.filament_limit_temp <= thermalManager.degHotend(uiCfg.extruderIndex)) {
if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)) {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
}
@ -67,8 +67,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_FILAMNT_OUT:
uiCfg.filament_unload_heat_flg = true;
if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
&& (abs((int)(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1
|| thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
&& (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|| thermalManager.wholeDegHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
) {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
@ -154,7 +154,7 @@ void disp_filament_temp() {
public_buf_l[0] = '\0';
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf);

View File

@ -216,12 +216,12 @@ void disp_desire_temp() {
if (uiCfg.curTempType == 0) {
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
}
else {
#if HAS_HEATED_BED
strcat(public_buf_l, preheat_menu.hotbed);
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
#endif
}
strcat_P(public_buf_l, PSTR(": "));

View File

@ -219,18 +219,18 @@ void lv_draw_printing() {
}
void disp_ext_temp() {
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1, public_buf_l);
#if HAS_MULTI_EXTRUDER
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2, public_buf_l);
#endif
}
void disp_bed_temp() {
#if HAS_HEATED_BED
sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
lv_label_set_text(labelBed, public_buf_l);
#endif
}

View File

@ -104,14 +104,14 @@ void disp_det_error() {
lv_obj_t *e1, *e2, *e3, *bed;
void mks_disp_test() {
char buf[30] = {0};
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
sprintf_P(buf, PSTR("e1:%d"), thermalManager.wholeDegHotend(0));
lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
sprintf_P(buf, PSTR("e2:%d"), thermalManager.wholeDegHotend(1));
lv_label_set_text(e2, buf);
#endif
#if HAS_HEATED_BED
sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.degBed());
sprintf_P(buf, PSTR("bed:%d"), thermalManager.wholeDegBed());
lv_label_set_text(bed, buf);
#endif
}
@ -138,20 +138,20 @@ void lv_draw_ready_print() {
e1 = lv_label_create_empty(scr);
lv_obj_set_pos(e1, 20, 20);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
sprintf_P(buf, PSTR("e1: %d"), thermalManager.wholeDegHotend(0));
lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND
e2 = lv_label_create_empty(scr);
lv_obj_set_pos(e2, 20, 45);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
sprintf_P(buf, PSTR("e1: %d"), thermalManager.wholeDegHotend(1));
lv_label_set_text(e2, buf);
#endif
#if HAS_HEATED_BED
bed = lv_label_create_empty(scr);
lv_obj_set_pos(bed, 20, 95);
sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.degBed());
sprintf_P(buf, PSTR("bed: %d"), thermalManager.wholeDegBed());
lv_label_set_text(bed, buf);
#endif
@ -219,7 +219,7 @@ void lv_draw_ready_print() {
itoa(thermalManager.degHotend(0), buf, 10);
lv_label_set_text(labelExt1, buf);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1Target, buf);
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
@ -227,7 +227,7 @@ void lv_draw_ready_print() {
itoa(thermalManager.degHotend(1), buf, 10);
lv_label_set_text(labelExt2, buf);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2Target, buf);
lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#endif
@ -236,7 +236,7 @@ void lv_draw_ready_print() {
itoa(thermalManager.degBed(), buf, 10);
lv_label_set_text(labelBed, buf);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
lv_label_set_text(labelBedTarget, buf);
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#endif
@ -257,15 +257,15 @@ void lv_draw_ready_print() {
void lv_temp_refr() {
#if HAS_HEATED_BED
sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
lv_label_set_text(labelBed, public_buf_l);
#endif
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1, public_buf_l);
#if HAS_MULTI_EXTRUDER
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2, public_buf_l);
#endif
}

View File

@ -885,7 +885,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
char *outBuf = (char *)tempBuf;
char tbuf[34];
sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
sprintf_P(tbuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
const int tlen = strlen(tbuf);
@ -895,7 +895,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
strcpy_P(outBuf, PSTR(" B:"));
outBuf += 3;
#if HAS_HEATED_BED
sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegBed(), thermalManager.degTargetBed());
#else
strcpy_P(outBuf, PSTR("0 /0"));
#endif
@ -908,7 +908,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
strcat_P(outBuf, PSTR(" T1:"));
outBuf += 4;
#if HAS_MULTI_HOTEND
sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
#else
strcat_P(outBuf, PSTR("0 /0"));
#endif
@ -918,15 +918,15 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
}
else {
sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_HEATED_BED
thermalManager.degBed(), thermalManager.degTargetBed(),
thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
#else
0, 0,
#endif
thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_MULTI_HOTEND
thermalManager.degHotend(1), thermalManager.degTargetHotend(1)
thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)
#else
0, 0
#endif

View File

@ -172,9 +172,9 @@ void process_lcd_eb_command(const char *command) {
sprintf_P(message_buffer,
PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}{TQ:%03i}{TT:%s}"),
int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_HEATED_BED
int(thermalManager.degBed()), thermalManager.degTargetBed(),
thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
#else
0, 0,
#endif
@ -303,9 +303,9 @@ void process_lcd_s_command(const char *command) {
// temperature information
char message_buffer[MAX_CURLY_COMMAND];
sprintf_P(message_buffer, PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}"),
int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_HEATED_BED
int(thermalManager.degBed()), thermalManager.degTargetBed()
thermalManager.wholeDegBed(), thermalManager.degTargetBed()
#else
0, 0
#endif

View File

@ -918,7 +918,7 @@ namespace ExtUI {
thermalManager.updatePID();
}
void startPIDTune(const_float_t temp, extruder_t tool) {
void startPIDTune(const celsius_t temp, extruder_t tool) {
thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
}
#endif
@ -935,7 +935,7 @@ namespace ExtUI {
thermalManager.updatePID();
}
void startBedPIDTune(const_float_t temp) {
void startBedPIDTune(const celsius_t temp) {
thermalManager.PID_autotune(temp, H_BED, 4, true);
}
#endif