Selaa lähdekoodia

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

Malderin 4 vuotta sitten
vanhempi
commit
746eae15f3
No account linked to committer's email address

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp Näytä tiedosto

195
 
195
 
196
 void disp_hotend_temp() {
196
 void disp_hotend_temp() {
197
   char buf[20] = {0};
197
   char buf[20] = {0};
198
-  sprintf(buf, extrude_menu.temp_value, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
198
+  sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
199
   strcpy(public_buf_l, extrude_menu.temper_text);
199
   strcpy(public_buf_l, extrude_menu.temper_text);
200
   strcat(public_buf_l, buf);
200
   strcat(public_buf_l, buf);
201
   lv_label_set_text(tempText, public_buf_l);
201
   lv_label_set_text(tempText, public_buf_l);

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp Näytä tiedosto

154
   public_buf_l[0] = '\0';
154
   public_buf_l[0] = '\0';
155
 
155
 
156
   strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
156
   strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
157
-  sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
157
+  sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
158
 
158
 
159
   strcat_P(public_buf_l, PSTR(": "));
159
   strcat_P(public_buf_l, PSTR(": "));
160
   strcat(public_buf_l, buf);
160
   strcat(public_buf_l, buf);

+ 11
- 12
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp Näytä tiedosto

62
           thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
62
           thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
63
         thermalManager.start_watching_hotend(uiCfg.extruderIndex);
63
         thermalManager.start_watching_hotend(uiCfg.extruderIndex);
64
       }
64
       }
65
-      #if HAS_HEATED_BED
66
-        else {
65
+      else {
66
+        #if HAS_HEATED_BED
67
           constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
67
           constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
68
           thermalManager.temp_bed.target += uiCfg.stepHeat;
68
           thermalManager.temp_bed.target += uiCfg.stepHeat;
69
           if (thermalManager.degTargetBed() > max_target)
69
           if (thermalManager.degTargetBed() > max_target)
70
             thermalManager.setTargetBed(max_target);
70
             thermalManager.setTargetBed(max_target);
71
           thermalManager.start_watching_bed();
71
           thermalManager.start_watching_bed();
72
-        }
73
-      #endif
72
+        #endif
73
+      }
74
       disp_desire_temp();
74
       disp_desire_temp();
75
     } break;
75
     } break;
76
 
76
 
211
 }
211
 }
212
 
212
 
213
 void disp_desire_temp() {
213
 void disp_desire_temp() {
214
-  char buf[20] = {0};
215
-
214
+  char buf[20] = { 0 };
216
   public_buf_l[0] = '\0';
215
   public_buf_l[0] = '\0';
217
 
216
 
218
   if (uiCfg.curTempType == 0) {
217
   if (uiCfg.curTempType == 0) {
219
     strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
218
     strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
220
-    sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
219
+    sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
221
   }
220
   }
222
-  #if HAS_HEATED_BED
223
-    else {
221
+  else {
222
+    #if HAS_HEATED_BED
224
       strcat(public_buf_l, preheat_menu.hotbed);
223
       strcat(public_buf_l, preheat_menu.hotbed);
225
-      sprintf(buf, preheat_menu.value_state, thermalManager.degBed(), thermalManager.degTargetBed());
226
-    }
227
-  #endif
224
+      sprintf(buf, preheat_menu.value_state, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
225
+    #endif
226
+  }
228
   strcat_P(public_buf_l, PSTR(": "));
227
   strcat_P(public_buf_l, PSTR(": "));
229
   strcat(public_buf_l, buf);
228
   strcat(public_buf_l, buf);
230
   lv_label_set_text(tempText1, public_buf_l);
229
   lv_label_set_text(tempText1, public_buf_l);

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp Näytä tiedosto

219
 }
219
 }
220
 
220
 
221
 void disp_ext_temp() {
221
 void disp_ext_temp() {
222
-  sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(0), thermalManager.degTargetHotend(0));
222
+  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
223
   lv_label_set_text(labelExt1, public_buf_l);
223
   lv_label_set_text(labelExt1, public_buf_l);
224
 
224
 
225
   #if HAS_MULTI_EXTRUDER
225
   #if HAS_MULTI_EXTRUDER
226
-    sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(1), thermalManager.degTargetHotend(1));
226
+    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
227
     lv_label_set_text(labelExt2, public_buf_l);
227
     lv_label_set_text(labelExt2, public_buf_l);
228
   #endif
228
   #endif
229
 }
