How To Overwrite Text Without Flash?



  • I'm working on a timer application. It runs fine, but when the timer updates there is a distinct (and bothersome) flash. It's as if the process fills the space used by the text with the background color, and then writes the text on top of that. This is the code fragment.

    void display_mmss(uint8_t mm, uint8_t ss, uint16_t fc, uint16_t bc)
    {
    char timeStr[6] = {'0', '0', ':', '0', '0', '\0'};

    timeStr[0] = char('0' + (mm / 10));
    timeStr[1] = char('0' + (mm % 10));
    timeStr[3] = char('0' + (ss / 10));
    timeStr[4] = char('0' + (ss % 10));

    m5.lcd.setTextColor(fc, bc);
    m5.lcd.setTextDatum(CC_DATUM);
    m5.lcd.setFreeFont(&Digital7Mono65pt7b);
    m5.lcd.drawString(timeStr, 160, 120);
    }

    (My code is properly indented -- this forum doesn't seem to allow for that)


  • M5Stack

    @jonnymac Partial refresh the text.

    e.g.

    m5.lcd.fillRect(x,y,h,w,backgroundcolor);//erase partial place for updating data
    m5.lcd.drawString("....");//display your Time-varying text
    

Log in to reply
 

Looks like your connection to M5Stack Community was lost, please wait while we try to reconnect.