Refactor display initialization and update configuration for improved stability in Cat Medication Tracker
This commit is contained in:
@@ -8,12 +8,6 @@ esphome:
|
||||
on_boot:
|
||||
priority: 100
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 100%
|
||||
- delay: 300ms
|
||||
- light.turn_off: backlight
|
||||
- delay: 300ms
|
||||
- light.turn_on: backlight
|
||||
- delay: 300ms
|
||||
- component.update: my_display
|
||||
@@ -70,7 +64,7 @@ display:
|
||||
cs_pin: GPIO15
|
||||
dc_pin: GPIO2
|
||||
reset_pin: GPIO4
|
||||
# rotation: 0 # Commenting out; overriding MADCTL manually below for better compatibility
|
||||
rotation: 0
|
||||
invert_colors: true
|
||||
color_order: bgr
|
||||
data_rate: 10MHz # Reduced from 20MHz to improve stability
|
||||
@@ -80,13 +74,9 @@ display:
|
||||
id: my_display
|
||||
auto_clear_enabled: false
|
||||
update_interval: 2s
|
||||
color_depth: 18 # Key fix: align with 0x3A 0x66 (18-bit mode)
|
||||
color_depth: 16
|
||||
buffer_size: 25%
|
||||
lambda: |-
|
||||
// Quick test: fill entire screen bright red to confirm display is alive
|
||||
// Comment out once working
|
||||
it.fill(Color(255, 0, 0));
|
||||
|
||||
// Colors
|
||||
auto red = Color(255, 0, 0);
|
||||
auto green = Color(0, 200, 0);
|
||||
@@ -95,10 +85,6 @@ display:
|
||||
auto black = Color(0, 0, 0);
|
||||
auto dark_grey = Color(80, 80, 80);
|
||||
|
||||
// Force common MADCTL for portrait (try 0x28, 0x48, 0x68, 0x98 if still wrong orientation)
|
||||
it.command(0x36);
|
||||
it.data(0x28); // ← Try this first; change to 0x48 / 0x68 etc. if upside-down/mirrored
|
||||
|
||||
// Fill background
|
||||
it.fill(light_grey);
|
||||
|
||||
@@ -147,6 +133,7 @@ display:
|
||||
it.filled_rectangle(reset_x, reset_y, reset_w, reset_h, dark_grey);
|
||||
it.rectangle(reset_x, reset_y, reset_w, reset_h, black);
|
||||
it.printf(reset_x + reset_w/2, reset_y + reset_h/2, id(status_font), white, TextAlign::CENTER, "RESET");
|
||||
|
||||
# XPT2046 Touchscreen
|
||||
touchscreen:
|
||||
- platform: xpt2046
|
||||
|
||||
Reference in New Issue
Block a user