229
 }
230
 
230
 
231
 void disp_bed_temp() {
231
 void disp_bed_temp() {
232
   #if HAS_HEATED_BED
232
   #if HAS_HEATED_BED
233
-    sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.degBed(), thermalManager.degTargetBed());
233
+    sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
234
     lv_label_set_text(labelBed, public_buf_l);
234
     lv_label_set_text(labelBed, public_buf_l);
235
   #endif
235
   #endif
236
 }
236
 }

+ 15
- 15
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp Näytä tiedosto

105
 lv_obj_t *e1, *e2, *e3, *bed;
105
 lv_obj_t *e1, *e2, *e3, *bed;
106
 void mks_disp_test() {
106
 void mks_disp_test() {
107
   char buf[30] = {0};
107
   char buf[30] = {0};
108
-  sprintf_P(buf, PSTR("e1:%d"), thermalManager.degHotend(0));
108
+  sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
109
   lv_label_set_text(e1, buf);
109
   lv_label_set_text(e1, buf);
110
   #if HAS_MULTI_HOTEND
110
   #if HAS_MULTI_HOTEND
111
-    sprintf_P(buf, PSTR("e2:%d"), thermalManager.degHotend(1));
111
+    sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
112
     lv_label_set_text(e2, buf);
112
     lv_label_set_text(e2, buf);
113
   #endif
113
   #endif
114
   #if HAS_HEATED_BED
114
   #if HAS_HEATED_BED
115
-    sprintf_P(buf, PSTR("bed:%d"), thermalManager.degBed());
115
+    sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.degBed());
116
     lv_label_set_text(bed, buf);
116
     lv_label_set_text(bed, buf);
117
   #endif
117
   #endif
118
 }
118
 }
139
 
139
 
140
     e1 = lv_label_create_empty(scr);
140
     e1 = lv_label_create_empty(scr);
141
     lv_obj_set_pos(e1, 20, 20);
141
     lv_obj_set_pos(e1, 20, 20);
142
-    sprintf_P(buf, PSTR("e1:  %d"), thermalManager.degHotend(0));
142
+    sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(0));
143
     lv_label_set_text(e1, buf);
143
     lv_label_set_text(e1, buf);
144
 
144
 
145
     #if HAS_MULTI_HOTEND
145
     #if HAS_MULTI_HOTEND
146
       e2 = lv_label_create_empty(scr);
146
       e2 = lv_label_create_empty(scr);
147
       lv_obj_set_pos(e2, 20, 45);
147
       lv_obj_set_pos(e2, 20, 45);
148
-      sprintf_P(buf, PSTR("e1:  %d"), thermalManager.degHotend(1));
148
+      sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(1));
149
       lv_label_set_text(e2, buf);
149
       lv_label_set_text(e2, buf);
150
     #endif
150
     #endif
151
 
151
 
152
     #if HAS_HEATED_BED
152
     #if HAS_HEATED_BED
153
       bed = lv_label_create_empty(scr);
153
       bed = lv_label_create_empty(scr);
154
       lv_obj_set_pos(bed, 20, 95);
154
       lv_obj_set_pos(bed, 20, 95);
155
-      sprintf_P(buf, PSTR("bed:  %d"), thermalManager.degBed());
155
+      sprintf_P(buf, PSTR("bed:  %d"), (int)thermalManager.degBed());
156
       lv_label_set_text(bed, buf);
156
       lv_label_set_text(bed, buf);
157
     #endif
157
     #endif
158
 
158
 
208
 
208
 
209
     labelFan = lv_label_create(scr, 380, 80, nullptr);
209
     labelFan = lv_label_create(scr, 380, 80, nullptr);
210
 
210
 
211
-    sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(0));
211
+    sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0));
212
     lv_label_set_text(labelExt1, buf);
212
     lv_label_set_text(labelExt1, buf);
213
     lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
213
     lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
214
-    sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
214
+    sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
215
     lv_label_set_text(labelExt1Target, buf);
215
     lv_label_set_text(labelExt1Target, buf);
216
     lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
216
     lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
217
 
217
 
218
     #if HAS_MULTI_EXTRUDER
218
     #if HAS_MULTI_EXTRUDER
219
-      sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(1));
219
+      sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1));
220
       lv_label_set_text(labelExt2, buf);
