I was doing like you say, but i stop on that problem,
i cant solve it alone, thats why i asking for a help.
Third part of code:
// below are the misc screens
switch (menunumber)
{
case 0:
cons1:
if(inst_disp == true) displaychange = false, inst_disp = false, digitLPG = 0, pos = 0;
tft.setTextColor(ST7735_BLUE, ST7735_BLACK);
tft.drawBitmap(20, 20, petrolstationpump, 32, 32, ST7735_BLUE);
tft.setCursor(60, 30);
tft.setTextSize(1);
tft.print(F("LPG"));
tft.setCursor(60,42);
tft.setTextSize(1);
if (speed > 2) tft.print(F("l/100km"));
else tft.print(F("l/h")); //when the car is stopped displays the instant consumption in l/h
tft.setCursor(20,56);
tft.setTextSize(4);
if(instant_LPG_consumption > 99.9) tft.print(F("--.-"));
else tft.print(instant_LPG_consumption,1);
break;
case 1:
tft.setTextColor(ST7735_WHITE , ST7735_BLACK);
tft.drawBitmap(20, 30, averagecons, 64, 32, ST7735_WHITE);
tft.setCursor(54, 10);
tft.setTextSize(1);
tft.print(F("LPG"));
tft.setCursor(74,35);
tft.setTextSize(1);
tft.print(F("L/100"));
tft.setCursor(20, 66);
tft.setTextSize(4);
if(isnan(avg_LPG_consumption)|| isinf(avg_LPG_consumption)) tft.println(F("---"));
//else tft.println(avg_LPG_consumption, 1);
break;
case 2:
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.drawBitmap(49, 25, speedometer, 32, 32, ST7735_WHITE);
tft.setCursor(40,56);
tft.setTextSize(4);
tft.print(speed, 0);
tft.setCursor(78, 54);
tft.setTextSize(2);
tft.print(F("km"));
tft.setCursor(104, 60);
tft.setTextSize(3);
tft.print(F("/"));
tft.setCursor(115, 72);
tft.setTextSize(2);
tft.print(F("h"));
break;
case 3:
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.drawBitmap(31, 25, avspeed, 64, 32, ST7735_WHITE);
tft.setCursor(10, 56);
tft.setTextSize(4);
tft.print(avg_speed, 0);
tft.setCursor(94, 54);
tft.setTextSize(2);
tft.print(F("km"));
tft.setCursor(118, 57);
tft.setTextSize(3);
tft.print(F("/"));
tft.setCursor(130, 68);
tft.setTextSize(2);
tft.print(F("h"));
break;
case 4:
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.drawBitmap(48, 20, dist, 32, 32, ST7735_GREEN);
tft.setCursor(88,38);
tft.setTextSize(2);
tft.print(F("km"));
tft.setCursor(30, 56);
tft.setTextSize(4);
tft.print(traveled_distance, 1);
break;
case 5:
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.drawBitmap(20, 25, dist_to_LPG, 128, 32, ST7735_WHITE);
tft.setCursor(20, 56);
tft.setTextSize(4);
if(distance_to_LPGstation < 10 || isnan(distance_to_LPGstation) || isinf(distance_to_LPGstation) ) tft.println(F("---"));
else tft.print(distance_to_LPGstation,0);
tft.setTextSize(2);
tft.setCursor(110,68);
tft.print(F("km"));
break;
case 6:
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.drawBitmap(30, 30, leaf, 32, 32, ST7735_WHITE);
tft.setCursor(70, 32);
tft.setTextSize(1);
tft.print(F("Total"));
tft.setCursor(70, 42);
tft.setTextSize(2);
tft.print(F("LPG"));
tft.setCursor(30, 66);
tft.setTextSize(3);
tft.print(used_LPG,1);
tft.print(F("l"));
break;
case 7:
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.drawBitmap(51, 30, FuelTank, 64, 32, ST7735_WHITE);
tft.setCursor(30, 66);
tft.setTextSize(3);
if (LPG_in_tank <= 0 ) tft.print(F("0.0"));
else tft.print(LPG_in_tank,1);
tft.setTextSize(3);
tft.setCursor(125,63);
tft.print(F("l"));
break;
case 8:
temp1: if(inst_disp == true) displaychange = false, inst_disp = false;
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
printTemperature();
tft.drawFastHLine(0, 48, 168, ST7735_WHITE);
tft.drawFastHLine(0, 49, 168, ST7735_WHITE);
tft.setCursor(30, 56);
tft.setTextSize(3);
printTime();
if(sensors.getTempCByIndex(0) < 3.5)
{
tft.drawBitmap(0, 3, snowflake, 16, 16, ST7735_WHITE);
}
break;
case 9:
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.drawBitmap(20, 38, average, 16, 16, ST7735_GREEN);
tft.drawBitmap(37, 30, Unleaded_fill_nozzle, 32, 32, ST7735_GREEN);
tft.setCursor(84,33);
tft.setTextSize(2);
tft.println(F("l/100"));
tft.setCursor(20, 56);
tft.setTextSize(4);
if(isnan(average_L_100km_Unlead)|| isinf(average_L_100km_Unlead)) tft.println(F("---"));
else tft.println(average_L_100km_Unlead, 1);
break;
case 10:
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.drawBitmap(96, 30, Unleaded_fill_nozzle, 32, 32, ST7735_WHITE); //(x,y, name, DX, DY, color)
tft.setTextSize(1);
tft.setCursor(20, 40);
tft.println(F("Total"));
tft.setTextSize(1);
tft.setCursor(20, 30);
tft.println(F("Unleaded"));
tft.setCursor(20, 56);
tft.setTextSize(4);
tft.println(used_Unleaded,1);
tft.setTextSize(2);
tft.setCursor(105,63);
tft.println(F("l"));
break;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////