Skip to content

Commit

Permalink
update T5_4_7Inc_Plus_V2
Browse files Browse the repository at this point in the history
  • Loading branch information
puboy7 committed Mar 4, 2024
1 parent 62dc311 commit f61c078
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align = "center">🌟LilyGo EPD47 🌟</h1>

## **English | [中文](./README_CN.MD)**

- **T5-4.7-ESP32** version is [here](https://github.com/Xinyuan-LilyGO/LilyGo-EPD47)
- The driver and sample program are from [vroland/epdiy](https://github.com/vroland/epdiy)

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion examples/button/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ board = lilygo-t5-47-plus
build_flags = -D CORE_DEBUG_LEVEL=3

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
8 changes: 7 additions & 1 deletion examples/deepsleep/deepsleep.ino
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ void loop()
// esp_sleep_enable_ext0_wakeup((gpio_num_t)BUTTON_1, LOW); //1 = High, 0 = Low

//If you were to use ext1, you would use it like
esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK, ESP_EXT1_WAKEUP_ALL_LOW);
// esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK, ESP_EXT1_WAKEUP_ALL_LOW);
#if defined(T5_47)
// Set to wake up by GPIO39
esp_sleep_enable_ext1_wakeup(GPIO_SEL_39, ESP_EXT1_WAKEUP_ALL_LOW);
#elif defined(T5_47_PLUS) || defined(T5_47_PLUS_V2)
esp_sleep_enable_ext1_wakeup(GPIO_SEL_21, ESP_EXT1_WAKEUP_ALL_LOW);
#endif

//Go to sleep now
Serial.println("Going to sleep now");
Expand Down
2 changes: 1 addition & 1 deletion examples/deepsleep/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build_flags = -D CORE_DEBUG_LEVEL=3
lib_deps = https://github.com/lewisxhe/PCF8563_Library.git

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
94 changes: 69 additions & 25 deletions examples/demo/demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
#if defined(T5_47_PLUS) || defined(T5_47_PLUS_V2)
#include "pcf8563.h"
#include <Wire.h>
#include <TouchDrvGT911.hpp>
#endif

#define TOUCH 1

#if defined(T5_47_PLUS) || defined(T5_47_PLUS_V2)
PCF8563_Class rtc;
TouchDrvGT911 touch;
#endif

int vref = 1100;
int16_t x, y;
int16_t count;

void setup()
{
Expand All @@ -45,42 +50,71 @@ void setup()
} else {
Serial.println("SD init success");
snprintf(buf, 128,
"➸ Detected SdCard insert:%.2f GB",
SD.cardSize() / 1024.0 / 1024.0 / 1024.0
"➸ Detected SdCard insert:%.2f GB",
SD.cardSize() / 1024.0 / 1024.0 / 1024.0
);
}

// Correct the ADC reference voltage
esp_adc_cal_characteristics_t adc_chars;
#if defined(T5_47)
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(
ADC_UNIT_1,
ADC_ATTEN_DB_11,
ADC_WIDTH_BIT_12,
1100,
&adc_chars
);
ADC_UNIT_1,
ADC_ATTEN_DB_11,
ADC_WIDTH_BIT_12,
1100,
&adc_chars
);
#else
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(
ADC_UNIT_2,
ADC_ATTEN_DB_11,
ADC_WIDTH_BIT_12,
1100,
&adc_chars
);
ADC_UNIT_2,
ADC_ATTEN_DB_11,
ADC_WIDTH_BIT_12,
1100,
&adc_chars
);
#endif
if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
Serial.printf("eFuse Vref: %umV\r\n", adc_chars.vref);
vref = adc_chars.vref;
}

epd_init();
const char *string1;
#if defined(T5_47_PLUS) || defined(T5_47_PLUS_V2)
Wire.begin(TOUCH_SDA, TOUCH_SCL);
rtc.begin();
rtc.setDateTime(2022, 6, 30, 0, 0, 0);
#if defined(TOUCH)
uint8_t touchAddress = 0;
Wire.beginTransmission(0x14);
if (Wire.endTransmission() == 0) {
touchAddress = 0x14;
}
Wire.beginTransmission(0x5D);
if (Wire.endTransmission() == 0) {
touchAddress = 0x5D;
}
if (touchAddress == 0) {
Serial.println("Failed to find GT911 - check your wiring!");
delay(1000);
string1 = "➸ Touch status: False \n";
}
touch.setPins(-1, TOUCH_INT);
if (!touch.begin(Wire,touchAddress,TOUCH_SDA, TOUCH_SCL)) {
Serial.println("Failed to find GT911 - check your wiring!");
delay(1000);
string1 = "➸ Touch status: False \n";
}
else
{
string1 = "➸ Touch status: True \n";
}
touch.setMaxCoordinates(EPD_WIDTH, EPD_HEIGHT);
touch.setSwapXY(true);
touch.setMirrorXY(false, true);
#endif
#endif

epd_init();

