Skip to content

Commit

Permalink
Fix crash at boot orz...
Browse files Browse the repository at this point in the history
Add missing \n for echo_serial
  • Loading branch information
luc-github committed Dec 16, 2023
1 parent c09d3c6 commit 6455ee2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/core/esp3d_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,11 @@ bool ESP3DCommands::dispatch(ESP3DMessage *msg) {
#if COMMUNICATION_PROTOCOL == SOCKET_SERIAL
case ESP3DClientType::echo_serial:
MYSERIAL1.write(msg->data, msg->size);
if (msg->type == ESP3DMessageType::unique || msg->type == ESP3DMessageType::tail) {
if (msg->data[msg->size-1]!='\n'){
MYSERIAL1.write('\n');
}
}
ESP3DMessageManager::deleteMsg(msg);
break;
#endif // COMMUNICATION_PROTOCOL == SOCKET_SERIAL
Expand Down Expand Up @@ -1513,4 +1518,4 @@ bool ESP3DCommands::dispatch(ESP3DMessage *msg) {
ESP3DMessageManager::deleteMsg(msg);
}
return sendOk;
}
}
2 changes: 1 addition & 1 deletion src/modules/serial2socket/serial2socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void Serial_2_Socket::handle_flush() {
void Serial_2_Socket::flush(void) {
if (_TXbufferSize > 0 && _started && !_paused) {
ESP3DMessage *msg = ESP3DMessageManager::newMsg(
ESP3DClientType::socket_serial, esp3d_commands.getOutputClient(),
ESP3DClientType::socket_serial, ESP3DClientType::all_clients,
_TXbuffer, _TXbufferSize, _auth);
// dispatch command
if (msg) {
Expand Down

0 comments on commit 6455ee2

Please sign in to comment.