Skip to content

Commit 1ac23c7

Browse files
committed
ssd1312: enforce column addressing to prevent horizontal offset/wrap
Explicitly set column address to 0 during initialization and screen updates to resolve intermittent ~20px horizontal offset and wrapping. Details: - Initialize columns to 0 in `ssd1312_configure()` via SSD1312_CMD_SET_LOW_COL(0) and SSD1312_CMD_SET_HIGH_COL(0). - Reset columns for every page in `ssd1312_update()` to override residual state. - Fixes rare display corruption caused by uninitialized column addressing in Page Mode, where stale column values shifted pixels horizontally.
1 parent 0390741 commit 1ac23c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ui/oled/ssd1312.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ static uint8_t* _frame_buffer;
8383
void ssd1312_configure(uint8_t* buf)
8484
{
8585
_frame_buffer = buf;
86+
oled_writer_write_cmd(SSD1312_CMD_SET_LOW_COL(0));
87+
oled_writer_write_cmd(SSD1312_CMD_SET_HIGH_COL(0));
8688
oled_writer_write_cmd(SSD1312_CMD_SET_DISPLAY_OFF);
8789
oled_writer_write_cmd_with_param(SSD1312_CMD_SET_CONTRAST_CONTROL, 0xff);
8890
oled_writer_write_cmd_with_param(
@@ -118,6 +120,12 @@ void ssd1312_update(void)
118120
/* The SSD1312 has one page per 8 rows. One page is 128 bytes. Every byte is 8 rows */
119121
for (size_t i = 0; i < 64 / 8; i++) {
120122
oled_writer_write_cmd(SSD1312_CMD_SET_PAGE_START_ADDRESS(i));
123+
// Explicitly set column address to 0 during initialization and screen updates to resolve
124+
// intermittent ~20px horizontal offset and wrapping, which was experienced on one Nova
125+
// device so far. This fixes the symptom, not the underlying issue, as we expect the column
126+
// address to be correct if all bytes arrive at the screen.
127+
oled_writer_write_cmd(SSD1312_CMD_SET_LOW_COL(0));
128+
oled_writer_write_cmd(SSD1312_CMD_SET_HIGH_COL(0));
121129
oled_writer_write_data(&_frame_buffer[i * 128], 128);
122130
}
123131
}

0 commit comments

Comments
 (0)