Skip to content

Commit bc85f5b

Browse files
committed
πŸ§‘β€πŸ’» Add Parser::has_string
1 parent 493c5ee commit bc85f5b

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

β€ŽMarlin/src/gcode/config/M550.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void GcodeSuite::M550() {
4242
machine_name = parser.value_string();
4343
else if (TERN(GCODE_QUOTED_STRINGS, false, parser.seen('P')))
4444
machine_name = parser.string_arg[0] == 'P' ? &parser.string_arg[1] : parser.string_arg;
45-
else if (parser.string_arg && parser.string_arg[0])
45+
else if (parser.has_string())
4646
machine_name = parser.string_arg;
4747
else
4848
did_set = false;

β€ŽMarlin/src/gcode/control/T.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void GcodeSuite::T(const int8_t tool_index) {
6969
reset_stepper_timeout();
7070

7171
#if HAS_PRUSA_MMU3
72-
if (parser.string_arg) {
72+
if (parser.has_string()) {
7373
mmu3.tool_change(parser.string_arg[0], uint8_t(tool_index)); // Special commands T?/Tx/Tc
7474
return;
7575
}

β€ŽMarlin/src/gcode/lcd/M117.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
void GcodeSuite::M117() {
3434

35-
if (parser.string_arg && parser.string_arg[0])
35+
if (parser.has_string())
3636
ui.set_status_no_expire(parser.string_arg);
3737
else
3838
ui.reset_status();

β€ŽMarlin/src/gcode/parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ class GCodeParser {
9797
FORCE_INLINE static void cancel_motion_mode() { motion_mode_codenum = -1; }
9898
#endif
9999

100+
FORCE_INLINE static bool has_string() { return string_arg && string_arg[0]; }
101+
100102
#if ENABLED(DEBUG_GCODE_PARSER)
101103
static void debug();
102104
#endif

β€ŽMarlin/src/gcode/stats/M75-M78.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void GcodeSuite::M75() {
4343
startOrResumeJob(); // ... ExtUI::onPrintTimerStarted()
4444
#if ENABLED(DWIN_LCD_PROUI)
4545
// TODO: Remove if M75 <string> is never used
46-
if (!IS_SD_PRINTING()) dwinPrintHeader(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
46+
if (!IS_SD_PRINTING()) dwinPrintHeader(parser.has_string() ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
4747
#endif
4848
}
4949

β€ŽMarlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void RTS::onStartup() {
100100
delay_ms(400); // Delay to allow screen to configure
101101

102102
#if ENABLED(CONFIGURABLE_MACHINE_NAME)
103-
const MString<32> ready(message_string, " Ready");
103+
const MString<32> ready(machine_name, " Ready");
104104
onStatusChanged(ready);
105105
#else
106106
onStatusChanged(F(MACHINE_NAME " Ready"));

0 commit comments

Comments
Β (0)