220
       lv_label_set_text(labelExt2, buf);
221
       lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
221
       lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
222
-      sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
222
+      sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
223
       lv_label_set_text(labelExt2Target, buf);
223
       lv_label_set_text(labelExt2Target, buf);
224
       lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
224
       lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
225
     #endif
225
     #endif
226
 
226
 
227
     #if HAS_HEATED_BED
227
     #if HAS_HEATED_BED
228
-      sprintf_P(buf, PSTR("%d"), thermalManager.degBed());
228
+      sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed());
229
       lv_label_set_text(labelBed, buf);
229
       lv_label_set_text(labelBed, buf);
230
       lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
230
       lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
231
-      sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
231
+      sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
232
       lv_label_set_text(labelBedTarget, buf);
232
       lv_label_set_text(labelBedTarget, buf);
233
       lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
233
       lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
234
     #endif
234
     #endif
249
 
249
 
250
 void lv_temp_refr() {
250
 void lv_temp_refr() {
251
   #if HAS_HEATED_BED
251
   #if HAS_HEATED_BED
252
-    sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.degBed(), thermalManager.degTargetBed());
252
+    sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
253
     lv_label_set_text(labelBed, public_buf_l);
253
     lv_label_set_text(labelBed, public_buf_l);
254
   #endif
254
   #endif
255
 
255
 
256
-  sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(0), thermalManager.degTargetHotend(0));
256
+  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
257
   lv_label_set_text(labelExt1, public_buf_l);
257
   lv_label_set_text(labelExt1, public_buf_l);
258
 
258
 
259
   #if HAS_MULTI_EXTRUDER
259
   #if HAS_MULTI_EXTRUDER
260
-    sprintf(public_buf_l, printing_menu.temp1, thermalManager.degHotend(1), thermalManager.degTargetHotend(1));
260
+    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
261
     lv_label_set_text(labelExt2, public_buf_l);
261
     lv_label_set_text(labelExt2, public_buf_l);
262
   #endif
262
   #endif
263
 }
263
 }

+ 3
- 9
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp Näytä tiedosto

885
             char *outBuf = (char *)tempBuf;
885
             char *outBuf = (char *)tempBuf;
886
             char str_1[16], tbuf[34];
886
             char str_1[16], tbuf[34];
887
 
887
 
888
-            dtostrf(thermalManager.degHotend(0), 1, 1, tbuf);
889
-            strcat_P(tbuf, PSTR(" /"));
890
-            strcat(tbuf, dtostrf(thermalManager.degTargetHotend(0), 1, 1, str_1));
888
+            sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
891
 
889
 
892
             const int tlen = strlen(tbuf);
890
             const int tlen = strlen(tbuf);
893
 
891
 
897
             strcpy_P(outBuf, PSTR(" B:"));
895
             strcpy_P(outBuf, PSTR(" B:"));
898
             outBuf += 3;
896
             outBuf += 3;
899
             #if HAS_HEATED_BED
897
             #if HAS_HEATED_BED
900
-              strcpy(outBuf, dtostrf(thermalManager.degBed(), 1, 1, str_1));
901
-              strcat_P(outBuf, PSTR(" /"));
902
-              strcat(outBuf, dtostrf(thermalManager.degTargetBed(), 1, 1, str_1));
898
+              sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
903
             #else
899
             #else
904
               strcpy_P(outBuf, PSTR("0 /0"));
900
               strcpy_P(outBuf, PSTR("0 /0"));
905
             #endif
901
             #endif
912
             strcat_P(outBuf, PSTR(" T1:"));
908
             strcat_P(outBuf, PSTR(" T1:"));
913
             outBuf += 4;
909
             outBuf += 4;
914
             #if HAS_MULTI_HOTEND
910
             #if HAS_MULTI_HOTEND
915
-              strcat(outBuf, dtostrf(thermalManager.degHotend(1), 1, 1, str_1));
916
-              strcat_P(outBuf, PSTR(" /"));
917
-              strcat(outBuf, dtostrf(thermalManager.degTargetHotend(1), 1, 1, str_1));
911
+              sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
918
             #else
912
             #else
919
               strcat_P(outBuf, PSTR("0 /0"));
913
               strcat_P(outBuf, PSTR("0 /0"));
920
             #endif
914
             #endif

Loading…
Peruuta
Tallenna