Skip to content
Open
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
12 changes: 10 additions & 2 deletions firmware/esp32-csi-node/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ if(CONFIG_CSI_MOCK_ENABLED)
list(APPEND SRCS "mock_csi.c" "rv_radio_ops_mock.c")
endif()

# ADR-045: AMOLED display support (compile-time optional)
# ADR-045: on-device display support (compile-time optional).
# Exactly one panel HAL is compiled, selected by the DISPLAY_PANEL choice.
if(CONFIG_DISPLAY_ENABLE)
list(APPEND SRCS "display_hal.c" "display_ui.c" "display_task.c")
list(APPEND SRCS "display_task.c")
if(CONFIG_DISPLAY_PANEL_ST7789)
# 240x280 ST7789: compact UI + ST7789 HAL.
list(APPEND SRCS "display_hal_st7789.c" "display_ui_st7789.c")
else()
# 368x448 SH8601 AMOLED: 4-view UI + QSPI HAL.
list(APPEND SRCS "display_hal.c" "display_ui.c")
endif()
list(APPEND REQUIRES esp_lcd esp_lcd_touch lvgl)
endif()

Expand Down
99 changes: 94 additions & 5 deletions firmware/esp32-csi-node/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,104 @@ menu "Adaptive Controller (ADR-081)"

endmenu

menu "AMOLED Display (ADR-045)"
menu "Display (ADR-045)"

config DISPLAY_ENABLE
bool "Enable AMOLED display support"
bool "Enable on-device display support"
default y
help
Enable RM67162 QSPI AMOLED display and LVGL UI.
Auto-detects at boot; gracefully skips if no display hardware.
Requires SPIRAM for frame buffers.
Enable the LVGL UI on an attached panel. Auto-detects at boot;
gracefully skips if no display hardware. Requires SPIRAM for
frame buffers. Choose the panel type below — the CSI pipeline
runs unchanged regardless of panel.

choice DISPLAY_PANEL
prompt "Display panel"
depends on DISPLAY_ENABLE
default DISPLAY_PANEL_SH8601
help
Which physical panel is attached. Exactly one HAL is compiled.

config DISPLAY_PANEL_SH8601
bool "SH8601 QSPI AMOLED (Waveshare ESP32-S3-Touch-AMOLED-1.8, 368x448)"

config DISPLAY_PANEL_ST7789
bool "ST7789V2 SPI LCD (Waveshare ESP32-S3-Touch-LCD-1.69, 240x280)"
endchoice

# ---- ST7789 SPI LCD pins / geometry (Waveshare 1.69 defaults) ----
config DISPLAY_ST7789_SCLK
int "ST7789 SPI SCLK GPIO"
default 6
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_MOSI
int "ST7789 SPI MOSI GPIO"
default 7
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_CS
int "ST7789 SPI CS GPIO"
default 5
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_DC
int "ST7789 SPI DC GPIO"
default 4
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_RST
int "ST7789 RST GPIO"
default 8
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_BL
int "ST7789 backlight PWM GPIO"
default 15
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_H_RES
int "ST7789 horizontal resolution"
default 240
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_V_RES
int "ST7789 vertical resolution"
default 280
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_GAP_X
int "ST7789 column offset (gap X)"
default 0
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_GAP_Y
int "ST7789 row offset (gap Y)"
default 20
depends on DISPLAY_PANEL_ST7789
help
The 240x280 visible window sits at row 20 of the ST7789's
240x320 controller RAM. Adjust if the image is shifted.

config DISPLAY_ST7789_TOUCH_SDA
int "CST816 touch I2C SDA GPIO"
default 11
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_TOUCH_SCL
int "CST816 touch I2C SCL GPIO"
default 10
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_TOUCH_RST
int "CST816 touch RST GPIO"
default 13
depends on DISPLAY_PANEL_ST7789

config DISPLAY_ST7789_TOUCH_INT
int "CST816 touch INT GPIO"
default 14
depends on DISPLAY_PANEL_ST7789

config DISPLAY_FPS_LIMIT
int "Display refresh rate limit (FPS)"
Expand Down
9 changes: 9 additions & 0 deletions firmware/esp32-csi-node/main/display_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,13 @@ void display_hal_set_brightness(uint8_t percent)
panel_write_cmd(0x51, &val, 1);
}

void display_hal_refresh(void)
{
/* Re-assert display-on (0x29) + brightness so a transient brownout that
* dimmed the panel self-recovers without a full re-init. */
if (!s_io_handle) return;
panel_write_cmd(0x29, NULL, 0);
display_hal_set_brightness(CONFIG_DISPLAY_BRIGHTNESS);
}

#endif /* CONFIG_DISPLAY_ENABLE */
10 changes: 10 additions & 0 deletions firmware/esp32-csi-node/main/display_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ bool display_hal_touch_read(uint16_t *x, uint16_t *y);
*/
void display_hal_set_brightness(uint8_t percent);

/**
* Self-heal: re-assert backlight + display-on state.
*
* Called periodically by the display task so a transient power sag
* (e.g. shared-USB brownout dimming the backlight) auto-recovers
* instead of leaving the panel dark while the MCU keeps running.
* Cheap and flicker-free — does NOT re-init the panel.
*/
void display_hal_refresh(void);

#ifdef __cplusplus
}
#endif
Expand Down
Loading