This commit is contained in:
topicchi
2024-09-24 16:54:39 +00:00
parent e3ca99e4db
commit c7a68c0205
332 changed files with 6098 additions and 4139 deletions

View File

@@ -36,7 +36,7 @@ void setup() {
tft.begin();
if (!SD.begin()) {
if (!SD.begin(5, tft.getSPIinstance())) {
Serial.println("Card Mount Failed");
return;
}
@@ -249,7 +249,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.

View File

@@ -120,7 +120,7 @@ void setup(void) {
// EYE-RENDERING FUNCTION --------------------------------------------------
#define BUFFER_SIZE 256 // 64 to 512 seems optimum = 30 fps for default eye
void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
// Use native 32 bit variables where possible as this is 10% faster!
// Use native 32-bit variables where possible as this is 10% faster!
uint8_t e, // Eye array index; 0 or 1 for left/right
uint32_t iScale, // Scale factor for iris
uint32_t scleraX, // First pixel X offset into sclera image
@@ -134,7 +134,7 @@ void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
uint32_t d;
uint32_t pixels = 0;
uint16_t pbuffer[BUFFER_SIZE]; // This one needs to be 16 bit
uint16_t pbuffer[BUFFER_SIZE]; // This one needs to be 16-bit
// Set up raw pixel dump to entire screen. Although such writes can wrap
// around automatically from end of rect back to beginning, the region is

View File

@@ -58,7 +58,7 @@ void screenshotToConsole()
// Get first pixel to prime the Run Length Encoded
// Function format is: tft.readRectRGB( x, y, width, height, buffer);
// color is a pointer to a buffer that the RGB 8 bit values are piped into
// color is a pointer to a buffer that the RGB 8-bit values are piped into
// the buffer size must be >= (width * height * 3) bytes
eye[e].tft.readRectRGB(0, 0, 1, 1, color); // 1 x 1 so reading 1 pixel at 0,0

View File

@@ -73,7 +73,7 @@ void loop() {
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
// Get current touch state and coordinates
boolean pressed = tft.getTouch(&t_x, &t_y);
bool pressed = tft.getTouch(&t_x, &t_y);
// Adjust press state of each key appropriately
for (uint8_t b = 0; b < NUM_KEYS; b++) {
@@ -133,7 +133,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();
}

View File

@@ -1,4 +1,4 @@
// Icon images are stored in tabs ^ e.g. Alert.h etc above this line
// Icon images are stored in tabs ^ e.g. Alert.h etc.above this line
// more than one icon can be in a header file
// Arrays containing FLASH images can be created with UTFT library tool:

View File

@@ -46,7 +46,7 @@ void drawBmp(const char *filename, int16_t x, int16_t y) {
bmpFS.read(lineBuffer, sizeof(lineBuffer));
uint8_t* bptr = lineBuffer;
uint16_t* tptr = (uint16_t*)lineBuffer;
// Convert 24 to 16 bit colours
// Convert 24 to 16-bit colours
for (uint16_t col = 0; col < w; col++)
{
b = *bptr++;

View File

@@ -63,7 +63,7 @@ int max_allowed = 1000; // Maximum number of save images allowed before a resta
// These are default values, this sketch obtains the actual values from the Arduino board
int tft_width = 480; // default TFT width (automatic - sent by Arduino)
int tft_height = 480; // default TFT height (automatic - sent by Arduino)
int color_bytes = 2; // 2 for 16 bit, 3 for three RGB bytes (automatic - sent by Arduino)
int color_bytes = 2; // 2 for 16-bit, 3 for three RGB bytes (automatic - sent by Arduino)
import processing.serial.*;

View File

@@ -2,8 +2,8 @@
// over the serial port. Use a high baud rate, e.g. for an ESP8266:
// Serial.begin(921600);
// At 921600 baud a 320 x 240 image with 16 bit colour transfers can be sent to the
// PC client in ~1.67s and 24 bit colour in ~2.5s which is close to the theoretical
// At 921600 baud a 320 x 240 image with 16-bit colour transfers can be sent to the
// PC client in ~1.67s and 24-bit colour in ~2.5s which is close to the theoretical
// minimum transfer time.
// This sketch has been created to work with the TFT_eSPI library here:
@@ -40,7 +40,7 @@
// Number of pixels to send in a burst (minimum of 1), no benefit above 8
// NPIXELS values and render times:
// NPIXELS 1 = use readPixel() = >5s and 16 bit pixels only
// NPIXELS 1 = use readPixel() = >5s and 16-bit pixels only
// NPIXELS >1 using rectRead() 2 = 1.75s, 4 = 1.68s, 8 = 1.67s
#define NPIXELS 8 // Must be integer division of both TFT width and TFT height
@@ -104,7 +104,7 @@ bool serialScreenServer(String filename)
wait = false; // No need to wait anymore
lastCmdTime = millis(); // Set last received command time
// Send screen size etc using a simple header with delimiters for client checks
// Send screen size etc.using a simple header with delimiters for client checks
sendParameters(filename);
}
}
@@ -169,7 +169,7 @@ bool serialScreenServer(String filename)
}
//====================================================================================
// Send screen size etc using a simple header with delimiters for client checks
// Send screen size etc.using a simple header with delimiters for client checks
//====================================================================================
void sendParameters(String filename)
{
@@ -183,7 +183,7 @@ void sendParameters(String filename)
Serial.write('Y'); // Bits per pixel (16 or 24)
if (NPIXELS > 1) Serial.write(BITS_PER_PIXEL);
else Serial.write(16); // readPixel() only provides 16 bit values
else Serial.write(16); // readPixel() only provides 16-bit values
Serial.write('?'); // Filename next
Serial.print(filename);

View File

@@ -1,12 +1,12 @@
/*
This tests the alpha blending function that is used with the antialiased
This tests the alpha blending function that is used with the anti-aliased
fonts:
Alpha = 0 = 100% background, alpha = 255 = 100% foreground colour
blendedColor = tft.alphaBlend(alpha, fg_color, bg_color);
The alphaBlend() function operates on 16 bit colours only
The alphaBlend() function operates on 16-bit colours only
A test is included where the colours are mapped to 8 bits after blending
Information on alpha blending is here
@@ -43,7 +43,7 @@ void setup(void) {
// -------------------------------------------------------------------------
void loop()
{
// 16 bit colours (5 bits red, 6 bits green, 5 bits blue)
// 16-bit colours (5 bits red, 6 bits green, 5 bits blue)
// Blend from white to full spectrum
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
{
@@ -79,18 +79,18 @@ void loop()
delay(4000);
//*
// Decrease to 8 bit colour (3 bits red, 3 bits green, 2 bits blue)
// Decrease to 8-bit colour (3 bits red, 3 bits green, 2 bits blue)
// Blend from white to full spectrum
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
{
// Convert blended 16 bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
// Convert blended 16-bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
for (int c = 0; c < 192; c++) tft.drawPixel(c, a/2, tft.color8to16(tft.color16to8(tft.alphaBlend(a, rainbow(c), 0xFFFF))));
}
// Blend from full spectrum to black
for (int a = 255; a > 2; a-=2)
{
// Convert blended 16 bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
// Convert blended 16-bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
for (int c = 0; c < 192; c++) tft.drawPixel(c, 128 + (255-a)/2, tft.color8to16(tft.color16to8(tft.alphaBlend(a, rainbow(c), 0))));
}
@@ -108,7 +108,7 @@ void loop()
//*/
/*
// 16 bit colours (5 bits red, 6 bits green, 5 bits blue)
// 16-bit colours (5 bits red, 6 bits green, 5 bits blue)
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
{
for (int c = 0; c < 192; c++) tft.drawPixel(c, a/2, tft.alphaBlend(a, rainbow(c), TFT_CYAN));
@@ -137,7 +137,7 @@ void loop()
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{
@@ -147,7 +147,7 @@ unsigned int rainbow(byte value)
value = value%192;
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, but only top 5 bits used here
byte blue = 0; // Blue is the bottom 5 bits