Digital photo frame with led and sounds

Hi, I'm working on a project with a waveshare 1.69" LCD Screen (240 X 280 pixels)with a ST7789V2 control chip and a arduino nano v3.

https://www.waveshare.com/wiki/1.69inch_LCD_Module

the supplied code uses Paint_DrawLine() and then Paint_ClearWindows() which is taking more time than I want, for the picture on the screen to refresh.

I'm happy to supply the code as well but its about 975 lines at the moment.

This is my first Arduino project but i have some experience with html and css, so any help speeding it up would be appreciated.

thanks!

Welcome to the forum

Instead of posting your whole project sketch can you post a smaller but complete sketch that illustrates the problem ?

Step 1 is read the pinned post re 'How to get the most from the forum'

#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

#include <SPI.h>
#include "LCD_Driver.h"
#include "GUI_Paint.h"
#include "image.h"

// Use pins 5 and 6 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 5; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 6; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Create the Player object
DFRobotDFPlayerMini player;

const int buttonPin2 = 3; //RELOAD SWITCH
const int buttonPin1 = 2;  // the number of the pushbutton pins
const int ledPin =  4;      // the number of the LED pin

int buttonState_1 = 0, buttonState_2 = 1;  // variable for reading the pushbuttons status
int preState_1 = 0, preState_2 = 1;
int counter = 16;

void setup() {
    // initialize the LED pin as an output
  //LED flashes during decrement of counter
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  Serial.begin(9600);
  // Init serial port for DFPlayer Mini
  softwareSerial.begin(9600);
  
  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
    Serial.println("3");
    
    // Set volume to maximum (0 to 30).
    player.volume(30);
  } 
  else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
Config_Init();
    LCD_Init();

    LCD_SetBacklight(80);

Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 90, GRAY);
    Paint_Clear(GRAY);
    
    
}

