Update TFT_eSPI to v2.5.43

This commit is contained in:
lewisxhe
2024-12-20 10:30:59 +08:00
parent 7f7f0022fe
commit 7abc5fb795
215 changed files with 3400 additions and 1114 deletions
@@ -249,7 +249,7 @@ void drawDatum(int x, int y)
// There follows a crude way of flagging that this example sketch needs fonts which
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
// have not been enabled in the User_Setup.h file inside the TFT_HX8357 library.
//
// These lines produce errors during compile time if settings in User_Setup are not correct
//
@@ -3,8 +3,8 @@
button handling class, this sketch is based on the Arduin-o-phone
example.
This example diplays a keypad where numbers can be entered and
send to the Serial Monitor window.
This example displays a keypad where numbers can be entered and
sent to the Serial Monitor window.
The sketch has been tested on the ESP8266 (which supports SPIFFS)
@@ -167,7 +167,7 @@ void loop(void) {
// Update the number display field
tft.setTextDatum(TL_DATUM); // Use top left corner as text coord datum
tft.setFreeFont(&FreeSans18pt7b); // Choose a nicefont that fits box
tft.setFreeFont(&FreeSans18pt7b); // Choose a nice font that fits box
tft.setTextColor(DISP_TCOLOR); // Set the font colour
// Draw the string, the value returned is the width in pixels
@@ -212,7 +212,7 @@ void touch_calibrate()
// check file system exists
if (!SPIFFS.begin()) {
Serial.println("Formating file system");
Serial.println("formatting file system");
SPIFFS.format();
SPIFFS.begin();
}
@@ -49,7 +49,7 @@ void setup(void) {
void loop() {
if (updateTime <= millis()) {
updateTime = millis() + 35; // Update emter every 35 milliseconds
updateTime = millis() + 35; // Update meter every 35 milliseconds
// Create a Sine wave for testing
d += 4; if (d >= 360) d = 0;
@@ -77,7 +77,7 @@ void analogMeter()
// Long scale tick length
int tl = 15;
// Coodinates of tick to draw
// Coordinates of tick to draw
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;
@@ -177,7 +177,7 @@ void plotNeedle(int value, byte ms_delay)
if (ms_delay == 0) old_analog = value; // Update immediately if delay is 0
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
// Calcualte tip of needle coords
// Calculate tip of needle coords
float sx = cos(sdeg * 0.0174532925);
float sy = sin(sdeg * 0.0174532925);
@@ -97,7 +97,7 @@ void analogMeter()
// Long scale tick length
int tl = 15;
// Coodinates of tick to draw
// Coordinates of tick to draw
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (100 + tl) + 120;
@@ -197,7 +197,7 @@ void plotNeedle(int value, byte ms_delay)
if (ms_delay == 0) old_analog = value; // Update immediately id delay is 0
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
// Calcualte tip of needle coords
// Calculate tip of needle coords
float sx = cos(sdeg * 0.0174532925);
float sy = sin(sdeg * 0.0174532925);
@@ -1,5 +1,5 @@
/*
Test the tft.print() viz the libraries embedded write() function
Test the tft.print() viz. the libraries embedded write() function
This sketch used font 2, 4, 7
@@ -50,7 +50,7 @@ void loop() {
// The new larger fonts do not need to use the .setCursor call, coords are embedded
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
tft.drawCentreString("Font size 2", 160, 14, 2); // Draw text centre at position 120, 14 using font 2
tft.drawCentreString("Font size 4", 160, 30, 4); // Draw text centre at position 120, 30 using font 4
tft.drawCentreString("12.34", 160, 54, 6); // Draw text centre at position 120, 54 using font 6
@@ -100,7 +100,7 @@ void loop() {
// Fill screen with a rainbow pattern
void rainbow_fill()
{
// The colours and state are not initialised so the start colour changes each time the funtion is called
// The colours and state are not initialised so the start colour changes each time the function is called
for (int i = 479; i > 0; i--) {
// Draw a vertical line 1 pixel wide in the selected colour
@@ -1,8 +1,8 @@
// Sketch to display images on a 480 x 320 ILI9486 Raspberry Pi 3.5" TFT (Waveshare design)
// which has a 16 bit serial interface based on 74HC04, 74HC4040 and 2 x 74HC4094 logic chips
// which has a 16-bit serial interface based on 74HC04, 74HC4040 and 2 x 74HC4094 logic chips
// Renders images stored in an array in program (FLASH)JPEG images are stored in header files
// (see jpeg1.h etc)
// (see jpeg1.h etc.)
// The sketch does not need the SD or sdFat libraries since it does not access an SD Card.
@@ -108,7 +108,7 @@ void drawArrayJpeg(const uint8_t arrayname[], uint32_t array_size, int xpos, int
// fit totally on the screen are cropped to the nearest MCU size and may leave right/bottom borders.
void renderJPEG(int xpos, int ypos) {
// retrieve infomration about the image
// retrieve information about the image
uint16_t *pImg;
uint16_t mcu_w = JpegDec.MCUWidth;
uint16_t mcu_h = JpegDec.MCUHeight;
@@ -222,7 +222,7 @@ void jpegInfo() {
// Show the execution time (optional)
//####################################################################################################
// WARNING: for UNO/AVR legacy reasons printing text to the screen with the Mega might not work for
// sketch sizes greater than ~70KBytes because 16 bit address pointers are used in some libraries.
// sketch sizes greater than ~70KBytes because 16-bit address pointers are used in some libraries.
// The Due will work fine with the HX8357_Due library.
@@ -13,7 +13,7 @@
#define GREEN2RED 4
#define RED2GREEN 5
#define TFT_GREY 0x2104 // Dark grey 16 bit colour
#define TFT_GREY 0x2104 // Dark grey 16-bit colour
#include "Alert.h" // Out of range alert icon
@@ -127,8 +127,8 @@ int ringMeter(int value, int vmin, int vmax, int x, int y, int r, const char *un
case 1: colour = TFT_GREEN; break; // Fixed colour
case 2: colour = TFT_BLUE; break; // Fixed colour
case 3: colour = rainbow(map(i, -angle, angle, 0, 127)); break; // Full spectrum blue to red
case 4: colour = rainbow(map(i, -angle, angle, 70, 127)); break; // Green to red (high temperature etc)
case 5: colour = rainbow(map(i, -angle, angle, 127, 63)); break; // Red to green (low battery etc)
case 4: colour = rainbow(map(i, -angle, angle, 70, 127)); break; // Green to red (high temperature etc.)
case 5: colour = rainbow(map(i, -angle, angle, 127, 63)); break; // Red to green (low battery etc.)
default: colour = TFT_BLUE; break; // Fixed colour
}
tft.fillTriangle(x0, y0, x1, y1, x2, y2, colour);
@@ -193,14 +193,14 @@ void drawAlert(int x, int y , int side, bool draw)
}
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{
// Value is expected to be in range 0-127
// The value is converted to a spectrum colour from 0 = blue through to 127 = red
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
@@ -23,7 +23,7 @@ void setup(void) {
// check file system
if (!SPIFFS.begin()) {
Serial.println("formating file system");
Serial.println("formatting file system");
SPIFFS.format();
SPIFFS.begin();