Gauge indicator

With a real simple gauge like this code, you can probably get away with just writing black over the previous needle and then draw new one...

Something like:

#include <Arduino_GigaDisplay_GFX.h>

GigaDisplay_GFX display;  // Initialize the display with correct resolution for GIGA Display Shield

// Constants for gauge dimensions and centering
const int xmax = 800;
const int ymax = 480;
const int xcenter = xmax / 2;
const int ycenter = ymax / 2;
const int arc = ymax / 5;

#define BLACK 0x0000
#define GREEN 0x07E0

float potmeterPin = A1;  // Pin for the potentiometer
int p;
int w;
int m;
float angle;

char* labels[] = { "LOAD", "COOLANT", "INTAKE", "VOLT" };
int labelXpos[] = { 53, 45, 49, 53 };

float prev_x1 = 0;
float prev_y1 = 0;


void drawGauge(float angle) {

  display.drawCircleHelper(xcenter, ycenter, 100, 1, GREEN);
  display.drawCircleHelper(xcenter, ycenter, 99, 1, GREEN);
  display.drawCircleHelper(xcenter, ycenter, 98, 1, GREEN);
  display.drawCircleHelper(xcenter, ycenter, 100, 2, GREEN);
  display.drawCircleHelper(xcenter, ycenter, 99, 2, GREEN);
  display.drawCircleHelper(xcenter, ycenter, 98, 2, GREEN);

  // Calculate the needle's position
  float x1 = sin(2 * angle * 2 * 3.14159 / 360);
  float y1 = cos(2 * angle * 2 * 3.14159 / 360);
  display.drawLine(xcenter, ycenter, xcenter + arc * x1, ycenter - arc * y1, GREEN);
  display.fillCircle(xcenter, ycenter, 5, GREEN);
  prev_x1 = x1;
  prev_y1 = y1;

  // Set font and draw gauge labels
  display.setTextSize(2);
  display.setCursor(labelXpos[0], 32);
  display.print(labels[0]);

  // Display the numeric value
  display.setCursor(54, 60);
  if (w < 10) {
    display.print('0');
  }
  display.print(w);
}
void updateGauge(float angle) {
  // Calculate the needle's position
  float x1 = sin(2 * angle * 2 * 3.14159 / 360);
  float y1 = cos(2 * angle * 2 * 3.14159 / 360);
  display.drawLine(xcenter, ycenter, xcenter + arc * prev_x1, ycenter - arc * prev_y1, BLACK);
  display.drawLine(xcenter, ycenter, xcenter + arc * x1, ycenter - arc * y1, GREEN);
  display.fillCircle(xcenter, ycenter, 5, GREEN);
  prev_x1 = x1;
  prev_y1 = y1;

  // Set font and draw gauge labels
  display.setTextSize(2);
  display.setCursor(labelXpos[0], 32);
  display.print(labels[0]);

  // Display the numeric value
  display.setCursor(54, 60);
  if (w < 10) {
    display.print('0');
  }
  display.print(w);
}



void setup() {
  while(!Serial && millis() < 4000){}
  Serial.begin(115200);
  display.begin();  // Initialize the display
  display.setRotation(1);
  display.fillScreen(BLACK);
  display.setTextColor(GREEN);  // Set text color to white
  pinMode(A1, INPUT);
  drawGauge(90.0);
}

void loop() {

  //p = analogRead(potmeterPin);  // Read the analog pin
  int ch;
  while ((ch = Serial.read()) != -1) {}
  while ((ch = Serial.read()) == -1) {}
  p = 0;
  while ((ch >= '0') && (ch <= '9')) {
    p = p * 10 + ch - '0';
    ch = Serial.read();
  }

  w = map(p, 0, 1023, 0, 100);  // Map the read value to 0-100
  m = map(p, 0, 1023, 0, 90);   // Map the needle movement
  angle = m;                    // Adjust the angle for needle position
  Serial.print("angle: ");
  Serial.println(angle, 2);

  if (angle < 45) {
    angle = angle + 135;
  } else {
    angle = angle - 45;
  }
  updateGauge(angle);

  delay(100);
}

Sorry did not feel like finding a pot so just entered the new pot value in the serial port.
However I would probably not do it this simply. Would probably at a minimum has a minimum delta angle, that if it did not change more than a specific amount, do update... Otherwise will probably see lots of flicker... Simplest test would be the pot value changed or not.

In more complex setups, where maybe you have background image drawn in gauge, or other stuff, then other approaches can be used. Like computing the new location of where the needle will be displayed, and save away the underlying pixels from that location, and then compute which bits need to be updated to previously saved value, or new value or stays the same... Can be a pain.

In other cases you can cheat. That is you use something like like a frame buffer, and simply draw the full new screen out into the frame buffer and then tell the display to update to that new frame buffer contents. With GFX, you can I believe do things like that using their Canvas objects.

I don't use the Adafruit GFX code enough to remember all details, I know I played with some of it in the thread:
Drawing a few pixels on Giga Display Shield - Hardware / GIGA Display Shield - Arduino Forum