Browse Source

Fix compile warnings, serial alias

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
7e535022ab
  1. 6
      Marlin/src/core/serial.h
  2. 2
      Marlin/src/gcode/stats/M31.cpp
  3. 6
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp
  4. 4
      Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp
  5. 7
      Marlin/src/libs/duration_t.h
  6. 2
      Marlin/src/module/printcounter.cpp

6
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();

2
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);

6
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) {

4
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);
}

7
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
};

2
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(

Loading…
Cancel
Save