Skip to content

Commit

Permalink
Add Sunton S3 4.3"
Browse files Browse the repository at this point in the history
  • Loading branch information
fvanroie committed Nov 17, 2022
1 parent 27207d3 commit 18a76a0
Show file tree
Hide file tree
Showing 9 changed files with 11,305 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- out: makerfabs
env: "makerfabs-tft35-cap -e makerfabs-s3-tft35-spi"
- out: sunton
env: "esp32-2432s028r_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB"
env: "esp32-2432s028r_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e esp32-s3-4827s043r_16MB -e esp32-s3-4827s043c_16MB -e esp32-s3-8048s043c_16MB"
- out: wireless-tag
env: "wt32-sc01_4MB -e wt32-sc01_16MB -e wt-86-32-3zw1 -e wt32-sc01-plus_8MB"
- out: yeacreate
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ src/custom/*
!src/custom/my_custom_template.cpp
!src/custom/my_custom_fan_template.cpp

#npm filter
node_modules/*
package.json
package-lock.json

## Test result files
*.xml

Expand Down
108 changes: 103 additions & 5 deletions include/lv_conf_v7.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ typedef int16_t lv_coord_t;
#ifndef LV_VDB_SIZE
#if defined(ARDUINO_ARCH_ESP8266)
# define LV_VDB_SIZE (8 * 1024U) // Minimum 8 Kb
#elif defined(ESP32S2)
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
# define LV_VDB_SIZE (16 * 1024U) // 16kB draw buffer
#elif defined(ESP32S3)
# define LV_VDB_SIZE (32 * 1024U) // 16kB draw buffer
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
# define LV_VDB_SIZE (48 * 1024U) // 16kB draw buffer
#elif defined(ARDUINO_ARCH_ESP32)
# define LV_VDB_SIZE (32 * 1024U) // 32kB draw buffer
#else
Expand Down Expand Up @@ -376,8 +376,56 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
/*==================
* FONT USAGE
*===================*/
#if TFT_HEIGHT>=480 && TFT_WIDTH>=480
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_64_LATIN1
#define ROBOTOCONDENSED_REGULAR_64_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
#endif

#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_24_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_32_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_64_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */
#endif

#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 24
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 32
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 48
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 64
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 16
#endif

#if TFT_HEIGHT>=480 || TFT_WIDTH>=480
#elif TFT_HEIGHT>=320 && TFT_WIDTH>=320
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
#endif
Expand Down Expand Up @@ -425,7 +473,57 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 12
#endif
#else // not 320x480

#elif TFT_HEIGHT>=272 && TFT_WIDTH>=272
#ifndef ROBOTOCONDENSED_REGULAR_14_LATIN1
#define ROBOTOCONDENSED_REGULAR_14_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_18_LATIN1
#define ROBOTOCONDENSED_REGULAR_18_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1
#define ROBOTOCONDENSED_REGULAR_28_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_36_LATIN1
#define ROBOTOCONDENSED_REGULAR_36_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif

#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_14_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_18_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_36_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */
#endif

#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 14
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 18
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 28
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 36
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#endif

#else // smaller than 272

#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_12_latin1 /* 5% Width */
Expand Down
46 changes: 38 additions & 8 deletions platformio_override-template.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,51 @@ build_flags =
;region -- Default Build Environments : Used when Build All ---
extra_default_envs =
; Uncomment specific environments or create extra:
; az-touch-mod-esp32_ili9341
; az-touch-mod-esp32_ili9341_4MB
; az-touch-mod-esp32_ili9341_8MB
; d1-mini-esp32_ili9341
; d1-r32-unoshield
; esp32-9341-unoshield-analog
; esp12e-st7735
; d1-r32-unoshield_ili9341_adc
; d1-r32-unoshield_ili9486_adc
; d1-r32-waveshare_ili9486
; esp32-2432s028r_4MB
; esp32-3248s035c_4MB
; esp32-3248s035c_4MB_lovyan
; esp32-3248s035r_4MB
; esp32-one_ili9486
; esp32-one_st7796
; esp32dev-mrb3511
; esp32dev-ili9488
; esp32-s3-4827s043c_16MB
; esp32-s3-4827s043r_16MB
; esp32-s3-8048s043c_16MB
; esp32-touchdown
; freetouchdeck_4MB
; freetouchdeck_8MB
; freetouchdeck-s3_8MB
; gs-t3e_16MB
; huzzah32-featherwing-24
; huzzah32-featherwing-35
; lanbon_l8
; lanbon_l8_eth
; lilygo-lily-pi_ili9481
; lilygo-lily-pi_st7796
; lolin-d32-pro_ili9341
; my_custom_build
; m5stack-core2
; m5stack-tough
; makerfabs-s3-tft35-spi
; makerfabs-tft35-cap
; makerfabs-tft-s2_ili9488
; nodemcu32s-raspi
; s2-mini-esp32s2_ili9341
; ttgo_esp32_poe-ili9341
; ttgo-lilygo-pi_ili9481
; wt32-sc01
; ttgo-lilygo-pi_st7796
; ttgo-t7-v1.5_ili9341_16MB
; ttgo-t7-v1.5_ili9341_4MB
; wt32-sc01_16MB
; wt32-sc01_4MB
; wt32-sc01-plus_16MB
; wt32-sc01-plus_8MB
; wt-86-32-3zw1
; yeacreate-nscreen32
;endregion

