Here is my UTFT version with optimizations speed of execution and ROM space used.BE CAREFUL : It's work only with SSD1289 screen on Arduino Mega.
Screen : SainSmart 3.2" TFT LCD Display+Touch Panel+PCB adapter SD Slot for Arduino 2560,
Shield : SainSmart TFT LCD Adjustable Shield for Arduino Mega 2560 R3 1280 A082 Plug.
To optimize I examined the most frequently used functions.
drawPixel calls SetXY, SetXY makes a test on the target screen and calls LCD_Write_COM, it calls LCD_Write_COM and LCD_Write_DATA, they test the type of transfer and call LCD_Writ_Bus. LCD_Writ_Bus tests the type of target screen and then writes the data to the destination ports of the screen !!!
LCDxxx methods are called very often then it is they need to optimize.
I remove the tests "switch (mode)" or "if (display_transfer_mode! = 1)", which become useless if I still have the same screen.
I'm simplifying and removing cascades calls are expensive (passing parameters to the stack, context switching, etc.).
In the zip archive, I put a new example : Bench.ino (use this one to test)
, I removed some tools.
I also made a mode "x terminal" which sending display information to the serial port.
I wrote a program (in C #) that runs on the PC, he receives display information and draws on the PC screen: this is a simulator screen.
I left this feature in the code archive. It is off by a compiler directive (so this code is disabled).
void UTFT::drawPixel(int x, int y)
//don't worry about this code. this code is not compiled (Terminal_x not defined)
//0x81 [ID], [size], [datas]
Trame = 0x81; //ID de Terminal X
Trame = sizeof(Trame)-1; //taille de la sous-trame (à partir de cet endroit, on compte la size mais pas l'ID termX
Trame = TX_DRAWPIXEL; //ID ordre d'aff pixel
Trame = x >> 8; //MSB x1
Trame = x; //LSB x1
Trame = y >> 8;
Trame = y;
If anyone is interested, I can share my C # program...
I preferred share code in the current state, because if I take the time to clean it before, it will never be perfect and finally I will send nothing
Finally, Perhaps the best is make a depot GIT.
I hope that pYro_65 will could give us his optimizations or ideas for a common version. (Sorry if I speak bad English, I took lessons )
hello Mael, I am using your optimized library and I congratulate you because it's really fast.
But I have a problem, with the original UTFT I used also libraries UTFT_tinyFAT and UTFT_Geometry while your library can not use them, it gives me an error. You probably need to be changed.
Can you help me somehow?
Or is there someone else who can help me?
Excuse me for my LITTLE English