Hi all.
I am using TFT_eSPI.h to tft.drawRect and tft.print data in it of total 3, the basic code below need help to optimization.
Thanks
Adam
void addSthEncoder() {
int32_t xadd, yadd, wadd, hadd;
xadd = 2;
yadd = 2;
wadd = 50;
hadd = 20;
tft.drawRect( xadd, yadd, wadd, hadd, TFT_WHITE);
tft.fillRect( xadd, yadd, wadd, hadd, TFT_WHITE);
// using a float and the right decimal places:
String stringOne = "POS";
tft.setCursor(xadd + 2, yadd + 2);
tft.setTextSize(2);
tft.setTextColor(TFT_BLACK);
tft.print(stringOne);
xadd = xadd + wadd + 2;
yadd = yadd;
wadd = 30;
hadd = 20;
tft.drawRect( xadd, yadd, wadd, hadd, TFT_WHITE);
tft.fillRect( xadd, yadd, wadd, hadd, TFT_WHITE);
stringOne = "15";
tft.setCursor(xadd + 2, yadd + 2);
tft.setTextSize(2);
tft.setTextColor(TFT_BLACK);
tft.print(stringOne);
xadd = xadd + wadd + 2;
yadd = yadd;
wadd = 80;
hadd = 20;
tft.drawRect( xadd, yadd, wadd, hadd, TFT_WHITE);
tft.fillRect( xadd, yadd, wadd, hadd, TFT_WHITE);
stringOne = "RADIO";
tft.setCursor(xadd + 2, yadd + 2);
tft.setTextSize(2);
tft.setTextColor(TFT_RED);
tft.print(stringOne);
}