display: fix font bit-order (MSB=left) and remove panel mirror; rfid: probe uses HALFDUPLEX so VersionReg read is valid

This commit is contained in:
2026-09-10 19:11:58 +02:00
parent d2a10df6c6
commit e8b6ee2dcc
2 changed files with 8 additions and 7 deletions

View File

@@ -72,10 +72,10 @@ esp_err_t display_manager_init(void)
ESP_ERROR_CHECK(esp_lcd_panel_reset(s_panel));
ESP_ERROR_CHECK(esp_lcd_panel_init(s_panel));
ESP_ERROR_CHECK(esp_lcd_panel_invert_color(s_panel, true));
/* This panel variant scans mirrored on X; flip so text reads correctly.
* If text appears upside-down instead, use mirror(false,true); if still
* mirrored both ways, use mirror(true,true). */
ESP_ERROR_CHECK(esp_lcd_panel_mirror(s_panel, true, false));
/* No panel mirror: the font bit-order fix in display_put_text already
* yields correct (non-mirrored) glyphs. Mirroring here would flip the
* whole frame and re-break the text. */
ESP_ERROR_CHECK(esp_lcd_panel_mirror(s_panel, false, false));
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(s_panel, true));
s_staging = malloc(DISP_W * sizeof(uint16_t));
@@ -132,13 +132,13 @@ int display_put_text(int x, int y, const char *str, uint16_t fg, uint16_t bg)
char c = *str++;
if (c >= FONT5X7_FIRST_CHAR && c <= FONT5X7_LAST_CHAR) {
const uint8_t *glyph = font5x7[c - FONT5X7_FIRST_CHAR];
/* Row-major [row][col] so the linear buffer matches what
* esp_lcd_panel_draw_bitmap expects. */
/* Row-major [row][col]. The font table stores each row with the
* MSB as the LEFT column, so read bit (W-1-gx) for column gx. */
uint16_t cell[FONT5X7_H][FONT5X7_W];
for (int gy = 0; gy < FONT5X7_H; gy++) {
for (int gx = 0; gx < FONT5X7_W; gx++) {
cell[gy][gx] = (glyph[gy] >> gx) & 1 ? fg : bg;
cell[gy][gx] = (glyph[gy] >> (FONT5X7_W - 1 - gx)) & 1 ? fg : bg;
}
}
if (x + FONT5X7_W <= DISP_W && y + FONT5X7_H <= DISP_H) {

View File

@@ -87,6 +87,7 @@ static void rfid_probe_version(void)
.command_bits = 1, /* read/write select bit */
.address_bits = 6, /* register address */
.dummy_bits = 1,
.flags = SPI_DEVICE_HALFDUPLEX, /* RX-only reads like the rc522 driver */
};
if (spi_bus_add_device(HW_RFID_SPI_HOST, &devcfg, &probe) != ESP_OK || probe == NULL) {
ESP_LOGW(TAG, "probe: could not add temp SPI device on SPI3");