Skip to content

Commit db98f06

Browse files
🚸 Warning alerts for non-fatal errors (#26306)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent bbb5aac commit db98f06

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Marlin/src/core/debug_out.h

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
#define DEBUG_ECHO_START SERIAL_ECHO_START
5454
#define DEBUG_ERROR_START SERIAL_ERROR_START
55+
#define DEBUG_WARN_START SERIAL_WARN_START
5556
#define DEBUG_CHAR SERIAL_CHAR
5657
#define DEBUG_ECHO SERIAL_ECHO
5758
#define DEBUG_ECHOLN SERIAL_ECHOLN
@@ -63,6 +64,7 @@
6364
#define DEBUG_ECHOLNPGM_P SERIAL_ECHOLNPGM_P
6465
#define DEBUG_ECHO_MSG SERIAL_ECHO_MSG
6566
#define DEBUG_ERROR_MSG SERIAL_ERROR_MSG
67+
#define DEBUG_WARN_MSG SERIAL_WARN_MSG
6668
#define DEBUG_EOL SERIAL_EOL
6769
#define DEBUG_FLUSH SERIAL_FLUSH
6870
#define DEBUG_POS SERIAL_POS
@@ -75,6 +77,7 @@
7577
#define DEBUG_SECTION(...) NOOP
7678
#define DEBUG_ECHO_START() NOOP
7779
#define DEBUG_ERROR_START() NOOP
80+
#define DEBUG_WARN_START() NOOP
7881
#define DEBUG_CHAR(...) NOOP
7982
#define DEBUG_ECHO(...) NOOP
8083
#define DEBUG_ECHOLN(...) NOOP
@@ -84,6 +87,7 @@
8487
#define DEBUG_ECHOLNPGM_P(...) NOOP
8588
#define DEBUG_ECHO_MSG(...) NOOP
8689
#define DEBUG_ERROR_MSG(...) NOOP
90+
#define DEBUG_WARN_MSG(...) NOOP
8791
#define DEBUG_EOL() NOOP
8892
#define DEBUG_FLUSH() NOOP
8993
#define DEBUG_POS(...) NOOP

Marlin/src/core/serial.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void SERIAL_ECHOLN_P(PGM_P pstr) { SERIAL_ECHO_P(pstr); SERIAL_EOL(); }
9292

9393
void SERIAL_ECHO_START() { SERIAL_ECHO(F("echo:")); }
9494
void SERIAL_ERROR_START() { SERIAL_ECHO(F("Error:")); }
95+
void SERIAL_WARN_START() { SERIAL_ECHO(F("Warning:")); }
9596

9697
void SERIAL_ECHO_SP(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
9798

Marlin/src/core/serial.h

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ void SERIAL_FLUSHTX();
161161
// Start an echo: or error: output
162162
void SERIAL_ECHO_START();
163163
void SERIAL_ERROR_START();
164+
void SERIAL_WARN_START();
164165

165166
// Serial end-of-line
166167
void SERIAL_EOL();
@@ -227,6 +228,7 @@ void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args
227228

228229
#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0)
229230
#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(V); }while(0)
231+
#define SERIAL_WARN_MSG(V...) do{ SERIAL_WARN_START(); SERIAL_ECHOLNPGM(V); }while(0)
230232

231233
// Print a prefix, conditional string, and suffix
232234
void serial_ternary(FSTR_P const pre, const bool onoff, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr);

Marlin/src/module/settings.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ void MarlinSettings::postprocess() {
758758

759759
#if ENABLED(EEPROM_SETTINGS)
760760

761-
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = ERR_EEPROM_SIZE; } }while(0)
761+
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_WARN_MSG(ERR); eeprom_error = ERR_EEPROM_SIZE; } }while(0)
762762

763763
#define TWO_BYTE_HASH(A,B) uint16_t((uint16_t(A ^ 0xC3) << 4) ^ (uint16_t(B ^ 0xC3) << 12))
764764

@@ -796,7 +796,7 @@ void MarlinSettings::postprocess() {
796796

797797
EEPROM_Error MarlinSettings::size_error(const uint16_t size) {
798798
if (size != datasize()) {
799-
DEBUG_ERROR_MSG("EEPROM datasize error."
799+
DEBUG_WARN_MSG("EEPROM datasize error."
800800
#if ENABLED(MARLIN_DEV_MODE)
801801
" (Actual:", size, " Expected:", datasize(), ")"
802802
#endif
@@ -2865,10 +2865,10 @@ void MarlinSettings::postprocess() {
28652865
DEBUG_ECHO_MSG("Index: ", eeprom_index - (EEPROM_OFFSET), " Size: ", datasize());
28662866
break;
28672867
case ERR_EEPROM_CORRUPT:
2868-
DEBUG_ERROR_MSG(STR_ERR_EEPROM_CORRUPT);
2868+
DEBUG_WARN_MSG(STR_ERR_EEPROM_CORRUPT);
28692869
break;
28702870
case ERR_EEPROM_CRC:
2871-
DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2871+
DEBUG_WARN_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
28722872
TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC)));
28732873
break;
28742874
default: break;
@@ -3048,7 +3048,7 @@ void MarlinSettings::postprocess() {
30483048
#else // !EEPROM_SETTINGS
30493049

30503050
bool MarlinSettings::save() {
3051-
DEBUG_ERROR_MSG("EEPROM disabled");
3051+
DEBUG_WARN_MSG("EEPROM disabled");
30523052
return false;
30533053
}
30543054

0 commit comments

Comments
 (0)