;region -- Define your local COM ports for each environment ---
Expand Down
25 changes: 25 additions & 0 deletions src/drv/tft/tft_driver_arduinogfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void ArduinoGfx::init(int w, int h)
{
LOG_TRACE(TAG_TFT, F(D_SERVICE_STARTING));

#if(TFT_WIDTH == 480) && (TFT_HEIGHT == 480)
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_ESP32RGBPanel* bus = new Arduino_ESP32RGBPanel(
39 /* CS */, 15 /* SCK */, 14 /* SDA */, 18 /* DE */, 17 /* VSYNC */, 16 /* HSYNC */, 21 /* PCLK */, 4 /* R0 */,
Expand All @@ -31,6 +32,30 @@ void ArduinoGfx::init(int w, int h)
tft = new Arduino_ST7701_RGBPanel(bus, GFX_NOT_DEFINED /* RST */, 0 /* rotation */, true /* IPS */, 480 /* width */,
480 /* height */, st7701_type1_init_operations,
sizeof(st7701_type1_init_operations), true /* BGR */);
#elif 1
Arduino_ESP32RGBPanel* bus = new Arduino_ESP32RGBPanel(
GFX_NOT_DEFINED /* CS */, GFX_NOT_DEFINED /* SCK */, GFX_NOT_DEFINED /* SDA */, 40 /* DE */, 41 /* VSYNC */,
39 /* HSYNC */, 42 /* PCLK */, 45 /* R0 */, 48 /* R1 */, 47 /* R2 */, 21 /* R3 */, 14 /* R4 */, 5 /* G0 */,
6 /* G1 */, 7 /* G2 */, 15 /* G3 */, 16 /* G4 */, 4 /* G5 */, 8 /* B0 */, 3 /* B1 */, 46 /* B2 */, 9 /* B3 */,
1 /* B4 */
);
#if(TFT_WIDTH == 480) && (TFT_HEIGHT == 272)
// ILI6485 LCD 480x272
tft = new Arduino_RPi_DPI_RGBPanel(bus, 480 /* width */, 0 /* hsync_polarity */, 8 /* hsync_front_porch */,
4 /* hsync_pulse_width */, 43 /* hsync_back_porch */, 272 /* height */,
0 /* vsync_polarity */, 8 /* vsync_front_porch */, 4 /* vsync_pulse_width */,
12 /* vsync_back_porch */, 1 /* pclk_active_neg */, 9000000 /* prefer_speed */,
true /* auto_flush */);
#elif(TFT_WIDTH == 800) && (TFT_HEIGHT == 480)
// ST7262 IPS LCD 800x480
tft = new Arduino_RPi_DPI_RGBPanel(bus, 800 /* width */, 0 /* hsync_polarity */, 8 /* hsync_front_porch */,
4 /* hsync_pulse_width */, 8 /* hsync_back_porch */, 480 /* height */,
0 /* vsync_polarity */, 8 /* vsync_front_porch */, 4 /* vsync_pulse_width */,
8 /* vsync_back_porch */, 1 /* pclk_active_neg */, 14000000 /* prefer_speed */,
true /* auto_flush */);
#endif

#endif

/* TFT init */
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
Expand Down
15 changes: 12 additions & 3 deletions src/drv/touch/touch_driver_gt911.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ IRAM_ATTR void GT911_setXY(int8_t contacts, GTPoint* points)
namespace dev {

class TouchGt911 : public BaseTouch {

public:
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{
Expand All @@ -72,16 +71,26 @@ class TouchGt911 : public BaseTouch {

if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle

#ifdef TOUCH_WIDTH
data->point.x = map(points[0].x, 0, TOUCH_WIDTH - 1, 0, TFT_WIDTH - 1);
#else
data->point.x = points[0].x;
#endif

#ifdef TOUCH_HEIGHT
data->point.y = map(points[0].y, 0, TOUCH_HEIGHT - 1, 0, TFT_HEIGHT - 1);
#else
data->point.y = points[0].y;
data->state = LV_INDEV_STATE_PR;
#endif

data->state = LV_INDEV_STATE_PR;
hasp_set_sleep_offset(0); // Reset the offset

} else {
data->state = LV_INDEV_STATE_REL;
}

// touch.loop(); // reset IRQ (now in readInput)
// touch.loop(); // reset IRQ (now in readInput)

/*Return `false` because we are not buffering and no more data to read*/
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/font/encodings.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
38,
40,
44,
48
48,
64
],
"textfont": "src/font/roboto/RobotoCondensed-Regular.ttf",
"iconfont": "src/font/materialdesignicons-webfont.ttf",
Expand Down
Loading

0 comments on commit 18a76a0

Please sign in to comment.