瀏覽代碼

Fix compile warnings, serial alias

Scott Lahteine 4 年之前
父節點
當前提交
1d43e81be0

+ 3
- 3
Marlin/src/core/serial.h 查看文件

@@ -303,14 +303,14 @@ extern uint8_t marlin_debug_flags;
303 303
 void serial_echopair_PGM(PGM_P const s_P, const char *v);
304 304
 void serial_echopair_PGM(PGM_P const s_P, char v);
305 305
 void serial_echopair_PGM(PGM_P const s_P, int v);
306
+void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
306 307
 void serial_echopair_PGM(PGM_P const s_P, long v);
308
+void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
307 309
 void serial_echopair_PGM(PGM_P const s_P, float v);
308 310
 void serial_echopair_PGM(PGM_P const s_P, double v);
309
-void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
310
-void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
311 311
 inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
312 312
 inline void serial_echopair_PGM(PGM_P const s_P, bool v)    { serial_echopair_PGM(s_P, (int)v); }
313
-inline void serial_echopair_PGM(PGM_P const s_P, void *v)   { serial_echopair_PGM(s_P, (unsigned long)v); }
313
+inline void serial_echopair_PGM(PGM_P const s_P, void *v)   { serial_echopair_PGM(s_P, (uintptr_t)v); }
314 314
 
315 315
 void serialprintPGM(PGM_P str);
316 316
 void serial_echo_start();

+ 1
- 1
Marlin/src/gcode/stats/M31.cpp 查看文件

@@ -30,7 +30,7 @@
30 30
  * M31: Get the time since the start of SD Print (or last M109)
31 31
  */
32 32
 void GcodeSuite::M31() {
33
-  char buffer[21];
33
+  char buffer[22];
34 34
   duration_t(print_job_timer.duration()).toString(buffer);
35 35
 
36 36
   ui.set_status(buffer);

+ 6
- 0
Marlin/src/lcd/dogm/status_screen_DOGM.cpp 查看文件

@@ -774,9 +774,15 @@ void MarlinUI::draw_status_screen() {
774 774
             mixer.update_mix_from_vtool();
775 775
             mix_label = PSTR("Mx");
776 776
           }
777
+
778
+        #pragma GCC diagnostic push
779
+        #pragma GCC diagnostic ignored "-Wformat-overflow"
780
+
777 781
         sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
778 782
         lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
779 783
 
784
+        #pragma GCC diagnostic pop
785
+
780 786
       #else
781 787
 
782 788
         if (show_e_total) {

+ 2
- 2
Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp 查看文件

@@ -217,7 +217,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
217 217
   // It is using a hex display for that: It expects BSD coded data in the format xxyyzz
218 218
   void DGUSScreenHandler::DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var) {
219 219
     printStatistics state = print_job_timer.getStats();
220
-    char buf[21];
220
+    char buf[22];
221 221
     duration_t elapsed = state.printTime;
222 222
     elapsed.toString(buf);
223 223
     dgusdisplay.WriteVariable(VP_PrintAccTime, buf, var.size, true);
@@ -225,7 +225,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
225 225
 
226 226
   void DGUSScreenHandler::DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var) {
227 227
     printStatistics state = print_job_timer.getStats();
228
-    char buf[21];
228
+    char buf[10];
229 229
     sprintf_P(buf, PSTR("%u"), state.totalPrints);
230 230
     dgusdisplay.WriteVariable(VP_PrintsTotal, buf, var.size, true);
231 231
   }

+ 6
- 1
Marlin/src/libs/duration_t.h 查看文件

@@ -106,6 +106,9 @@ struct duration_t {
106 106
     return this->value;
107 107
   }
108 108
 
109
+  #pragma GCC diagnostic push
110
+  #pragma GCC diagnostic ignored "-Wformat-overflow"
111
+
109 112
   /**
110 113
    * @brief Formats the duration as a string
111 114
    * @details String will be formated using a "full" representation of duration
@@ -127,7 +130,7 @@ struct duration_t {
127 130
         m = this->minute() % 60,
128 131
         s = this->second() % 60;
129 132
 
130
-    if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s);
133
+         if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s);
131 134
     else if (d) sprintf_P(buffer, PSTR("%id %ih %im %is"), d, h, m, s);
132 135
     else if (h) sprintf_P(buffer, PSTR("%ih %im %is"), h, m, s);
133 136
     else if (m) sprintf_P(buffer, PSTR("%im %is"), m, s);
@@ -163,4 +166,6 @@ struct duration_t {
163 166
       return 6;
164 167
     }
165 168
   }
169
+
170
+  #pragma GCC diagnostic pop
166 171
 };

+ 1
- 1
Marlin/src/module/printcounter.cpp 查看文件

@@ -177,7 +177,7 @@ void PrintCounter::saveStats() {
177 177
 #endif
178 178
 
179 179
 void PrintCounter::showStats() {
180
-  char buffer[21];
180
+  char buffer[22];
181 181
 
182 182
   SERIAL_ECHOPGM(STR_STATS);
183 183
   SERIAL_ECHOLNPAIR(

Loading…
取消
儲存