void loop() {
  // read the state of the pushbutton
  buttonState_1 = digitalRead(buttonPin1);
  buttonState_2 = digitalRead(buttonPin2);
  
if (counter == 3 ) {
 // counter decrement if the pushbutton 1 is pressed.
   if (buttonState_1 == HIGH && preState_1 == 0 ) {
    counter--;
      Serial.println(counter);
      // Play the "0002.mp3" in the "mp3" folder on the SD card
      player.playMp3Folder(2);
      // turn LED on
      digitalWrite(ledPin, HIGH);

      delay(300);
     // turn LED off
      digitalWrite(ledPin, LOW);
      preState_1 = 1;

      //** CLEAR OLD 3
      Paint_DrawLine(197,63,  240,63,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(240,63,  217,97,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(217,97,  222,98,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(222,98,  232,105, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(232,105, 238,114, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(238,114, 240,125, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(240,125, 238,136, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(238,136, 232,145, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(232,145, 223,152, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(223,152, 211,154, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(211,154, 200,152, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(200,152, 190,146, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(190,146, 184,136, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      //** WRITE NEW NUMBER 2
      Paint_DrawLine(188,84, 190,75,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(190,75, 197,67,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(197,67, 207,62,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(207,62, 222,62,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(222,62, 234,69,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(234,69, 240,79,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(240,79, 240,90,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(240,90, 236,99,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(236,99, 228,106, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(228,106, 213,108, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(213,108, 203,113, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(203,113, 194,123, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(194,123, 188,136, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(188,136, 186,152, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(186,152, 240,152, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);

      //** DRAW GRAPH DECREASE
      Paint_DrawLine(30,173, 55,162, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(36,184, 59,170, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(37,185, 59,171, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
   } 
  else if(buttonState_1 == LOW) {
    preState_1 = 0;
  }
}

else if (counter == 2 ) {
 // counter decrement if the pushbutton 1 is pressed.
   if (buttonState_1 == HIGH && preState_1 == 0 ) {
    counter--;
      Serial.println(counter);
      // Play the "0002.mp3" in the "mp3" folder on the SD card
      player.playMp3Folder(2);
      // turn LED on
      digitalWrite(ledPin, HIGH);

      delay(300);
     // turn LED off
      digitalWrite(ledPin, LOW);
      preState_1 = 1;

      //** CLEAR 2
      Paint_DrawLine(188,84, 190,75,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(190,75, 197,67,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(197,67, 207,62,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(207,62, 222,62,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(222,62, 234,69,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(234,69, 240,79,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(240,79, 240,90,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(240,90, 236,99,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(236,99, 228,106, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(228,106, 213,108, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(213,108, 203,113, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(203,113, 194,123, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(194,123, 188,136, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(188,136, 186,152, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(186,152, 240,152, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      //** WRITE NEW NUMBER 1
      Paint_DrawLine(216,62, 216,152,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);

      //** WRITE /\ 
      Paint_DrawLine(97,86, 100,87, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(100, 87, 134,136, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(134,136, 134,139, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(134,139, 132,141, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(132,141, 62,141, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(62,141, 60, 139, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(60,139, 60,136, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(60,136, 94,87, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(94,87, 97,86, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      //** WRITE ! 
      Paint_DrawRectangle(92,93, 102,126, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
      Paint_DrawRectangle(93,132, 101,140, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);

      //** DRAW GRAPH DECREASE
      Paint_DrawLine(38,187, 61,172,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(39,189, 62,174,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(40,190, 62,175,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(41,192, 63,176,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
   } 
  else if(buttonState_1 == LOW) {
    preState_1 = 0;
  }
}

else if (counter == 1 ) {
 // counter decrement if the pushbutton 1 is pressed.
   if (buttonState_1 == HIGH && preState_1 == 0 ) {
    counter--;
      Serial.println(counter);
      // Play the "0002.mp3" in the "mp3" folder on the SD card
      player.playMp3Folder(2);
      // turn LED on
      digitalWrite(ledPin, HIGH);

      delay(300);
     // turn LED off
      digitalWrite(ledPin, LOW);
      preState_1 = 1;
      
    //** CLEAR 1
      Paint_DrawLine(216,62, 216,152,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
    //** CLEAR /\ 
      Paint_DrawLine(97,86, 100,87, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(100, 87, 134,136, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(134,136, 134,139, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(134,139, 132,141, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(132,141, 62,141, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(62,141, 60, 139, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(60,139, 60,136, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(60,136, 94,87, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(94,87, 97,86, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      //** CLEAR ! 
      Paint_DrawRectangle(92,93, 102,126, GRAY, DOT_PIXEL_3X3, DRAW_FILL_EMPTY);
      Paint_DrawRectangle(93,132, 101,140, GRAY, DOT_PIXEL_3X3, DRAW_FILL_EMPTY);


    //** WRITE NEW NUMBER 0
      Paint_DrawLine(219,62, 228,68,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(228,68, 237,81,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(237,81, 241,97, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(241,97, 241,120,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(241,120, 237,134,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(237,134, 228,148,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(228,148, 219,154,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(219,154,  207,154, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(207,154, 198, 148, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(198,148, 189,135, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(189,135, 185,120, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(185,120, 185,97, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(185,97, 189,81, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(189,81, 198,68,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(198,68, 207,62,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(207,62, 219,62,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);

      delay(500);

      //** CLEAR 0
      Paint_DrawLine(219,62, 228,68,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(228,68, 237,81,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(237,81, 241,97, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(241,97, 241,120,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(241,120, 237,134,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(237,134, 228,148,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(228,148, 219,154,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(219,154,  207,154, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(207,154, 198, 148, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(198,148, 189,135, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(189,135, 185,120, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(185,120, 185,97, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(185,97, 189,81, GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(189,81, 198,68,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(198,68, 207,62,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(207,62, 219,62,  GRAY, DOT_PIXEL_3X3, LINE_STYLE_SOLID);


   } 
  else if(buttonState_1 == LOW) {
    preState_1 = 0;
  }
}
//** empty sound, coounter at 0
else if (counter <= 0 ) {
  if (buttonState_1 == HIGH && preState_1 == 0) {
    counter == 0;
     // Play the "0003.mp3" in the "mp3" folder on the SD card
      player.playMp3Folder(3);
      // turn LED on
           delay(300);
        preState_1 = 1;
  } 
  else if(buttonState_1 == LOW) {
    preState_1 = 0;
  }
} 

//*** reload IE reset counter & Play reload
// compare the buttonState to its previous state
if (buttonState_2 != preState_2) {
    // if the state has changed, increment the counter
    if (buttonState_2 == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      counter = 16;
      Serial.println(counter);
      // Play the "0001.mp3" in the "mp3" folder on the SD card
      player.playMp3Folder(1);
      preState_2 = 1;
      counter = 16;    
    
      Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 90, GRAY);
      Paint_Clear(GRAY);
    //** PAINT NEW GRAPH
      Paint_DrawLine(47,200, 68,182, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(46,198, 67,181, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(44,196, 66,179, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(42,194, 65,177, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(41,192, 63,176, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(40,190, 62,175, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(39,189, 62,174, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(38,187, 61,172, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(37,185, 59,171, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(36,184, 59,170, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(30,173, 55,162, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(29,171, 54,160, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(28,169, 53,158, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(27,167, 52,157, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(26,165, 52,155, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(25,163, 51,153, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(24,161, 51,151, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(24,159, 49,150, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(23,156, 49,148, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(20,144, 47,139, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(20,142, 46,137, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(19,140, 46,135, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(19,138, 46,133, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(19,136, 46,132, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(18,134, 46,131, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);

      Paint_DrawLine(18,132, 45,129,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(18,130, 45,128, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(17,128, 45,126, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(17,126, 45,124, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      
      Paint_DrawLine(17,113, 45,115, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(17,111, 45,113, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(18,109, 45,111, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(18,107, 45,110, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*8*/
      
      Paint_DrawLine(18,105, 46,108, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(19,103, 46,107, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(19,101, 46,106, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(19,99,  46,104, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*7*/
      
      Paint_DrawLine(20,97, 46,102, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(20,95, 47,100, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(23,83, 49,91,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*6*/
      
      Paint_DrawLine(24,80, 49,89,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(25,78, 50,88,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(25,76, 51,86,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(26,74, 52,85,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*5*/
      
      Paint_DrawLine(27,72, 52,82,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(27,75, 53,81,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(28,68, 54,79,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*4*/
      
      Paint_DrawLine(30,66, 55,77,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(36,55, 59,69,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(37,54, 60,68,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(38,52, 61,67,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*3*/
      
      Paint_DrawLine(39,50, 62,65,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(40,48, 63,64,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(41,47, 64,63,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(42,45, 65,62,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*2*/
      
      Paint_DrawLine(44,43, 66,60,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(46,41, 67,58,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
      Paint_DrawLine(47,40, 68,57,  BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID); /*1*/
      
    //** WRITE NEW NUMBER  1
    Paint_DrawLine(142,62, 142,152,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
    //** WRITE NEW NUMBER  6
      Paint_DrawLine(213,63, 197,86,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(197,86, 185,110,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(184,114, 190,105, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(182,125, 184,114, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(184,136, 182,125, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(190,146, 184,136, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(200,152, 190,146, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(211,154, 200,152, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(223,152, 211,154, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(232,145, 223,152, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(238,136, 232,145, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(240,125, 238,136, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(238,114, 240,125, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(232,105, 238,114, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(222,98,  232,105, BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(211,96,  222,98,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(200,98,  211,96,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
      Paint_DrawLine(190,105, 200,98,  BLACK, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
    } 
    
    else if(buttonState_2 == LOW) {
      // if the current state is LOW then the button went from on to off:
      Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 90, GRAY);
      player.playMp3Folder(1);
      Paint_Clear(GRAY);
    preState_2 = 0;
    }
  // Delay a little bit to avoid bouncing
  delay(50);
  // save the current state as the last state, for next time through the loop
  preState_2 = buttonState_2;
}
}


What are all those calls to Paint_DrawLine() actually drawing ?

I am not familiar with the libraries that you are using but do they support the drawing of graphics files ?

Background is light grey (for clarity, dark grey here).
Numbers drawn in black, then (incompletely) "cleared" in lightgrey.
Shapes and lines in black, then re-drawn in lightgrey.
"Sweep" drawn in black.

Thanks for the replies, I switched from the supplied Waveshare driver to the Adafruit gfx library. the Waveshare one was literally drawing one pixel at a time but the Adafruit GFX is instantaneous.
ive got a new post about it with a new issue here

there was code in the LCD driver that rotated the display so those rectangles were clearing or overwriting the old numbers.

I used the bitmap data and plopped it at the given x,y without updating any movement. I am sure it looked better. I just wanted to see what was drawn. Amazing the whole numbers were made of a bunch lines (thousands of lines per number).