<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[corrupted text]]></title><description><![CDATA[<p dir="auto">As you can see from the following photo I have a problem with text display.   When I first upload the sketch or do a reset on my lilygo t-disply the text will display fine...for about 30 seconds.  Then the temperature degrades into the little boxes you see in the photo.  The date and time will generally be fine for several hours but after a while that too degrades.   I am using the TFT_eSPI library.<br />
<img src="/assets/uploads/files/1709965234640-lilyttgo.jpg" alt="lilyTTGO.jpg" class=" img-responsive img-markdown" width="1900" height="862" /></p>
<pre><code>#include &lt;Adafruit_GFX.h&gt;    // Core graphics library
#include &lt;Adafruit_ST7789.h&gt; // Hardware-specific library for ST7789
#include &lt;SPI.h&gt;
#include &lt;WiFi.h&gt;
#include &lt;Wire.h&gt;
#include "time.h"

const char* ssid     = "randomtorok-d";
const char* password = "Chipss12";
int counter = 0;
int dT= 5000;

// pinouts from https://github.com/Xinyuan-LilyGO/TTGO-T-Display
#define TFT_MOSI 19
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 16
#define TFT_RST 23
#define TFT_BL 4

// constructor for data object named tft 
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

const char* ntpServer = "pool.ntp.org";
const long  gmtOffset_sec = -28800;
const int   daylightOffset_sec = 3600;

float getTemperature(){
  #define ADC_VREF_mV    5000.0 // in millivolt
  #define ADC_RESOLUTION 4095.0
  #define PIN_LM35       32 // ESP32 pin GPIO36 (ADC0) connected to LM35
  // read the ADC value from the temperature sensor
  int adcVal = analogRead(PIN_LM35);
  //int adcVal = 250;
  // convert the ADC value to voltage in millivolt
  float milliVolt = adcVal * (ADC_VREF_mV / ADC_RESOLUTION);
  // convert the voltage to the temperature in °C
  float tempC = milliVolt / 10;
  return tempC;
}

void setup(void) {
  Serial.begin(115200);
  delay(dT) ;
  Serial.println();
  Serial.print("Connecting to network: ");
  Serial.println(ssid);
  WiFi.disconnect(true);  //disconnect form wifi to set new wifi connection
  
  WiFi.begin(ssid, password); //connect to wifi
  while (WiFi.status() != WL_CONNECTED) {
    delay(dT);
    Serial.print(".");
    counter++;
    if (counter &gt;= 60) { //after 30 seconds timeout - reset board (on unsucessful connection)
      ESP.restart();
    }
     // Init and get the time
  configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address set: ");
  Serial.println(WiFi.localIP()); //print LAN IP
  Serial.print(F("Hello! ST77xx TFT Test"));
  pinMode(TFT_BL, OUTPUT);      // TTGO T-Display enable Backlight pin 4
  digitalWrite(TFT_BL, HIGH);   // T-Display turn on Backlight
  tft.init(135, 240);           // Initialize ST7789 240x135
  Serial.println(F("Initialized"));
  tft.fillScreen(ST77XX_BLACK);
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) { //if we are connected to eduroam network
    counter = 0; //reset counter
    } else if (WiFi.status() != WL_CONNECTED) { //if we lost connection, retry
    WiFi.begin(ssid);
  }
  while (WiFi.status() != WL_CONNECTED) { //during lost connection, print dots
    delay(dT);
    Serial.print(".");
    counter++;
    if (counter &gt;= 60) { //30 seconds timeout - reset board
      ESP.restart();
    }
  }
struct tm timeinfo;
  if(!getLocalTime(&amp;timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }
  Serial.println(getTemperature());
  tft.setRotation(3);
  tft.setTextSize(2);
  tft.setTextColor(ST77XX_YELLOW);
  tft.setTextWrap(true);
  tft.setCursor(0, 0);
  tft.print("IP: ");
  tft.setCursor(40, 0);
  tft.print(WiFi.localIP());
  tft.setCursor(0, 25);
  tft.print("Date/Time: ");
  tft.setCursor(0, 50);
  tft.print(&amp;timeinfo, "%b %d, %Y %H:%M");
  tft.setCursor(0, 75);
  tft.print("Temperature: ");
  tft.setCursor(74, 100);
  tft.setTextSize(3);
  tft.print(getTemperature());
   
}
</code></pre>
<p dir="auto">Here's hoping that someone might have a solution to this issue.  All and any comments or suggestions are greatly appreciated.</p>
]]></description><link>https://www.community.lilygo.cc/topic/896/corrupted-text</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 13:34:03 GMT</lastBuildDate><atom:link href="https://www.community.lilygo.cc/topic/896.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Mar 2024 06:27:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to corrupted text on Fri, 15 Mar 2024 02:04:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> Perfect! Thanks for getting back to me.</p>
]]></description><link>https://www.community.lilygo.cc/post/1601</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1601</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Fri, 15 Mar 2024 02:04:51 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Fri, 15 Mar 2024 01:25:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> I figured it out.  With the eSPI library, when you specify text color you have to specify a background color.  So by entering the following tft.setTextColor(TFT_GREENYELLOW,TFT_BLACK); the display will display a non blinking text.</p>
]]></description><link>https://www.community.lilygo.cc/post/1599</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1599</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Fri, 15 Mar 2024 01:25:54 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Thu, 14 Mar 2024 03:59:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> Can you post your sketch here and I will have a look?</p>
<p dir="auto">The key is that new text is not being erased, it is just building up like a rubber stamp, changing the time and over printing each time. It may not be the library, but your code!</p>
]]></description><link>https://www.community.lilygo.cc/post/1597</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1597</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Thu, 14 Mar 2024 03:59:06 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Thu, 14 Mar 2024 03:25:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> Well it looks like I spoke to soon.  I converted my thermometer sketch to the tft_espi library and it's doing the same thing that the adafruit library does.   Initially it is very clear but within the first second the temperature reading begins to corrupt as does the time display.  Not sure why since the test sketch with the espi library was so perfect.</p>
]]></description><link>https://www.community.lilygo.cc/post/1596</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1596</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Thu, 14 Mar 2024 03:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Tue, 12 Mar 2024 04:02:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Thanks for the script.   I found a solution to the blinking text.  I have another display running on another ESP32 and I realized that it wasn't blinking.  It is running a GPS program and displaying the time which always looks crisp and clean so I took a look at that script and realized it was using a different display library.  TFT_eSPI.   Took a bit of tinkering but I got a display that shows the temperature perfectly.```<br />
#include &lt;TFT_eSPI.h&gt; // Hardware-specific library<br />
#include &lt;OneWire.h&gt;<br />
#include &lt;DallasTemperature.h&gt;</p>
<p dir="auto">TFT_eSPI tft = TFT_eSPI();</p>
<p dir="auto">// GPIO where the DS18B20 is connected to<br />
const int oneWireBus = 32;</p>
<p dir="auto">float getTemperature(){<br />
// Setup a oneWire instance to communicate with any OneWire devices<br />
OneWire oneWire(oneWireBus);</p>
<p dir="auto">// Pass our oneWire reference to Dallas Temperature sensor<br />
DallasTemperature sensors(&amp;oneWire);<br />
sensors.begin();<br />
//delay(dT) ;</p>
<p dir="auto">sensors.requestTemperatures();<br />
float temperatureC = sensors.getTempCByIndex(0);<br />
//float temperatureF = sensors.getTempFByIndex(0);<br />
return(temperatureC);<br />
}</p>
<p dir="auto">void setup() {<br />
Serial.begin(115200);<br />
//delay(dT) ;<br />
pinMode(TFT_BL, OUTPUT);      // TTGO T-Display enable Backlight pin 4<br />
digitalWrite(TFT_BL, HIGH);   // T-Display turn on Backlight<br />
tft.init();           // Initialize ST7789 240x135<br />
Serial.println(F("Initialized"));<br />
tft.fillScreen(TFT_BLACK);<br />
}</p>
<p dir="auto">void loop() {<br />
tft.setRotation(1);<br />
tft.setTextColor(TFT_GREENYELLOW,TFT_BLACK);<br />
tft.setCursor(0, 0);<br />
tft.print("Temperature: ");<br />
tft.setCursor(74, 50);<br />
tft.setTextSize(3);<br />
tft.print(getTemperature());<br />
}</p>
<pre><code></code></pre>
]]></description><link>https://www.community.lilygo.cc/post/1586</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1586</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Tue, 12 Mar 2024 04:02:31 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Tue, 12 Mar 2024 03:22:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a><br />
Prints to serial as I do not have a TTGO!</p>
<pre><code>#include &lt;OneWire.h&gt;
#include &lt;DallasTemperature.h&gt;
OneWire oneWire(1);  //pin 1 or your choice!
DallasTemperature sensors(&amp;oneWire);

