Portrait UI redesign + HA wire-ups for bedroom fan/light

- Rotate display to portrait (rotation: 0°), 4-row LVGL grid
- Fix touchscreen calibration/transform for portrait orientation
- Wire buttons to alpha_bedroom_{light,ceiling_fan,color_temp}
- Sync button checked state from HA (light/fan on-off + fan percentage)
- Document new orientation and Windows venv path in CLAUDE.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Christopher Wiebe
2026-05-10 18:00:10 -07:00
parent a2fbb7ad6a
commit 80378b1d95
2 changed files with 139 additions and 36 deletions
+9 -3
View File
@@ -35,8 +35,9 @@ output (LOW silences it). No impact on UART download mode or OTA flashing.
- 2-bit grayscale fully working via custom component `waveshare_epaper_2bit`
- LVGL rendering working, 4-shade colorspace confirmed
- Bayer ordered dithering implemented for gradient smoothing
- Touchscreen working: polling mode, mirror_x + mirror_y transforms confirmed correct
- Touchscreen working: polling mode, portrait-orientation transform confirmed correct
- LVGL touch input and button state working end-to-end
- Panel now mounted vertically (portrait); 4-row layout for light/fan controls
- **Active: LVGL layout work**
## Display Refresh Pattern
@@ -75,7 +76,11 @@ Amplitude chosen to keep 0xAAAAAA and 0x555555 as solid fills.
- Touch count at register 0x1001, touch data at 0x1002 (7 bytes/point), clear by writing 0x00 to 0x1001
- Waveshare's own driver inverts both axes: X = 295 - raw_x, Y = 127 - raw_y
- INT pulse is very brief (sub-ms); component works in polling mode regardless
- Coordinate transform: mirror_x + mirror_y confirmed correct; swap_xy not needed
- Coordinate transform (portrait, display rotation 0°): `swap_xy: true, mirror_x: true`,
calibration `x_max: 127, y_max: 295`. Gotcha: ESPHome's base class applies `swap_xy`
*before* calibration normalization (see `touchscreen.cpp::add_raw_touch_position_`),
so calibration `x_max`/`y_max` must describe the **post-swap** range — i.e., match
the display width/height, not the raw sensor's native axes.
## Relevant Files
- Custom component: `custom_components/waveshare_epaper_2bit/`
@@ -85,4 +90,5 @@ Amplitude chosen to keep 0xAAAAAA and 0x555555 as solid fills.
- `waveshare_epaper_2bit.h` — header
- Main config: `waveshare-test.yaml` (pin table here is source of truth)
- Build cache: `.esphome/build/waveshare-epaper-test/src/esphome/components/`
- ESPHome source (venv): ~/Code/esphome-2026.1.0/
- ESPHome venv (Windows): `C:\Projects\python_virtual\esphome-2026.1.0` (activate before `esphome` commands)
- ESPHome source (WSL venv): ~/Code/esphome-2026.1.0/