Fix garbled OLED: send SSD1312 segment remap + charge pump via raw I2C

The vial-qmk-corne-choc-pro OLED driver does not support
OLED_IC_SSD1312, OLED_FLIP_SEGMENT, or configurable charge pump
(only the vial-qmk-keebart driver has these features). The previous
config defines were no-ops: OLED_IC_SSD1312 resolved to 0 (SSD1306),
OLED_FLIP_SEGMENT was never checked, and OLED_CHARGE_PUMP_VALUE was
ignored.

The driver hardcodes SEGMENT_REMAP_INV (0xA1) and CHARGE_PUMP 0x14,
but the SSD1312 needs SEGMENT_REMAP (0xA0) and 0x72 (9.0V). This
caused the garbled/mirrored text visible on the display.

Fix: Remove the no-op defines from config.h and send the correct
SSD1312 init commands as raw I2C overrides in oled_post_init().

Agent-Logs-Url: https://github.com/timfee/qmk_userspace/sessions/9ba5d3f7-eb8a-4121-978b-870c8401995c

Co-authored-by: timfee <3246342+timfee@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-12 23:37:28 +00:00 committed by GitHub
commit 3561787cce
Failed to generate hash of commit
2 changed files with 18 additions and 3 deletions

View file

@ -16,11 +16,13 @@
#define COMBO_ONLY_FROM_LAYER 0
// ── OLED (SSD1312 on Keebart Corne Choc Pro) ──
#define OLED_IC OLED_IC_SSD1312
// Note: The vial-qmk-corne-choc-pro driver lacks SSD1312 support
// (no OLED_IC_SSD1312, OLED_FLIP_SEGMENT, or configurable charge pump).
// We set what the driver honors here; the SSD1312-specific fixups
// (segment remap + charge pump voltage) are sent via raw I2C commands
// in oled_post_init() inside timfee.c.
#define OLED_DISPLAY_128X64
#define OLED_FLIP_SEGMENT
#define OLED_DISPLAY_ADDRESS 0x3C
#define OLED_CHARGE_PUMP_VALUE 0x72
#define OLED_BRIGHTNESS 64
#define OLED_TIMEOUT 0
#define OLED_TIMEOUT_USER 60000

View file

@ -317,6 +317,19 @@ static bool oled_post_init(void) {
pin_t pen = get_charge_pump_enable_pin();
gpio_write_pin_high(pen);
wait_ms(20);
// The vial-qmk-corne-choc-pro OLED driver does not support
// OLED_IC_SSD1312, OLED_FLIP_SEGMENT, or configurable charge pump.
// It hardcodes SEGMENT_REMAP_INV (0xA1) and CHARGE_PUMP 0x14,
// but the SSD1312 needs SEGMENT_REMAP (0xA0) and charge pump 0x72.
// Send the correct values as raw I2C commands after driver init.
static const uint8_t ssd1312_fixup[] = {
0x00, // I2C command mode
0xA0, // SEGMENT_REMAP: flip segment direction for SSD1312
0x8D, 0x72, // CHARGE_PUMP: 9.0 V for SSD1312
};
oled_send_cmd(ssd1312_fixup, sizeof(ssd1312_fixup));
oled_clear();
g_user_ontime = timer_read32();