diff --git a/Marlin/src/HAL/LPC1768/MarlinSerial.h b/Marlin/src/HAL/LPC1768/MarlinSerial.h index 489bd8cc6c..808d19f8c5 100644 --- a/Marlin/src/HAL/LPC1768/MarlinSerial.h +++ b/Marlin/src/HAL/LPC1768/MarlinSerial.h @@ -60,8 +60,8 @@ extern MSerialT MSerial1; extern MSerialT MSerial2; extern MSerialT MSerial3; -// Consequently, we can't use a RuntimeSerial either. The workaround would be to use a RuntimeSerial> type here -// Right now, let's ignore this until it's actually required. +// Consequently, we can't use a RuntimeSerial either. The workaround would be to use +// a RuntimeSerial> type here. Ignore for now until it's actually required. #if ENABLED(SERIAL_RUNTIME_HOOK) #error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x." #endif diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index b503c0f429..842a2b02c5 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -62,11 +62,11 @@ extern uint8_t marlin_debug_flags; // // Serial redirection // -// Step 1: Find what's the first serial leaf +// Step 1: Find out what the first serial leaf is #if BOTH(HAS_MULTI_SERIAL, SERIAL_CATCHALL) - #define _SERIAL_LEAF_1 MYSERIAL + #define _SERIAL_LEAF_1 MYSERIAL #else - #define _SERIAL_LEAF_1 MYSERIAL1 + #define _SERIAL_LEAF_1 MYSERIAL1 #endif // Hook Meatpack if it's enabled on the first leaf @@ -78,7 +78,8 @@ extern uint8_t marlin_debug_flags; #define SERIAL_LEAF_1 _SERIAL_LEAF_1 #endif -// Step 2: For multiserial, handle the second serial port as well +// Step 2: For multiserial wrap all serial ports in a single +// interface with the ability to output to multiple serial ports. #if HAS_MULTI_SERIAL #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p) #define _PORT_RESTORE(n,p) RESTORE(n) diff --git a/Marlin/src/core/serial_hook.h b/Marlin/src/core/serial_hook.h index 512ebdec97..45cdcd35ed 100644 --- a/Marlin/src/core/serial_hook.h +++ b/Marlin/src/core/serial_hook.h @@ -67,7 +67,7 @@ struct BaseSerial : public SerialBase< BaseSerial >, public SerialT { SerialFeature features(serial_index_t index) const { return CALL_IF_EXISTS(SerialFeature, static_cast(this), features, index); } - // We have 2 implementation of the same method in both base class, let's say which one we want + // Two implementations of the same method exist in both base classes so indicate the right one using SerialT::available; using SerialT::read; using SerialT::begin; @@ -134,7 +134,7 @@ struct ForwardSerial : public SerialBase< ForwardSerial > { ForwardSerial(const bool e, SerialT & out) : BaseClassT(e), out(out) {} }; -// A class that's can be hooked and unhooked at runtime, useful to capturing the output of the serial interface +// A class that can be hooked and unhooked at runtime, useful to capture the output of the serial interface template struct RuntimeSerial : public SerialBase< RuntimeSerial >, public SerialT { typedef SerialBase< RuntimeSerial > BaseClassT; diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index c0c5201222..241def0f77 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1064,7 +1064,7 @@ void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) { strncpy_P(cmd, pgcode, len); // Copy the command to the stack cmd[len] = '\0'; // End with a nul parser.parse(cmd); // Parse the command - process_parsed_command(true); // Process it + process_parsed_command(true); // Process it (no "ok") if (!delim) break; // Last command? pgcode = delim + 1; // Get the next command } @@ -1077,7 +1077,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) { char * const delim = strchr(gcode, '\n'); // Get address of next newline if (delim) *delim = '\0'; // Replace with nul parser.parse(gcode); // Parse the current command - process_parsed_command(true); // Process it + process_parsed_command(true); // Process it (no "ok") if (!delim) break; // Last command? *delim = '\n'; // Put back the newline gcode = delim + 1; // Get the next command diff --git a/docs/Serial.md b/docs/Serial.md index 30f6322a82..15c0480bb0 100644 --- a/docs/Serial.md +++ b/docs/Serial.md @@ -1,6 +1,6 @@ # Serial port architecture in Marlin -Marlin is targeting a plethora of different CPU architecture and platforms. Each of these platforms has its own serial interface. +Marlin is targeting a plethora of different CPU architectures and platforms. Each of these platforms has its own serial interface. While many provide a Arduino-like Serial class, it's not all of them, and the differences in the existing API create a very complex brain teaser for writing code that works more or less on each platform. Moreover, many platform have intrinsic needs about serial port (like forwarding the output on multiple serial port, providing a *serial-like* telnet server, mixing USB-based serial port with SD card emulation) that are difficult to handle cleanly in the other platform serial logic.