Skip to content

Commit d8d58ba

Browse files
authored
fix(ws-s3-touch): Fix display size/offset and color order (#479)
* fix(ws-s3-touch): Fix display size/offset and color order * readme: update
1 parent 3de44b0 commit d8d58ba

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

components/ws-s3-touch/example/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ display. It also plays a sound when you touch the screen using the buzzer on the
77
system, and it changes the frequency of the sound based on the position of the
88
touch.
99

10+
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/06403f4d-ffe4-4ed8-8eca-f6d1d85a878c" />
11+
12+
Older images from when the color / size was incorrectly set:
1013
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/17e8def4-0d64-4e9e-8cee-dc2753a657a6" />
1114
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/512ca611-1ab0-4941-b4a3-4ef22d65e567" />
1215

@@ -37,6 +40,9 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui
3740

3841
<img width="777" height="604" alt="CleanShot 2025-07-13 at 22 01 56" src="https://github.com/user-attachments/assets/02ea3513-7af9-43bb-96e4-10706f31f831" />
3942

43+
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/06403f4d-ffe4-4ed8-8eca-f6d1d85a878c" />
44+
45+
Older images from when the color / size was incorrectly set:
4046
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/17e8def4-0d64-4e9e-8cee-dc2753a657a6" />
4147
<img width="1260" height="949" alt="image" src="https://github.com/user-attachments/assets/512ca611-1ab0-4941-b4a3-4ef22d65e567" />
4248

components/ws-s3-touch/include/ws-s3-touch.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ class WsS3Touch : public BaseComponent {
314314

315315
// LCD
316316
static constexpr size_t lcd_width_ = 240;
317-
static constexpr size_t lcd_height_ = 320;
317+
static constexpr size_t lcd_height_ =
318+
280; // NOTE: the display is actually 320x240, but only 280px are visible
318319
static constexpr size_t lcd_bytes_per_pixel = 2;
319320
static constexpr int lcd_clock_speed = 60 * 1000 * 1000;
320321
static constexpr auto lcd_spi_num = SPI2_HOST;
@@ -331,7 +332,9 @@ class WsS3Touch : public BaseComponent {
331332
static constexpr bool mirror_x = false;
332333
static constexpr bool mirror_y = false;
333334
static constexpr bool swap_xy = false;
334-
static constexpr bool swap_color_order = true;
335+
static constexpr bool swap_color_order = false;
336+
static constexpr size_t offset_x = 0;
337+
static constexpr size_t offset_y = (320 - lcd_height_) / 2; // center the display vertically
335338

336339
// sound
337340
static constexpr size_t buzzer_default_frequency_hz = 5000;

components/ws-s3-touch/src/video.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ bool WsS3Touch::initialize_lcd() {
8686
.reset_value = reset_value,
8787
.invert_colors = invert_colors,
8888
.swap_color_order = swap_color_order,
89+
.offset_x = offset_x,
90+
.offset_y = offset_y,
8991
.swap_xy = swap_xy,
9092
.mirror_x = mirror_x,
9193
.mirror_y = mirror_y});

0 commit comments

Comments
 (0)