void setup() {

  Serial.begin(115200);
  delay(200);
  Serial.println(" setup DS18B20 ");
  delay(200);
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures();
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print(temperatureC);
  Serial.println("ºC");
  Serial.println("   ");
  delay(2000);
}
</code></pre>
]]></description><link>https://www.community.lilygo.cc/post/1585</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1585</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Tue, 12 Mar 2024 03:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Tue, 12 Mar 2024 02:42:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> I'd be interested to see how you did it.   I've got it running on my T-Display.   My multimeter with a thermocouple on it reads 22 degrees.  My cheap 3 dollar Chinese thermometer reads 23.4 and my DS18B20 is reading 23.87.   At the moment the temperature is flashing on and off as the loop, loops.  And I've yet to deal with the time display getting corrupted.</p>
]]></description><link>https://www.community.lilygo.cc/post/1584</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1584</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Tue, 12 Mar 2024 02:42:40 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Mon, 11 Mar 2024 14:53:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> DS18B20 is the best low-end temp sensor I’ve seen.</p>
<p dir="auto">It is digital, with a simple serial interface.</p>
<p dir="auto">You need two libraries to run it, but its use is well documented.<br />
Cheers,</p>
<p dir="auto">I have a test sketch for it running on LilyGO if you are interested, I will post it here.</p>
]]></description><link>https://www.community.lilygo.cc/post/1580</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1580</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Mon, 11 Mar 2024 14:53:00 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Mon, 11 Mar 2024 13:21:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Thanks for that information.  How about the DS18B20?  Would it work better?  Looking now for the datasheet on the DS.</p>
]]></description><link>https://www.community.lilygo.cc/post/1578</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1578</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Mon, 11 Mar 2024 13:21:31 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Mon, 11 Mar 2024 01:56:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> what temperature sensor are you using?<br />
I see an LM-35, but they are analog, and the ESP32 is a terrible ADC, with linearity and stability issues, because its value changes with the ESP32 core temp and internal voltage fluctuations!</p>
]]></description><link>https://www.community.lilygo.cc/post/1577</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1577</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Mon, 11 Mar 2024 01:56:49 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Sun, 10 Mar 2024 23:26:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Ok that worked a treat.  The temperature is displaying as it should.  Now to figure out why it's all over the place.  Thermometer on my desk reads 23.5 while my Lilygo is displaying Anywhere from 17 to 20 degrees.   And it's changing every loop of the void loop.  And I still have to deal with the time display being corrupted.<br />
Gonna look more into millis().<br />
Thanks for the assistance.</p>
<p dir="auto">WD</p>
]]></description><link>https://www.community.lilygo.cc/post/1576</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1576</guid><dc:creator><![CDATA[Witchdoc]]></dc:creator><pubDate>Sun, 10 Mar 2024 23:26:27 GMT</pubDate></item><item><title><![CDATA[Reply to corrupted text on Sat, 09 Mar 2024 16:08:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/1897">@witchdoc</a> Ooof! This is a classic case of not clearing the printed text before the next display update!<br />
The text 'compounds' until it is filled in completely.<br />
Your time display is the clue.<br />
At the top of your print results put in:</p>
<p dir="auto">tft.fillScreen(TFT_BLACK);</p>
<p dir="auto">or if that causes flickering try</p>
<p dir="auto">tft.fillRect(h, v, h size, v size, TFT_BLACK);<br />
for example, where needed.<br />
This second one is a pain to get the horizontal, vertical and box dimensions perfect.</p>
<p dir="auto">Try that!<br />
-Terry</p>
]]></description><link>https://www.community.lilygo.cc/post/1572</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/1572</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Sat, 09 Mar 2024 16:08:07 GMT</pubDate></item></channel></rss>