M5Paper icon displaying as 2 small icons.



  • I am using an M5Paper and I have created a static const int8_t array using this website.

    I then use the command

    "DrawIcon(100, 780, (uint16_t *)Arrow_circle_down, 64, 64, true);"

    together with the same drawIcon command for my other icons which are in an icon.h file I downloaded from the internet. All of the other icons display correctly but the icon I created displays as two small icons at the top and part of an unconnected icon at the bottom of the 64x64 square.

    My working icon arrays look like this:
    static const uint8_t SUNRISE64x64[8192] = {
    0xff, 0xff, 0xff,........};

    My created icon array array looks like this;
    // array size is 4096
    static const int8_t Arrow_circle_down[] = {
    0xff, 0xff, 0xff,........};

    I tried putting the array size 4096 in the square brackets but that made no difference.

    The function drawIcon is:

    void DrawIcon(int x, int y, const uint16_t icon, int dx /= 64/, int dy /= 64/, bool highContrast /= false/) {
    for (int yi = 0; yi < dy; yi++) {
    for (int xi = 0; xi < dx; xi++) {
    uint16_t pixel = icon[yi * dx + xi];
    if (highContrast) {
    if (15 - (pixel / 4096) > 0) canvas.drawPixel(x + xi, y + yi, M5EPD_Canvas::G15);
    } else {
    canvas.drawPixel(x + xi, y + yi, 15 - (pixel / 4096));
    }
    }
    }
    }*

    Why is the created icon not displaying correctly?