There are many ways of doing this. One is you could erase the area before you write the next line... But pain.
Have you tried Opaque text? That is in your initial code:
Code:
tft.begin();
tft.fillScreen(ILI9341_WHITE);
tft.setTextColor(ILI9341_BLUE, ILI9341_WHITE); // Set both FG and BG colors.
This will setup that when you write out the characters, the parts that are not set to BLUE will be set to white.
This should get you mostly there. However if the length of strings change, the new string only writes as much as it needs to, so could be characters that are not overwritten.
Note: I typically have not used the Scroll stuff, but instead set the Text position explicitly for each main field.
A couple ways to handle the maybe does not overwrite all of the characters... May depend on if anything displays right to right of the field and if I have room. But suppose the value you output is from 1-3 characters in length and I have room, I can get lazy and do something like:
Code:
tft.print("ADC1 = ");
tft.print(adc1);
tft.println(" ");
tft.print("ADC2 = ");
tft.print(adc2);
tft.println(" ");
If I don't have room and wish to avoid flicker, I do something like:
Code:
tft.setCursor(100, 100); // assume your field starts at 100, 100 and goes to 200, 150
tft.print("ADC1 = ");
tft.print(adc1); // you finished your output of the field.
tft.getCursor(&x, &y); // get the current text position x, y are defined as int16_t
tft.fillRect(x, 100, 200, 150, ILI9341_WHITE); // fill in the rest of the area with white.
The height of the fill above depends on the font size and the like. I would have to look but it is something like 8*size.
You can also do fancy things like remember the ending X for the previous write and only fill up to that width... But maybe more trouble than it is worth.
Good Luck