File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,16 @@ class WipperSnapper_I2C_Driver_Out_CharLcd
130130 message[cur_idx + 2 ] == ' \\ ' && message[cur_idx + 3 ] == ' n' ) {
131131 cur_idx += 4 ; // Skip \r\n and don't move the cursor two rows
132132 } else {
133- cur_idx += 2 ; // Skip either the \n or \r
133+ 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' );
139+ } else {
140+ break ;
141+ }
134142 }
135- break ; // and move to the next row
136143 } else if ((c == 0x0A || c == 0x0D ) && cur_idx + 1 < message_length) {
137144 if (c == 0x0A && cur_idx + 1 < message_length &&
138145 message[cur_idx + 1 ] == 0x0D ) {
@@ -141,6 +148,13 @@ class WipperSnapper_I2C_Driver_Out_CharLcd
141148 cur_idx += 1 ; // Skip single newline character
142149 }
143150 break ; // and move to the next row
151+ } else if (c == 0x0D ||
152+ (c == ' r' && c == ' \\ ' ) && cur_idx + 1 < message_length) {
153+ // write \r to the lcd
154+ WS_DEBUG_PRINTLN (" CharLCD: Detected carriage return sequence" );
155+ _lcd->write (' \\ ' );
156+ _lcd->write (' r' );
157+ cur_idx += 2 ;
144158 } else if (c == 194 && cur_idx + 1 < message_length &&
145159 message[cur_idx + 1 ] == 176 ) {
146160 cur_idx += 2 ; // Skip the degree symbol sequence in the buffer
You can’t perform that action at this time.
0 commit comments