diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index c3baaf9ad..4824866ae 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -303,14 +303,14 @@ extern uint8_t marlin_debug_flags; void serial_echopair_PGM(PGM_P const s_P, const char *v); void serial_echopair_PGM(PGM_P const s_P, char v); void serial_echopair_PGM(PGM_P const s_P, int v); +void serial_echopair_PGM(PGM_P const s_P, unsigned int v); void serial_echopair_PGM(PGM_P const s_P, long v); +void serial_echopair_PGM(PGM_P const s_P, unsigned long v); void serial_echopair_PGM(PGM_P const s_P, float v); void serial_echopair_PGM(PGM_P const s_P, double v); -void serial_echopair_PGM(PGM_P const s_P, unsigned int v); -void serial_echopair_PGM(PGM_P const s_P, unsigned long v); inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); } inline void serial_echopair_PGM(PGM_P const s_P, bool v) { serial_echopair_PGM(s_P, (int)v); } -inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); } +inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (uintptr_t)v); } void serialprintPGM(PGM_P str); void serial_echo_start(); diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index c0e7d2a7a..207f9e144 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -30,7 +30,7 @@ * M31: Get the time since the start of SD Print (or last M109) */ void GcodeSuite::M31() { - char buffer[21]; + char buffer[22]; duration_t(print_job_timer.duration()).toString(buffer); ui.set_status(buffer); diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 85654b918..9fef62582 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -774,9 +774,15 @@ void MarlinUI::draw_status_screen() { mixer.update_mix_from_vtool(); mix_label = PSTR("Mx"); } + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-overflow" + sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1])); lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages); + #pragma GCC diagnostic pop + #else if (show_e_total) { diff --git a/Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp index 7988985c2..77feacf4a 100644 --- a/Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp @@ -217,7 +217,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { // It is using a hex display for that: It expects BSD coded data in the format xxyyzz void DGUSScreenHandler::DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var) { printStatistics state = print_job_timer.getStats(); - char buf[21]; + char buf[22]; duration_t elapsed = state.printTime; elapsed.toString(buf); dgusdisplay.WriteVariable(VP_PrintAccTime, buf, var.size, true); @@ -225,7 +225,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { void DGUSScreenHandler::DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var) { printStatistics state = print_job_timer.getStats(); - char buf[21]; + char buf[10]; sprintf_P(buf, PSTR("%u"), state.totalPrints); dgusdisplay.WriteVariable(VP_PrintsTotal, buf, var.size, true); } diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index 31d8bab38..9c1d72dfa 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -106,6 +106,9 @@ struct duration_t { return this->value; } + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-overflow" + /** * @brief Formats the duration as a string * @details String will be formated using a "full" representation of duration @@ -127,7 +130,7 @@ struct duration_t { m = this->minute() % 60, s = this->second() % 60; - if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s); + if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s); else if (d) sprintf_P(buffer, PSTR("%id %ih %im %is"), d, h, m, s); else if (h) sprintf_P(buffer, PSTR("%ih %im %is"), h, m, s); else if (m) sprintf_P(buffer, PSTR("%im %is"), m, s); @@ -163,4 +166,6 @@ struct duration_t { return 6; } } + + #pragma GCC diagnostic pop }; diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 86aedf216..ab87717f0 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -177,7 +177,7 @@ void PrintCounter::saveStats() { #endif void PrintCounter::showStats() { - char buffer[21]; + char buffer[22]; SERIAL_ECHOPGM(STR_STATS); SERIAL_ECHOLNPAIR(