Skip to content

Commit 7fa0b62

Browse files
committed
2 parents 51108cf + e777fc5 commit 7fa0b62

5 files changed

Lines changed: 41 additions & 3 deletions

File tree

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ lib_deps =
109109

110110
[lovyangfx]
111111
lib_deps =
112-
lovyan03/LovyanGFX@^1.1.12
112+
lovyan03/LovyanGFX@~1.2.21
113113

114114
[arduinogfx]
115115
lib_deps =

platformio_override-template.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ extra_default_envs =
8686
; sensecap-indicator-d1_8MB
8787
; -- Sunton -----------------------------------
8888
; esp32-2432s022c_4MB
89+
; esp32-2432s024c_4MB
90+
; esp32-2432s024r_4MB
8991
; esp32-2432s028r_4MB
9092
; esp32-2432s028r-ili9342_4MB
9193
; esp32-2432s028r_v2_4MB

src/drv/tft/tft_driver_lovyangfx.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,14 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
446446
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
447447

448448
cfg.bus_shared = true;
449-
cfg.offset_rotation = 0;
449+
cfg.offset_rotation = TOUCH_OFFSET_ROTATION;
450+
#ifdef SPI_TOUCH_FREQUENCY
451+
cfg.freq = SPI_TOUCH_FREQUENCY;
452+
#endif
453+
cfg.x_min = 0; // XPT2046 raw ADC minimum (12-bit)
454+
cfg.x_max = 4095; // XPT2046 raw ADC maximum (12-bit)
455+
cfg.y_min = 0;
456+
cfg.y_max = 4095;
450457

451458
cfg.spi_host = SPI3_HOST;
452459
// cfg.pin_sclk = 18;

src/sys/gpio/hasp_gpio.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ hasp_gpio_config_t gpioConfig[HASP_NUM_GPIO_CONFIG] = {
4545
{.pin = RELAY_3, .group = 3, .gpio_function = OUTPUT, .type = LIGHT_RELAY},
4646
{.pin = LED_GREEN, .group = 5, .gpio_function = OUTPUT, .type = LED_G},
4747
{.pin = LED_BLUE, .group = 6, .gpio_function = OUTPUT, .type = LED_B}
48+
#elif defined(ESP32_2432S024)
49+
{.pin = LED_RED, .group = 4, .gpio_function = OUTPUT, .type = LED_R, .inverted = 1},
50+
{.pin = LED_GREEN, .group = 5, .gpio_function = OUTPUT, .type = LED_G, .inverted = 1},
51+
{.pin = LED_BLUE, .group = 6, .gpio_function = OUTPUT, .type = LED_B, .inverted = 1}
4852
#endif
4953
// {2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW},
5054
};

user_setups/esp32/esp32-2432s024.ini

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,37 @@ build_flags =
1414
${esp32.no_ps_ram}
1515
-D ESP32_2432S024=1
1616

17+
;region -- RGB LED (MHP5050RGBDT, common-anode, active LOW) --------
18+
; The LED anodes share a common 3.3V rail via current-limiting resistors.
19+
; GPIOs sink current (active LOW = LED ON), so firmware must use inverted=1.
20+
; See hasp_gpio.cpp for the compile-time defaults that set this up.
21+
;
22+
; PCB resistor values (NOTE: published schematics are incorrect for this board):
23+
; LED_RED (GPIO4) : 1kΩ -- measured Vf = 1.79V
24+
; LED_GREEN (GPIO17): 100Ω -- measured Vf = 2.29V
25+
; LED_BLUE (GPIO16) : 100Ω -- measured Vf = 1.90V
26+
;
27+
; For balanced white (BT.601 luminance weights R=29.9% G=58.7% B=11.4%),
28+
; replace resistors as follows (calculated from measured Vf, V(λ) eye sensitivity,
29+
; targeting ~12mA max per GPIO):
30+
; LED_RED : replace 1kΩ → 150Ω (~9.4mA)
31+
; LED_GREEN: replace 100Ω → 150Ω (~6.1mA)
32+
; LED_BLUE : keep 100Ω (~13mA, limited by low Vf)
33+
; Without this hardware fix, white appears turquoise due to red being ~7x too dim.
34+
; Software compensation could be possible but is not implemented in the current
35+
; firmware release.
36+
-D LED_RED=4
37+
-D LED_GREEN=17
38+
-D LED_BLUE=16
39+
;endregion
40+
1741
;region -- TFT_eSPI build options ------------------------
1842
${esp32.hspi} ; Use HSPI hardware SPI bus
1943
;-D USER_SETUP_LOADED=1
2044
-D LGFX_USE_V1=1
2145
-D ILI9341_DRIVER=1
2246
-D HASP_USE_LGFX_TOUCH=1
23-
-D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree, Mirrors: 6, 5, 4, 3
47+
-D TFT_ROTATION=2 ; 0=0, 1=90, 2=180 or 3=270 degree, Mirrors: 6, 5, 4, 3
2448
-D TFT_WIDTH=240
2549
-D TFT_HEIGHT=320
2650
-D TFT_CS=15 ;// Chip select control pin
@@ -53,6 +77,7 @@ build_flags =
5377
-D TOUCH_MOSI=13
5478
-D TOUCH_MISO=12
5579
-D TOUCH_IRQ=36
80+
-D TOUCH_OFFSET_ROTATION=2 ; touch rotation to match TFT_ROTATION=2
5681
-D SPI_TOUCH_FREQUENCY=2500000
5782

5883
lib_deps =

0 commit comments

Comments
 (0)