From 946da5aa853ce2329adb8b26065f9a84934cc60f Mon Sep 17 00:00:00 2001 From: Namophice Date: Sun, 13 Aug 2023 18:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E4=B8=8E=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/TFT_eSPI/User_Setup.h | 32 ++++++++++++++++---------------- small-cube.ino | 28 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/libraries/TFT_eSPI/User_Setup.h b/libraries/TFT_eSPI/User_Setup.h index 46393c2..94effe2 100644 --- a/libraries/TFT_eSPI/User_Setup.h +++ b/libraries/TFT_eSPI/User_Setup.h @@ -9,7 +9,7 @@ // Note that some sketches are designed for a particular TFT pixel width/height // User defined information reported by "Read_User_Setup" test & diagnostics example -// #define USER_SETUP_INFO "User_Setup" +#define USER_SETUP_INFO "User_Setup" // Define to disable all #warnings in library (can be put in User_Setup_Select.h) //#define DISABLE_ALL_LIBRARY_WARNINGS @@ -73,7 +73,7 @@ // For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display // Try ONE option at a time to find the correct colour order for your display -// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red // For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below @@ -83,11 +83,11 @@ // For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation // #define TFT_WIDTH 80 // #define TFT_WIDTH 128 -#define TFT_WIDTH 240 // ST7789 172 x 320 +// #define TFT_WIDTH 240 // ST7789 172 x 320 #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320 // #define TFT_HEIGHT 160 // #define TFT_HEIGHT 128 -// #define TFT_HEIGHT 240 // ST7789 240 x 240 +#define TFT_HEIGHT 240 // ST7789 240 x 240 // #define TFT_HEIGHT 320 // ST7789 240 x 320 // #define TFT_HEIGHT 240 // GC9A01 240 x 240 @@ -203,23 +203,23 @@ // For ESP32 Dev board (only tested with ILI9341 display) // The hardware SPI can be mapped to any pins -#define TFT_MISO 19 -#define TFT_MOSI 23 -#define TFT_SCLK 18 -#define TFT_CS 27 // Chip select control pin -#define TFT_DC 25 // Data Command control pin -#define TFT_RST 26 // Reset pin (could connect to RST pin) +// #define TFT_MISO 19 +// #define TFT_MOSI 23 +// #define TFT_SCLK 18 +// #define TFT_CS 27 // Chip select control pin +// #define TFT_DC 25 // Data Command control pin +// #define TFT_RST 26 // Reset pin (could connect to RST pin) // #define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST // For ESP32 Dev board (only tested with GC9A01 display) // The hardware SPI can be mapped to any pins -//#define TFT_MOSI 15 // In some display driver board, it might be written as "SDA" and so on. -//#define TFT_SCLK 14 -//#define TFT_CS 5 // Chip select control pin -//#define TFT_DC 27 // Data Command control pin -//#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin) -//#define TFT_BL 22 // LED back-light +#define TFT_MOSI 19 // In some display driver board, it might be written as "SDA" and so on. +#define TFT_SCLK 23 +#define TFT_CS 18 // Chip select control pin +#define TFT_DC 27 // Data Command control pin +#define TFT_RST 25 // Reset pin (could connect to Arduino RESET pin) +#define TFT_BL 26 // LED back-light //#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen diff --git a/small-cube.ino b/small-cube.ino index 9296fa8..cb554e9 100644 --- a/small-cube.ino +++ b/small-cube.ino @@ -8,8 +8,8 @@ TFT_eSPI tft = TFT_eSPI(); -const char *ssid = "Xiaomi_6B37_2.4G"; -const char *password = "0123456789qwerdf"; +const char *ssid = "***********"; +const char *password = "*****************"; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, "ntp.aliyun.com"); @@ -21,8 +21,8 @@ void setup() { tft.writedata(0x20); tft.fillScreen(TFT_WHITE); tft.setTextColor(TFT_BLACK, TFT_WHITE); - tft.setTextSize(2); - tft.setCursor(10, 10, 1); + tft.setTextSize(1); + tft.setCursor(25, 25, 1); tft.print("Loading..."); // 休眠2s @@ -75,7 +75,7 @@ void loop() { tft.print(minutes); tft.setTextSize(2); - tft.setCursor(15, 100, 1); + tft.setCursor(15, 95, 1); tft.print(year); tft.print("/"); if (month < 10) { @@ -89,25 +89,25 @@ void loop() { tft.print(monthDay); tft.setTextSize(3); - tft.setCursor(185, 95, 1); + tft.setCursor(185, 90, 1); if (seconds < 10) { tft.print("0"); } tft.print(seconds); - tft.drawLine(0, 135, 240, 135, TFT_WHITE); + tft.drawLine(15, 125, 225, 125, TFT_WHITE); tft.setSwapBytes(true); - tft.pushImage(0, 135, 100, 100, pics[picIndex]); + tft.pushImage(15, 125, 100, 100, pics[picIndex]); picIndex = picIndex + 1; if (picIndex >= 10) { picIndex = 0; } - showCostomChar(130, 140, "猪", TFT_WHITE); - showCostomChar(175, 140, "猪", TFT_WHITE); - showCostomChar(130, 190, "专", TFT_WHITE); - showCostomChar(175, 190, "属", TFT_WHITE); + showCostomChar(125, 130, "猪", TFT_WHITE); + showCostomChar(175, 130, "猪", TFT_WHITE); + showCostomChar(125, 175, "专", TFT_WHITE); + showCostomChar(175, 175, "属", TFT_WHITE); // 休眠1s delay(100); @@ -125,7 +125,7 @@ void wifiConnect() { wifi_wait = wifi_wait + 1; temp = temp + 1; - tft.setCursor(10, 10, 1); + tft.setCursor(25, 25, 1); tft.print("Wifi connecting"); if (wifi_wait == 1) { @@ -140,7 +140,7 @@ void wifiConnect() { } } - tft.setCursor(10, 10, 1); + tft.setCursor(25, 25, 1); tft.println("Wifi connected "); // 休眠2s