KrisKasprzak / FlickerFreePrint

Library to intelligently repaint old text before drawing new--eliminates drawing drafillRect()
17 stars 6 forks source link

FlickerFreePrint TFT_eSPI and ILI9488 TFT panel #6

Closed teeshq closed 1 year ago

teeshq commented 2 years ago

Hi Kris at start im quite noobie with coding and have question to You its possible to implement this library to my code.

`#include

include // Hardware-specific library

TFT_eSPI tft = TFT_eSPI(); // Invoke custom library

define DCSBIOS_DEFAULT_SERIAL

include "DcsBios.h"

define GFXFF 1

define CF_01 &DEDFont16px24pt8b

void setup() {

SPI.begin(); tft.begin(); tft.setRotation(1);

DcsBios::setup(); tft.setFreeFont(CF_01); tft.fillScreen (TFT_BLACK); tft.setTextColor(TFT_GREEN,TFT_BLACK);

}

void loop() { DcsBios::loop(); }

void onDedLine1Change(char* newValue) { tft.drawString (newValue ,50 ,100);

} DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) { tft.drawString (newValue ,50 ,130);

}

DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) { tft.drawString (newValue ,50 ,160);

}

DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) { tft.drawString (newValue ,50 ,190);

}

DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) { tft.drawString (newValue ,50 ,220);

}

DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change); `

its working fine but sometimes when digit change rapidly flickering is very visible

Best Regards Tomasz Szulc

KrisKasprzak commented 2 years ago

My library should work with this display driver.

On Friday, April 22, 2022, 04:59:46 PM CDT, teeshq ***@***.***> wrote:  

Hi Kris at start im quite noobie with coding and have question to You its possible to implement this library to my code. #include

include // Hardware-specific library

TFT_eSPI tft = TFT_eSPI(); // Invoke custom library

define DCSBIOS_DEFAULT_SERIAL

include "DcsBios.h"

define GFXFF 1

define CF_01 &DEDFont16px24pt8b

void setup() {

SPI.begin(); tft.begin(); tft.setRotation(1);

DcsBios::setup(); tft.setFreeFont(CF_01); tft.fillScreen (TFT_BLACK); tft.setTextColor(TFT_GREEN,TFT_BLACK);

}

void loop() { DcsBios::loop(); }

void onDedLine1Change(char* newValue) { tft.drawString (newValue ,50 ,100);

} DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) { tft.drawString (newValue ,50 ,130);

}

DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) { tft.drawString (newValue ,50 ,160);

}

DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) { tft.drawString (newValue ,50 ,190);

}

DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) { tft.drawString (newValue ,50 ,220);

}

DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);`

its working fine but sometimes when digit change rapidly flickering is very visible

Best Regards Tomasz Szulc

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

teeshq commented 2 years ago

HI Kris thanks fon answer like im said im quite noob could You help me example on my code , i have no idea where to start

KrisKasprzak commented 2 years ago

Do you at least have your display working?

On Apr 23, 2022, at 6:36 PM, teeshq @.***> wrote:

 HI Kris thanks fon answer like im said im quite noob could You help me example on my code , i have no idea where to start

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

teeshq commented 2 years ago

Do you at least have your display working? On Apr 23, 2022, at 6:36 PM, teeshq @.***> wrote:  HI Kris thanks fon answer like im said im quite noob could You help me example on my code , i have no idea where to start — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Hi yes this code work here is example of flickering https://www.youtube.com/shorts/oxpwsWdlGpU

Best Regards

teeshq commented 2 years ago

HI Kris here is code https://github.com/teeshq/ufc/blob/main/F16DED.ino but i cant get it to work with tft.drawString if i change it to println its look like is working but println overwrite numbers. Any idea ?

KrisKasprzak commented 2 years ago

This library does not have a method called draw string. It supports floats, ints, bytes, chars, doubles and a few others. Use it like this

in declaration section as you are doingFlickerFreePrint newValue1(&tft, TFT_BLACK,TFT_BLACK);

in loop or where ever // get some datafloat YourData = 3.41159; newValue.setTextColor(TFT_BLACK,TFT_BLACK); // call only if you need to change the text color // set cursor locationtft.setCursor(YourX, YourY); // print newValue.print(YourData);

On Monday, April 25, 2022, 08:49:09 AM CDT, teeshq ***@***.***> wrote:  

HI Kris here is code https://github.com/teeshq/ufc/blob/main/F16DED.ino but i cant get it to work with tft.drawString if i change it to println its look like is working but println overwrite numbers. Any idea ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

KrisKasprzak commented 1 year ago

Defiantly can't pass the flickerfreeprint object into drawString. FlickerFreePrint does the drawing. Implement like this.

include the library

include

create a FlickerFreePaint object for each data to be drawn (put the , pass in your display object and set fore color and back color) FlickerFreePrint Data1(&YOUR DISPLAY OBJECT NAME, 0xFFFF, 0X0000);

Print the data similar to the Print object except call print on the data object Data1.setTextColor(0xFFFF, 0X0000); float j = some data; Data1.print(j, 4);