Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 24 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,30 @@ 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 {
if (message[cur_idx + 1] == 'r') {
_lcd->write('\\');
_lcd->write('r');
cur_idx += 2; // Skip the \r
} else {
cur_idx += 2; // Skip the \n
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 == 194 && cur_idx + 1 < message_length &&
message[cur_idx + 1] == 176) {
cur_idx += 2; // Skip the degree symbol sequence in the buffer
Expand Down
21 changes: 15 additions & 6 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,21 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
uint16_t c_idx = 0;
size_t msg_size = strlen(message);
for (size_t i = 0; i < msg_size && c_idx < msg_size; i++) {
if (message[i] == '\\' && i + 1 < msg_size && message[i + 1] == 'n') {
// detected a newline char sequence (\n)
i++;
// Skip to the next possible line
y_idx += line_height;
_display->setCursor(0, y_idx);
if (message[i] == '\\' && i + 1 < msg_size &&
(message[i + 1] == 'n' || message[i + 1] == 'r')) {
// Handle \r\n sequence as a single newline
if (message[i + 1] == 'r' && i + 3 < msg_size &&
message[i + 2] == '\\' && message[i + 3] == 'n') {
// Skip to the next line
y_idx += line_height;
_display->setCursor(0, y_idx);
i += 3;
} else if (message[i + 1] == 'n') {
// Skip to the next line
y_idx += line_height;
_display->setCursor(0, y_idx);
i++;
}
} else if (message[i] == 0xC2 && message[i + 1] == 0xB0) {
_display->write(char(248));
_display->display();
Expand Down
Loading