Rect_t area = {
.x = 230,
Expand All @@ -99,8 +133,9 @@ void setup()
int cursor_x = 200;
int cursor_y = 250;

const char *string1 = "➸ 16 color grayscale 😀 \n";
const char *string2 = "➸ Use with 4.7\" EPDs 😍 \n";
// const char *string1 = "➸ 16 color grayscale 😀 \n";
// const char *string2 = "➸ Use with 4.7\" EPDs 😍 \n";
const char *string2 = "➸ 16 color grayscale 😀 \n";
const char *string3 = "➸ High-quality font rendering ✎🙋";
const char *string4 = "➸ ~630ms for full frame draw 🚀\n";

Expand Down Expand Up @@ -132,14 +167,19 @@ void loop()
{
// When reading the battery voltage, POWER_EN must be turned on
epd_poweron();
delay(10); // Make adc measurement more accurate
// delay(10); // Make adc measurement more accurate
uint16_t v = analogRead(BATT_PIN);
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
String voltage = "➸ Voltage: " + String(battery_voltage) + "V";
#if defined(T5_47_PLUS) || defined(T5_47_PLUS_V2)
voltage = voltage + String(" (") + rtc.formatDateTime(PCF_TIMEFORMAT_YYYY_MM_DD_H_M_S) + String(")");
#if defined(TOUCH)
uint8_t touched = touch.getPoint(&x, &y);
if (touched) {
Serial.printf("X:%d Y:%d\n", x, y);
}
#endif
#endif
Serial.println(voltage);

Rect_t area = {
.x = 200,
Expand All @@ -154,9 +194,13 @@ void loop()

int cursor_x = 200;
int cursor_y = 500;
epd_clear_area(area);
writeln((GFXfont *)&FiraSans, (char *)voltage.c_str(), &cursor_x, &cursor_y, NULL);


if (count %2000 == 0)
{
Serial.println(voltage);
epd_clear_area(area);
writeln((GFXfont *)&FiraSans, (char *)voltage.c_str(), &cursor_x, &cursor_y, NULL);
}

/**
* There are two ways to close
Expand All @@ -170,6 +214,6 @@ void loop()
* POWER_EN control and also turn off the blue LED light
*/
epd_poweroff_all();

delay(5000);
count++;
// delay(5000);
}
20 changes: 12 additions & 8 deletions examples/demo/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,29 @@ default_envs = T5_4_7Inc_Plus_V2
platform = [email protected]
upload_protocol = esptool
framework = arduino

upload_speed = 921600
monitor_speed = 115200
lib_deps = Wire
lewisxhe/[email protected]

[env:T5_4_7Inc]
board = lilygo-t5-47
build_flags = -D CORE_DEBUG_LEVEL=3


[env:T5_4_7Inc_Plus]
board = lilygo-t5-47-plus

build_flags = -D CORE_DEBUG_LEVEL=3
lib_deps = https://github.com/lewisxhe/PCF8563_Library.git
lib_deps =
https://github.com/lewisxhe/PCF8563_Library.git


[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
-DARDUINO_USB_CDC_ON_BOOT
lib_deps = https://github.com/lewisxhe/PCF8563_Library.git
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
-DARDUINO_USB_CDC_ON_BOOT
lib_deps =
https://github.com/lewisxhe/PCF8563_Library.git
lewisxhe/[email protected]
2 changes: 1 addition & 1 deletion examples/drawExample/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build_flags = -D CORE_DEBUG_LEVEL=3
-DARDUINO_USB_CDC_ON_BOOT=1

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
2 changes: 1 addition & 1 deletion examples/drawImages/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ board = lilygo-t5-47-plus
build_flags = -D CORE_DEBUG_LEVEL=3

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
2 changes: 1 addition & 1 deletion examples/grayscale_test/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build_flags = -D CORE_DEBUG_LEVEL=3


[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
2 changes: 1 addition & 1 deletion examples/screen_repair/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ board = lilygo-t5-47-plus
build_flags = -D CORE_DEBUG_LEVEL=3

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
2 changes: 1 addition & 1 deletion examples/spi_driver/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ board = lilygo-t5-47-plus
build_flags = -D CORE_DEBUG_LEVEL=3

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
Expand Down
3 changes: 1 addition & 2 deletions examples/touch_test_new/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ build_flags = -D CORE_DEBUG_LEVEL=3
; -DARDUINO_USB_CDC_ON_BOOT=1

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus
board = lilygo-t5-47-plus-v2
build_flags =
-DCORE_DEBUG_LEVEL=3
-DT5_47_PLUS_V2=1
-DARDUINO_USB_CDC_ON_BOOT

extra_scripts = ./script/pos_extra_script.py
3 changes: 1 addition & 2 deletions examples/wifi_sync/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ board_build.filesystem = fatfs
board_build.partitions = partitions_custom.csv

[env:T5_4_7Inc_Plus_V2]
board = lilygo-t5-47-plus

board = lilygo-t5-47-plus-v2
build_flags =
-D CORE_DEBUG_LEVEL=5
-D ARDUINO_USB_CDC_ON_BOOT=1
Expand Down
2 changes: 1 addition & 1 deletion firmware/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. `T5-4.7-plus_no_touch_firmware.bin` T5-4.7 ESP32S3 no touch Test
2. `T5-4.7-plus_touch_firmware.bin` T5-4.7 ESP32S3 with touch Test
3. `T5-4.7_firmware.bin` T5-4.7 ESP32 Test firmware

4. `T5-4.7-plus_GT911_firmware.bin` T5-4.7 ESP32 GT911 Test firmware
# 2. Tools Dowload

- [Flash_download_tool](https://www.espressif.com.cn/sites/default/files/tools/flash_download_tool_3.9.5_0.zip)
Expand Down
Binary file added firmware/T5-4.7-plus_GT911_0304_firmware.bin
Binary file not shown.
48 changes: 48 additions & 0 deletions platformio/boards/lilygo-t5-47-plus-v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"memory_type": "qio_opi",
"partitions": "default_16MB.csv"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_RUNNING_CORE=0",
"-DARDUINO_EVENT_RUNNING_CORE=0",
"-DARDUINO_USB_MODE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0X303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi",
"bluetooth"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "LILYGO T5-4.7 Plus V2",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.aliexpress.us/item/3256804461011991.html",
"vendor": "LILYGO"
}

0 comments on commit f61c078

Please sign in to comment.