瀏覽代碼

Fix compile warnings, serial alias

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

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

303
 void serial_echopair_PGM(PGM_P const s_P, const char *v);
303
 void serial_echopair_PGM(PGM_P const s_P, const char *v);
304
 void serial_echopair_PGM(PGM_P const s_P, char v);
304
 void serial_echopair_PGM(PGM_P const s_P, char v);
305
 void serial_echopair_PGM(PGM_P const s_P, int v);
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
 void serial_echopair_PGM(PGM_P const s_P, long v);
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
 void serial_echopair_PGM(PGM_P const s_P, float v);
309
 void serial_echopair_PGM(PGM_P const s_P, float v);
308
 void serial_echopair_PGM(PGM_P const s_P, double v);
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
 inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
311
 inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
312
 inline void serial_echopair_PGM(PGM_P const s_P, bool v)    { serial_echopair_PGM(s_P, (int)v); }
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
 void serialprintPGM(PGM_P str);
315
 void serialprintPGM(PGM_P str);
316
 void serial_echo_start();
316
 void serial_echo_start();

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

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

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

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

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

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

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

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

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

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

Loading…
取消
儲存