@@ -116,28 +116,20 @@ class WipperSnapper_I2C_Driver_Out_CharLcd
116116 for (int cur_col = 0 ; cur_col < _cols && cur_idx < message_length;
117117 cur_col++) {
118118 char c = message[cur_idx];
119- WS_DEBUG_PRINTLN (" CharLCD: Writing char: " );
120- WS_DEBUG_PRINT (c);
121- WS_DEBUG_PRINT (" | hex:0x" );
122- // print hex
123- WS_DEBUG_PRINTHEX (c);
124- WS_DEBUG_PRINTLN (" " );
125119 if (c == ' \\ ' && cur_idx + 1 < message_length &&
126120 (message[cur_idx + 1 ] == ' n' || message[cur_idx + 1 ] == ' r' )) {
127- WS_DEBUG_PRINTLN (" CharLCD: Detected newline sequence" );
128121 // Handle \r\n sequence as a single newline
129122 if (message[cur_idx + 1 ] == ' r' && cur_idx + 3 < message_length &&
130123 message[cur_idx + 2 ] == ' \\ ' && message[cur_idx + 3 ] == ' n' ) {
131124 cur_idx += 4 ; // Skip \r\n and don't move the cursor two rows
125+ break ; // Move to the next row
132126 } else {
133127 cur_idx += 2 ; // Skip the \n or \r
134- WS_DEBUG_PRINTLN (" CharLCD: Detected single character" );
135- if (c == ' \\ ' && message[cur_idx + 1 ] == ' n' ) {
136- WS_DEBUG_PRINTLN (" CharLCD: Detected newline character" );
137- _lcd->write (' \\ ' );
138- _lcd->write (' n' );
128+ if (c == ' \\ ' && message[cur_idx + 1 ] == ' r' ) {
129+ _lcd->write (0x2F );
130+ _lcd->write (' r' );
139131 } else {
140- break ;
132+ break ; // Move to the next row
141133 }
142134 }
143135 } else if ((c == 0x0A || c == 0x0D ) && cur_idx + 1 < message_length) {
@@ -151,7 +143,6 @@ class WipperSnapper_I2C_Driver_Out_CharLcd
151143 } else if (c == 0x0D ||
152144 (c == ' r' && c == ' \\ ' ) && cur_idx + 1 < message_length) {
153145 // write \r to the lcd
154- WS_DEBUG_PRINTLN (" CharLCD: Detected carriage return sequence" );
155146 _lcd->write (' \\ ' );
156147 _lcd->write (' r' );
157148 cur_idx += 2 ;
0 commit comments