Add optional cyd_35r (ESP32-3248S035) with 480x320 UI; default remains 2.8.
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -13,7 +13,11 @@
|
||||
|
||||
#define I2C_SDA 22
|
||||
#define I2C_SCL 27
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define TFT_BL_PIN 27
|
||||
#else
|
||||
#define TFT_BL_PIN 21
|
||||
#endif
|
||||
|
||||
#define XPT2046_IRQ 36
|
||||
#define XPT2046_MOSI 32
|
||||
@@ -21,8 +25,13 @@
|
||||
#define XPT2046_CLK 25
|
||||
#define XPT2046_CS 33
|
||||
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define SCREEN_WIDTH 480
|
||||
#define SCREEN_HEIGHT 320
|
||||
#else
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
#endif
|
||||
#define SGP_READ_MS 1000
|
||||
#define SGP_FAIL_TOLERANCE 3
|
||||
#define EMA_ALPHA 0.35f
|
||||
@@ -35,16 +44,29 @@
|
||||
#define TVOC_ARC_MAX 1000
|
||||
|
||||
/* Layout grid — every region has exclusive space, no overlaps */
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define UI_M 10
|
||||
#define UI_G 10
|
||||
#define UI_HDR_H 32
|
||||
#define UI_GAUGE_H 168
|
||||
#define UI_GAUGE_W 225
|
||||
#define UI_ARC 120
|
||||
#else
|
||||
#define UI_M 6
|
||||
#define UI_G 6
|
||||
#define UI_HDR_H 22
|
||||
#define UI_GAUGE_H 124
|
||||
#define UI_GAUGE_W 151
|
||||
#define UI_ARC 90
|
||||
#endif
|
||||
#define UI_BOT_Y (UI_HDR_H + UI_G + UI_GAUGE_H + UI_G) /* 158 */
|
||||
#define UI_BOT_H (SCREEN_HEIGHT - UI_BOT_Y - UI_M) /* 76 */
|
||||
#define UI_BOT_W (SCREEN_WIDTH - 2 * UI_M) /* 308 */
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define UI_INFO_W 180
|
||||
#else
|
||||
#define UI_INFO_W 124
|
||||
#endif
|
||||
#define UI_CHART_W (UI_BOT_W - 12 - UI_INFO_W - UI_G) /* ~160 */
|
||||
|
||||
static const lv_color_t COL_BG = lv_color_hex(0x0A1018);
|
||||
@@ -600,7 +622,11 @@ void setup() {
|
||||
touchscreen.begin(touchscreenSPI);
|
||||
touchscreen.setRotation(2);
|
||||
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
lv_display_t *disp = lv_tft_espi_create(320, 480, draw_buf, sizeof(draw_buf));
|
||||
#else
|
||||
lv_display_t *disp = lv_tft_espi_create(240, 320, draw_buf, sizeof(draw_buf));
|
||||
#endif
|
||||
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270);
|
||||
|
||||
lv_indev_t *indev = lv_indev_create();
|
||||
|
||||
Reference in New Issue
Block a user