Is there a way that I can make images that are read off of a SD card load faster? My code is below. This is not the complete code but enough to load a boot logo then a single screen.
// VERSION: 1.0
// - initial version
// - //////////////////////////// BEGIN GLOBAL VARIABLES ///////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
#include <Wire.h> // needed by tons of stuff
#include <EEPROM.h> // used to store and retrieve settings from memory
#include <UTFT.h> // used to interface with the TFT display
#include <UTouch.h> // used to interface with the touch controller on the TFT display
#include <tinyFAT.h> // used to access the SD card
#include <UTFT_tinyFAT.h> // used to read .raw images from the SD card
#include <RTClib.h>
#include <Time.h> // allows conversion to UNIX time for easier date/time math
#include <TimeAlarms.h> // used to power schedules
#include <OneWire.h> // network library to communicate with the DallasTemperature sensor,
#include <DallasTemperature.h> // library for the Temp sensor itself
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t Sinclair_S[];
extern uint8_t arial_bold[];
extern uint8_t Ubuntubold[];
// Pins for temperature sensor
#define ONE_WIRE_BUS_W 47 //water sensor on pin 47
// for time
RTC_DS1307 RTC;
// for time calcuation, we need to know the current time zone offset
//int UTC_Offset=-5;
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWireW(ONE_WIRE_BUS_W);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensorW(&oneWireW); //water sensor
UTFT myGLCD(CTE50,38,39,40,41); // start up an instance of the TFT screen
UTouch myTouch(6, 5, 4, 3, 2); // start up an instance of for touch
UTFT_tinyFAT myFiles(&myGLCD); // start up an instance to read images from the SD card
// days and month character strings for displaing at the top of the screen
char *Day[] = {
"","Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
char *Mon[] = {
"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
int x, y; //touch coordinates
// - //////////////////////////// END GLOBAL VARIABLES /////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - //////////////////////////// VOID SETUP CODE BELOW ////////////////////////////////////////
void setup()
{
// initiate the screen and touch
myGLCD.InitLCD(0);
myGLCD.setFont(SmallFont);
myTouch.InitTouch(LANDSCAPE);
myTouch.setPrecision(PREC_MEDIUM);
// init SD card
file.setSSpin(53);
file.initFAT(SPISPEED_VERYHIGH);
delay(250);
Serial.begin(9600);
// clear the screen
myGLCD.clrScr();
// boot up logo
myFiles.loadBitmap(230, 40, 378, 268, "Logo.raw");
myFiles.loadBitmap(340, 360, 149, 47, "Copy.raw");
delay(6000);
myGLCD.clrScr();
// Home Screen
myGLCD.setFont(arial_bold);
myGLCD.setColor(51, 204, 51);
myGLCD.print("Management System", 150, 15);
myFiles.loadBitmap(50, 5, 103, 77, "Froggy.raw");
// Outer lines
myGLCD.drawLine(40, 60, 53, 60); //Top Header -hand
myGLCD.drawLine(79, 60, 121, 60); //Top Header -hand
myGLCD.drawLine(147, 60, 760, 60); //Top Header -hand
myGLCD.drawLine(40, 440, 760, 440); //Bottom Footer
myGLCD.drawLine(40, 60, 40, 440); //Left Side
myGLCD.drawLine(760, 440, 760, 60); //Right Side
myGLCD.drawLine(390, 60, 390, 440); //Down Middle
myGLCD.drawLine(390, 235, 760, 235); //Middle Across
myGLCD.drawLine(390, 335, 760, 335); //Temp Section across
myGLCD.drawLine(510, 235, 510, 335); //Temp down 1
myGLCD.drawLine(635, 235, 635, 335); //Temp down 2
// Touch Icons Row 1
myFiles.loadBitmap(55, 90, 99, 135, "Lights.raw");
myFiles.loadBitmap(154, 90, 102, 135, "Temp.raw");
myFiles.loadBitmap(256, 90, 125, 135, "Humidity.raw");
// Touch Icons Row 2
myFiles.loadBitmap(45, 260, 129, 131, "Misting.raw");
myFiles.loadBitmap(174, 260, 88, 131, "Fan.raw");
myFiles.loadBitmap(262, 260, 122, 131, "Settings.raw");
// Viv logo
myFiles.loadBitmap(400, 70, 360, 156, "Vivlogo.raw");
// Temp
myFiles.loadBitmap(408, 245, 88, 23, "Templeft.raw");
myFiles.loadBitmap(524, 245, 103, 23, "Tempmid.raw");
myFiles.loadBitmap(653, 245, 96, 23, "Temprt.raw");
myFiles.loadBitmap(400, 360, 147, 54, "Hum.raw");
//myFiles.setFont(Ubuntubold.c);
//myGLCD.setColor(255, 255, 255);
//myGLCD.print("Right", 620, 245);
}
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - ///////////////////////////// VOID LOOP CODE BELOW ////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
}