myFiles.load(x coordinate, y coordinate, image-x-size, image-y-size, fname[, buffer-size-multiplier, invert colour]);
x coordinate, y coordinate = screen coordinates
image-x-size, image-y-size = size of image
fname = image filename
buffer-size-multiplier = 1 by default (buffer = image-x-sizebuffer-size-multiplier2) (try 2, 4, 6, 8 )
invert colour = 0 by default (try 1 if colour wrong)
You have downloaded UTFT_SdRaw?
All I can suggest if you think colour is not as it should be, is change invert colour to 1.
Regards,
Graham
Edit: Download and rename SK400500.raw.txt to SK400500.raw put it on your sd-card not in a folder. Run that sketch.
Be aware that SK400500.raw is already inverted colour compared to the output from Henning's converter! This should CLEARLY demonstrate the buffer and invert colour features.
#include <SPI.h>
// SdFat lib from here :-
// https://github.com/greiman/SdFat/archive/master.zip
#include <SdFat.h>
#include <SdStream.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
#define SD_CHIP_SELECT 53 // SD chip select pin
// file system object
SdFat sd;
// print stream
ArduinoOutStream cout(Serial);
UTFT myGLCD(CTE70, 38, 39, 40, 41);
UTFT_SdRaw myFiles(&myGLCD);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println(F("Initialising SD card..."));
bool mysd = 0;
// see if the card is present and can be initialized:
while (!mysd)
{
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
Serial.println(F("Card failed, or not present"));
Serial.println(F("Retrying...."));
}
else
{
mysd = 1;
Serial.println(F("Card initialised."));
}
}
Serial.println(F("Initialising LCD."));
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);
Serial.println(F("LCD initialised."));
char fname240[] = "SK400500.RAW";
myGLCD.clrScr();
long mytime = millis();
myFiles.load(0, 0, 240, 240, fname240);
long mytime1 = millis() - mytime;
cout << F("Time to draw 240x240 raw (no extra buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
delay(5000);
myGLCD.clrScr();
mytime = millis();
myFiles.load(0, 0, 240, 240, fname240, 1, 0); // <== default bufmult and inv-colour
mytime1 = millis() - mytime;
cout << F("Time to draw 240x240 raw (no extra buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
delay(5000);
myGLCD.clrScr();
mytime = millis();
myFiles.load(0, 0, 240, 240, fname240, 1, 1); // <== default bufmult
mytime1 = millis() - mytime;
cout << F("Time to draw 240x240 raw (no extra buffer) (inverted colour) ") << mytime1 << F(" ms") << endl;
delay(5000);
mytime = millis();
myFiles.load(0, 0, 240, 240, fname240, 8, 1);
mytime1 = millis() - mytime;
cout << F("Time to draw 240x240 raw (8*buffer) (inverted colour) ") << mytime1 << F(" ms") << endl;
delay(5000);
cout << F("Thanks for watching!") << endl;
myGLCD.clrScr();
myGLCD.setFont(BigFont);
myGLCD.setColor(VGA_GREEN);
myGLCD.print("Thanks for watching!", CENTER, 111);
}
void loop()
{
}
SK400500.raw.txt (113 KB)