Skip to content

Commit 507faf0

Browse files
plampixthinkyhead
authored andcommitted
🐛 Fix minimal M115, Cap:PROGRESS:0 (MarlinFirmware#25769)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent d57f803 commit 507faf0

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

Marlin/src/gcode/host/M115.cpp

+13-20
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,15 @@
3939
//#define MINIMAL_CAP_LINES // Don't even mention the disabled capabilities
4040

4141
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
42-
#if ENABLED(MINIMAL_CAP_LINES)
43-
#define cap_line(S,C) if (C) _cap_line(S)
44-
static void _cap_line(FSTR_P const name) {
45-
SERIAL_ECHOPGM("Cap:");
46-
SERIAL_ECHOF(name);
47-
SERIAL_ECHOLNPGM(":1");
48-
}
49-
#else
50-
#define cap_line(V...) _cap_line(V)
51-
static void _cap_line(FSTR_P const name, bool ena=false) {
52-
SERIAL_ECHOPGM("Cap:");
53-
SERIAL_ECHOF(name);
42+
inline void cap_line(FSTR_P const name, const bool ena=true) {
43+
#if ENABLED(MINIMAL_CAP_LINES)
44+
if (ena) SERIAL_ECHOLNPGM("Cap:", name, ":1");
45+
#else
46+
SERIAL_ECHOPGM("Cap:", name);
5447
SERIAL_CHAR(':', '0' + ena);
5548
SERIAL_EOL();
56-
}
57-
#endif
49+
#endif
50+
}
5851
#endif
5952

6053
/**
@@ -100,10 +93,10 @@ void GcodeSuite::M115() {
10093
serial_index_t port = queue.ring_buffer.command_port();
10194

10295
// PAREN_COMMENTS
103-
TERN_(PAREN_COMMENTS, cap_line(F("PAREN_COMMENTS"), true));
96+
TERN_(PAREN_COMMENTS, cap_line(F("PAREN_COMMENTS")));
10497

10598
// QUOTED_STRINGS
106-
TERN_(GCODE_QUOTED_STRINGS, cap_line(F("QUOTED_STRINGS"), true));
99+
TERN_(GCODE_QUOTED_STRINGS, cap_line(F("QUOTED_STRINGS")));
107100

108101
// SERIAL_XON_XOFF
109102
cap_line(F("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
@@ -124,10 +117,10 @@ void GcodeSuite::M115() {
124117
cap_line(F("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
125118

126119
// PROGRESS (M530 S L, M531 <file>, M532 X L)
127-
cap_line(F("PROGRESS"));
120+
cap_line(F("PROGRESS"), false);
128121

129122
// Print Job timer M75, M76, M77
130-
cap_line(F("PRINT_JOB"), true);
123+
cap_line(F("PRINT_JOB"));
131124

132125
// AUTOLEVEL (G29)
133126
cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
@@ -153,9 +146,9 @@ void GcodeSuite::M115() {
153146

154147
// SPINDLE AND LASER CONTROL (M3, M4, M5)
155148
#if ENABLED(SPINDLE_FEATURE)
156-
cap_line(F("SPINDLE"), true);
149+
cap_line(F("SPINDLE"));
157150
#elif ENABLED(LASER_FEATURE)
158-
cap_line(F("LASER"), true);
151+
cap_line(F("LASER"));
159152
#endif
160153

161154
// EMERGENCY_PARSER (M108, M112, M410, M876)

0 commit comments

Comments
 (0)