Two problems I see.
First, you are updating the display every time through loop, repeatedly erasing the text and rewriting it when it has not changed.
Second, erasing and redrawing the box around the text is a slow process.
I'm not sure what color you want the text or background, but you can try this code and see if it works properly. You really do not need the case statement for the text but I've left it close to how you had it written.
#include <Wire.h>
#include <EEPROM.h>
#include <TFT_HX8357.h> // Hardware-specific library
TFT_HX8357 tft = TFT_HX8357(); // Invoke custom library
#include "z_Free_Fonts.h" // Include the header file attached to this sketch
//#define TFT_GREY1 0x8410 // New colour // HERE WE CORRECT THE GRAY COLOR !!!!! 11 0x8410 - GREEN LABEL 0x39E7 - YELLOW LABEL
int audioSwitch = A11; // set up a constant for the Audio Filter switch
int audioSwitchState = 0; // variable to hold the value of the switchPin
int prevaudioSwitchState = 0; // variable to hold previous value of the switchpin
int audioSwitchCounter = 0; // counter for the number of button presses //audiobuttonPushCounter
int prevAudioSwitchCounter = -1; // dummy value so that text displays the first time
const char audio_text[][7] = {
" OFF",
"1.5Khz",
"2.0Khz",
"2.5Khz",
};
int prev_text;
//int attanSwitch = ; // set up a constant for the Audio Filter switch
//int attanSwitchState = 0; // variable to hold the value of the switchPin
//int prevattanSwitchState = 0; // variable to hold previous value of the switchpin
//int attanSwitchCounter = 0; // counter for the number of button presses //audiobuttonPushCounter
void setup() { // PUT YOUR SETUP CODE HERE, TO RUN ONCE:
delay (100);
Wire.begin();
//***************** display setting ************************
tft.init();
tft.setRotation(1); //3// 1 WORKS
tft.fillScreen(0x0000); // erase everything
//**************** PERMANENT INFO DISPLAY PROGRAM ****************
tft.fillScreen(TFT_BLACK);
//tft.fillRect(225, 108, 50, 23, TFT_GREY1); // стираем старое x y width hight //(355, 117, 90, 23, TFT_BLACK)
tft.setTextColor(TFT_WHITE );
//tft.setFreeFont(FF6);
tft.setFreeFont(FF41);//6
//tft.fillRoundRect(72, 45, 55, 23, 5, TFT_WHITE);tft.setCursor(80, 62, 1);tft.println("ATT");
//tft.fillRoundRect(72, 45, 55, 23, 5, TFT_GREY1);tft.setCursor(80, 62, 1);tft.println("ATT");
//************************************************************
tft.setCursor(300, 139, 1); // 285, 139, 1 //152, 150, 1 //
tft.println("MODE"); //
//tft.setCursor(60, 17, 1);
tft.setCursor(300, 106, 1); //292, 106, 1
tft.println("RIT ");
tft.setCursor(152, 125, 1);
tft.setFreeFont(FF41);
tft.setTextColor(TFT_WHITE );
tft.println("AUDIO");
tft.setFreeFont(FF41); // 21
tft.setCursor(10, 182, 1);
tft.println("VCC - V");
//tft.setFreeFont(FF26);//6
tft.drawRoundRect(140, 15, 334, 143, 5, TFT_BLUE ); // x,y,width,high,radius,color, rectangle A
//********* Setup Inputs And Outputs ************
pinMode(audioSwitch, INPUT); // set up the switch pin as an input [ INPUT_PULLUP ]
digitalWrite(audioSwitch, HIGH); // turn on pullup resistor
pinMode(A12, OUTPUT); // Initiates off pin
pinMode(A13, OUTPUT); // Initiates 1.5Khz pin
pinMode(A14, OUTPUT); // Initiates 2.0Khz pin
pinMode(A15, OUTPUT); // Initiates 2.5Khz pin
//pinMode(attanSwitch,INPUT); // set up the switch pin as an input [ INPUT_PULLUP ]
//digitalWrite(attanSwitch,HIGH); // turn on pullup resistor
//pinMode(A12, OUTPUT); // Initiates off pin
//pinMode(A13, OUTPUT); // Initiates 10dB pin
//pinMode(A14, OUTPUT); // Initiates 20dB pin
//pinMode(A15, OUTPUT); // Initiates 30dB pin
}
void loop() { // PUT YOUR MAIN CODE HERE, TO RUN REPEATEDLY:
audioSwitchState = digitalRead(audioSwitch); // check the status of the switch
if (audioSwitchState != prevaudioSwitchState) // compare the switchState to its previous state
{
if (audioSwitchState == LOW) // If the switch is pressed, count the press
{
audioSwitchCounter ++;
audioSwitchCounter %= 4;
}
}
// only need to update display if audioSwitchCounter has changed
if (audioSwitchCounter != prevAudioSwitchCounter)
{
prevAudioSwitchCounter = audioSwitchCounter;
switch (audioSwitchCounter)
{
case 0: // Off
tft.setFreeFont(FF41);
tft.setCursor(230, 125, 1); // SetCursor(230, 125, 1);
tft.setTextColor(TFT_BLACK); // Set text to background color
tft.println(audio_text[prev_text]); // Overwrite old text
tft.setCursor(230, 125, 1); // Reposition cursor
tft.setTextColor(TFT_WHITE); // Set text color
tft.println(audio_text[0]); // Print new text
prev_text = 0; // Save pointer to text currently displayed
digitalWrite(A12, HIGH); // Output on
digitalWrite(A13, LOW); // Output off
digitalWrite(A14, LOW); // Output off
digitalWrite(A15, LOW); // Output off
break;
case 1: // 1.5Khz
tft.setFreeFont(FF41);
tft.setCursor(230, 125, 1); // SetCursor(230, 125, 1);
tft.setTextColor(TFT_BLACK); // Set text to background color
tft.println(audio_text[prev_text]); // Overwrite old text
tft.setCursor(230, 125, 1); // Reposition cursor
tft.setTextColor(TFT_WHITE); // Set text color
tft.println(audio_text[1]); // Print new text
prev_text = 1; // Save pointer to text currently displayed
digitalWrite(A12, LOW); // Output off
digitalWrite(A13, HIGH); // Output on
digitalWrite(A14, LOW); // Output off
digitalWrite(A15, LOW); // Output off
break;
case 2: // 2.0Khz
tft.setFreeFont(FF41);
tft.setCursor(230, 125, 1); // SetCursor(230, 125, 1);
tft.setTextColor(TFT_BLACK); // Set text to background color
tft.println(audio_text[prev_text]); // Overwrite old text
tft.setCursor(230, 125, 1); // Reposition cursor
tft.setTextColor(TFT_WHITE); // Set text color
tft.println(audio_text[2]); // Print new text
prev_text = 2; // Save pointer to text currently displayed
digitalWrite(A12, LOW); // Output off
digitalWrite(A13, LOW); // Output off
digitalWrite(A14, HIGH); // Output on
digitalWrite(A15, LOW); // Output off
break;
case 3: // 2.5Khz
tft.setFreeFont(FF41);
tft.setCursor(230, 125, 1); // SetCursor(230, 125, 1);
tft.setTextColor(TFT_BLACK); // Set text to background color
tft.println(audio_text[prev_text]); // Overwrite old text
tft.setCursor(230, 125, 1); // Reposition cursor
tft.setTextColor(TFT_WHITE); // Set text color
tft.println(audio_text[3]); // Print new text
prev_text = 3; // Save pointer to text currently displayed
digitalWrite(A12, LOW); // Output off
digitalWrite(A13, LOW); // Output off
digitalWrite(A14, LOW); // Output off
digitalWrite(A15, HIGH); // Output on
break;
}
}
prevaudioSwitchState = audioSwitchState; // save the current switch state as the last state
}