Core2 and sprites - don't play well together?



  • Can anyone tell me if the have sprites working correctly on their Core2 and if so, did you need to do something special to make them work. I don't think there is anything wrong with my code (see below) but the numbers don't overwrite them selves neatly a create quite a mess.
    0_1710787988263_IMG_0041-sharpened copy.jpg

    Code:
    #include <M5Core2.h>
    #include "Bunken20pt7b.h"

    #define color1 0x2144

    TFT_eSprite spr = TFT_eSprite(&M5.Lcd);

    int backlight = 2800;

    void setup() {

    M5.begin();
    M5.Axp.SetLcdVoltage(backlight);
    spr.createSprite(320,240);
    spr.fillSprite(color1);
    

    }

    void loop() {

    M5.update();
    backlight = backlight + 1; if (backlight >= 3300) backlight = 0;
    //M5.Axp.SetLcdVoltage(backlight);
    spr.setTextDatum(4);
    spr.setFreeFont(&Bunken20pt7b);
    spr.setTextColor(TFT_ORANGE,color1);  
    spr.drawString(String(backlight),160,120);
    spr.pushSprite(0,0);     
    delay(5);
    

    }



  • @czm88 I use a fill rectangle in the correct size and background colour to clear a text area before each write.
    Works a charm on my Core and Core2.



  • @teastain Thanks, that worked like a charm!