Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ extra_scripts = pre:rename_usb_config.py
extends = common:esp32
board = adafruit_qtpy_esp32s3_n4r2
build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2 -DBOARD_HAS_PSRAM
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
extra_scripts = pre:rename_usb_config.py

[env:adafruit_qtpy_esp32s3_with_psram_debug]
Expand Down
32 changes: 29 additions & 3 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_CharLcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,35 @@ class WipperSnapper_I2C_Driver_Out_CharLcd
cur_col++) {
char c = message[cur_idx];
if (c == '\\' && cur_idx + 1 < message_length &&
message[cur_idx + 1] == 'n') {
cur_idx += 2; // Skip the '\n' character in the buffer
break; // and move to the next row
(message[cur_idx + 1] == 'n' || message[cur_idx + 1] == 'r')) {
// Handle \r\n sequence as a single newline
if (message[cur_idx + 1] == 'r' && cur_idx + 3 < message_length &&
message[cur_idx + 2] == '\\' && message[cur_idx + 3] == 'n') {
cur_idx += 4; // Skip \r\n and don't move the cursor two rows
break; // Move to the next row
} else {
cur_idx += 2; // Skip the \n or \r
if (c == '\\' && message[cur_idx + 1] == 'r') {
_lcd->write(0x2F);
_lcd->write('r');
} else {
break; // Move to the next row
}
}
} else if ((c == 0x0A || c == 0x0D) && cur_idx + 1 < message_length) {
if (c == 0x0A && cur_idx + 1 < message_length &&
message[cur_idx + 1] == 0x0D) {
cur_idx += 2; // Skip both LF and CR characters
} else {
cur_idx += 1; // Skip single newline character
}
break; // and move to the next row
} else if (c == 0x0D ||
(c == 'r' && c == '\\') && cur_idx + 1 < message_length) {
// write \r to the lcd
_lcd->write('\\');
_lcd->write('r');
cur_idx += 2;
} else if (c == 194 && cur_idx + 1 < message_length &&
message[cur_idx + 1] == 176) {
cur_idx += 2; // Skip the degree symbol sequence in the buffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
// Skip to the next possible line
y_idx += line_height;
_display->setCursor(0, y_idx);
} else if (message[i] == '\\' && i + 1 < msg_size &&
message[i + 1] == 'r') {
// skip the \r character, continue to the next character
i++;
continue;
} else if (message[i] == 0xC2 && message[i + 1] == 0xB0) {
_display->write(char(248));
_display->display();
Expand Down
Loading