Browse Source

Cast celsius to int for MKS LVGL UI (#21502)

vanilla_fb_2.0.x
Malderin 3 years ago
committed by Scott Lahteine
parent
commit
93dfd411fc
  1. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp
  2. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp
  3. 23
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp
  4. 6
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  5. 30
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp
  6. 12
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp

2
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp

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

2
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp

@ -154,7 +154,7 @@ void disp_filament_temp() {
public_buf_l[0] = '\0'; public_buf_l[0] = '\0';
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2); strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex)); sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcat_P(public_buf_l, PSTR(": ")); strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf); strcat(public_buf_l, buf);

23
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp

@ -62,15 +62,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex); thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.start_watching_hotend(uiCfg.extruderIndex);
} }
#if HAS_HEATED_BED else {
else { #if HAS_HEATED_BED
constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1); constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
thermalManager.temp_bed.target += uiCfg.stepHeat; thermalManager.temp_bed.target += uiCfg.stepHeat;
if (thermalManager.degTargetBed() > max_target) if (thermalManager.degTargetBed() > max_target)
thermalManager.setTargetBed(max_target); thermalManager.setTargetBed(max_target);
thermalManager.start_watching_bed(); thermalManager.start_watching_bed();
} #endif
#endif }
disp_desire_temp(); disp_desire_temp();
} break; } break;
@ -211,20 +211,19 @@ void disp_temp_type() {
} }
void disp_desire_temp() { void disp_desire_temp() {
char buf[20] = {0}; char buf[20] = { 0 };
public_buf_l[0] = '\0'; public_buf_l[0] = '\0';
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2); strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex)); sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
} }
#if HAS_HEATED_BED else {
else { #if HAS_HEATED_BED
strcat(public_buf_l, preheat_menu.hotbed); strcat(public_buf_l, preheat_menu.hotbed);
sprintf(buf, preheat_menu.value_state, thermalManager.degBed(), thermalManager.degTargetBed()); sprintf(buf, preheat_menu.value_state, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
} #endif
#endif }
strcat_P(public_buf_l, PSTR(": ")); strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf); strcat(public_buf_l, buf);
lv_label_set_text(tempText1, public_buf_l); lv_label_set_text(tempText1, public_buf_l);

6
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp

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

30
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp

@ -105,14 +105,14 @@ void disp_det_error() {
lv_obj_t *e1, *e2, *e3, *bed; lv_obj_t *e1, *e2, *e3, *bed;
void mks_disp_test() { void mks_disp_test() {
char buf[30] = {0}; char buf[30] = {0};
sprintf_P(buf, PSTR("e1:%d"), thermalManager.degHotend(0)); sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
lv_label_set_text(e1, buf); lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
sprintf_P(buf, PSTR("e2:%d"), thermalManager.degHotend(1)); sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
lv_label_set_text(e2, buf); lv_label_set_text(e2, buf);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
sprintf_P(buf, PSTR("bed:%d"), thermalManager.degBed()); sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.degBed());
lv_label_set_text(bed, buf); lv_label_set_text(bed, buf);
#endif #endif
} }
@ -139,20 +139,20 @@ void lv_draw_ready_print() {
e1 = lv_label_create_empty(scr); e1 = lv_label_create_empty(scr);
lv_obj_set_pos(e1, 20, 20); lv_obj_set_pos(e1, 20, 20);
sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(0)); sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
lv_label_set_text(e1, buf); lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
e2 = lv_label_create_empty(scr); e2 = lv_label_create_empty(scr);
lv_obj_set_pos(e2, 20, 45); lv_obj_set_pos(e2, 20, 45);
sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(1)); sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
lv_label_set_text(e2, buf); lv_label_set_text(e2, buf);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
bed = lv_label_create_empty(scr); bed = lv_label_create_empty(scr);
lv_obj_set_pos(bed, 20, 95); lv_obj_set_pos(bed, 20, 95);
sprintf_P(buf, PSTR("bed: %d"), thermalManager.degBed()); sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.degBed());
lv_label_set_text(bed, buf); lv_label_set_text(bed, buf);
#endif #endif
@ -208,27 +208,27 @@ void lv_draw_ready_print() {
labelFan = lv_label_create(scr, 380, 80, nullptr); labelFan = lv_label_create(scr, 380, 80, nullptr);
sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(0)); sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0));
lv_label_set_text(labelExt1, buf); lv_label_set_text(labelExt1, buf);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0)); sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1Target, buf); lv_label_set_text(labelExt1Target, buf);
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(1)); sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1));
lv_label_set_text(labelExt2, buf); lv_label_set_text(labelExt2, buf);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1)); sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2Target, buf); lv_label_set_text(labelExt2Target, buf);
lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
sprintf_P(buf, PSTR("%d"), thermalManager.degBed()); sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed());
lv_label_set_text(labelBed, buf); lv_label_set_text(labelBed, buf);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed()); sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
lv_label_set_text(labelBedTarget, buf); lv_label_set_text(labelBedTarget, buf);
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#endif #endif
@ -249,15 +249,15 @@ void lv_draw_ready_print() {
void lv_temp_refr() { void lv_temp_refr() {
#if HAS_HEATED_BED #if HAS_HEATED_BED
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.degBed(), thermalManager.degTargetBed()); sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
lv_label_set_text(labelBed, public_buf_l); lv_label_set_text(labelBed, public_buf_l);
#endif #endif
sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(0), thermalManager.degTargetHotend(0)); sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1, public_buf_l); lv_label_set_text(labelExt1, public_buf_l);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(1), thermalManager.degTargetHotend(1)); sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2, public_buf_l); lv_label_set_text(labelExt2, public_buf_l);
#endif #endif
} }

12
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp

@ -885,9 +885,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
char *outBuf = (char *)tempBuf; char *outBuf = (char *)tempBuf;
char str_1[16], tbuf[34]; char str_1[16], tbuf[34];
dtostrf(thermalManager.degHotend(0), 1, 1, tbuf); sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
strcat_P(tbuf, PSTR(" /"));
strcat(tbuf, dtostrf(thermalManager.degTargetHotend(0), 1, 1, str_1));
const int tlen = strlen(tbuf); const int tlen = strlen(tbuf);
@ -897,9 +895,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
strcpy_P(outBuf, PSTR(" B:")); strcpy_P(outBuf, PSTR(" B:"));
outBuf += 3; outBuf += 3;
#if HAS_HEATED_BED #if HAS_HEATED_BED
strcpy(outBuf, dtostrf(thermalManager.degBed(), 1, 1, str_1)); sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
strcat_P(outBuf, PSTR(" /"));
strcat(outBuf, dtostrf(thermalManager.degTargetBed(), 1, 1, str_1));
#else #else
strcpy_P(outBuf, PSTR("0 /0")); strcpy_P(outBuf, PSTR("0 /0"));
#endif #endif
@ -912,9 +908,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
strcat_P(outBuf, PSTR(" T1:")); strcat_P(outBuf, PSTR(" T1:"));
outBuf += 4; outBuf += 4;
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
strcat(outBuf, dtostrf(thermalManager.degHotend(1), 1, 1, str_1)); sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
strcat_P(outBuf, PSTR(" /"));
strcat(outBuf, dtostrf(thermalManager.degTargetHotend(1), 1, 1, str_1));
#else #else
strcat_P(outBuf, PSTR("0 /0")); strcat_P(outBuf, PSTR("0 /0"));
#endif #endif

Loading…
Cancel
Save