1

Тема: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Аудиопроцессор TDA7419 обладает очень хорошими параметрами звучания, а так же большим функционалом, позволяющий оптимально настроить звучание Вашей аудио системы.

Основная статья - http://rcl-radio.ru/?p=57658

https://github.com/liman324/TDA7419.git
http://rcl-radio.ru/wp-content/uploads/ … _GFX-1.zip
http://rcl-radio.ru/wp-content/uploads/ … 5408-1.zip

http://rcl-radio.ru/wp-content/uploads/2019/04/7523965782368.png


#include <Wire.h> 
#include <SPI.h>
#include <TDA7419.h>
#include <EEPROM.h>
TDA7419 tda;
#include <Adafruit_GFX.h>    
#include <TftSpfd5408.h>
#include <SPI.h>>
 
TftSpfd5408 tft(A3,A2,A1,A0,A4);/// LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET // A3,A2,A1,A0,rst
// D0 pin 8, D1 pin 9, D2 pin 2, D3 pin 3, D4 pin 4, D5 pin 5, D6 pin 6,D7 pin 7
int menu,pluse,minus,mute=1;
int i,i2,vol=50,set,treb,mid,bass,in,gain,gain1,gain2,gain3,lf,lt,rf,rt,sab,att_loun,s_loun,treb_c,middle_c,bass_c,sub_f,middle_q,bass_q;
byte eeprom;
int  w=1,w1=1,w2=1,w3=1,w4=1,w5=1,w6=1,w7=1,w8=1,w9=1,w10=1,w11=1,w12=1,w13=1,w14=1,w15=1,w16=1,w17=1;
unsigned long time,times,t;
 
void setup(){tft.reset();tft.begin(0x9341);Serial.begin(9600);
  tft.setRotation(1);tft.fillScreen(0x0000);tft.setTextColor(0xFFFF);;
   pinMode(13,INPUT);/// set
   pinMode(12,INPUT);/// menu
   pinMode(11,INPUT);/// +
   pinMode(10,INPUT);/// -
   vol = EEPROM.read(0);treb = EEPROM.read(1)-15;mid = EEPROM.read(2)-15;bass = EEPROM.read(3)-15;in = EEPROM.read(4);
   gain1 = EEPROM.read(5);gain2 = EEPROM.read(6);gain = EEPROM.read(7);
   lf = EEPROM.read(8);lt = EEPROM.read(9);rf = EEPROM.read(10);rt = EEPROM.read(11);sab = EEPROM.read(12);
   att_loun = EEPROM.read(13);s_loun = EEPROM.read(14);treb_c = EEPROM.read(15);middle_c = EEPROM.read(16);bass_c = EEPROM.read(17);
   sub_f = EEPROM.read(18);middle_q = EEPROM.read(19);bass_q = EEPROM.read(20);
   audio();
}
 
 void loop(){
  times=millis();
  tft.setTextColor(0xFFFF);;tft.setTextSize(1);
  pluse=digitalRead(11);minus=digitalRead(10);
 
  if(menu==0){}else{tft.setTextColor(0xcdcd);}tft.setCursor(10,5);tft.print("VOLUME");
  if(menu==1){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.setCursor(10,20);tft.print("TREBLE");
  if(menu==2){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.setCursor(10,35);tft.print("MIDDLE");
  if(menu==3){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.setCursor(10,50);tft.print("BASS");
 
  tft.drawFastHLine(5,65,310, 0xcdcd);tft.drawFastHLine(5,90,310, 0xcdcd);tft.drawFastHLine(5,115,310, 0xcdcd);tft.drawFastHLine(5,140,310, 0xcdcd);
 
  if(digitalRead(12)==HIGH){menu++; sbros();eeprom=1;time=millis();if(menu>3){menu=0;set=0;}}
  if(digitalRead(13)==HIGH){set++;sbros();eeprom=1;time=millis(); menu=100;if(set>15){set=0;menu=0;}}
 
  if(pluse==HIGH&&minus==HIGH){mute++;w=1;if(mute>1){mute=0;}}
 
  if(pluse==HIGH&&menu==0){vol++;eeprom=1;time=millis();if(vol>80){vol=80;}w=1;}
  if(minus==HIGH&&menu==0){vol--;eeprom=1;time=millis();if(vol<0){vol=0;}w=1;}
 
  if(pluse==HIGH&&menu==1){treb++;if(treb>15){treb=15;}w1=1;}
  if(minus==HIGH&&menu==1){treb--;if(treb<-15){treb=-15;}w1=1;}
 
  if(pluse==HIGH&&menu==2){mid++;if(mid>15){mid=15;}w2=1;}
  if(minus==HIGH&&menu==2){mid--;if(mid<-15){mid=-15;}w2=1;}
 
  if(pluse==HIGH&&menu==3){bass++;if(bass>15){bass=15;}w3=1;}
  if(minus==HIGH&&menu==3){bass--;if(bass<-15){bass=-15;}w3=1;}
 
  if(w==1){audio();
  for(i=0,i2=0;i<=80;i++,i2++){if(i2<vol){}else{i2=vol;} 
    if(mute==1){tft.drawFastHLine(i2*2+70,7,1, 0x07ff);}else{tft.drawFastHLine(i2*2+70,7,1, 0x0f800);}tft.drawFastHLine(i*2+72,7,1, 0xcdcd);
    if(mute==1){tft.drawFastHLine(i2*2+70,9,1, 0x07ff);}else{tft.drawFastHLine(i2*2+70,9,1, 0x0f800);}tft.drawFastHLine(i*2+72,9,1, 0xcdcd);
    if(mute==1){tft.drawFastHLine(i2*2+70,11,1, 0x07ff);}else{tft.drawFastHLine(i2*2+70,11,1, 0x0f800);}tft.drawFastHLine(i*2+72,11,1, 0xcdcd);
  }w=0;tft.setTextColor(0xF600);tft.fillRect(270, 0, 40, 15, 0x0000);tft.setCursor(270,5);tft.print(-80+vol);tft.setCursor(290,5);tft.print(" dB");}
 
  if(w1==1){audio();
  for(i=0,i2=0;i<=80;i++,i2++){i2=treb*2+40;
    tft.drawFastHLine(i*2+70,21,1, 0xcdcd);tft.drawFastHLine(i2*2+70,21,1, 0x07ff);tft.drawFastHLine(i*2+72,21,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,23,1, 0xcdcd);tft.drawFastHLine(i2*2+70,23,1, 0x07ff);tft.drawFastHLine(i*2+72,23,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,25,1, 0xcdcd);tft.drawFastHLine(i2*2+70,25,1, 0x07ff);tft.drawFastHLine(i*2+72,25,1, 0xcdcd);
  }w1=0;tft.setTextColor(0xF600);tft.fillRect(270, 15, 40, 15, 0x0000);tft.setCursor(270,20);tft.print(treb);tft.setCursor(290,20);tft.print(" dB");w1=0;}
 
 if(w2==1){audio();
  for(i=0,i2=0;i<=80;i++,i2++){i2=mid*2+40;
    tft.drawFastHLine(i*2+70,36,1, 0xcdcd);tft.drawFastHLine(i2*2+70,36,1, 0x07ff);tft.drawFastHLine(i*2+72,36,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,38,1, 0xcdcd);tft.drawFastHLine(i2*2+70,38,1, 0x07ff);tft.drawFastHLine(i*2+72,38,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,40,1, 0xcdcd);tft.drawFastHLine(i2*2+70,40,1, 0x07ff);tft.drawFastHLine(i*2+72,40,1, 0xcdcd);
  }w2=0;tft.setTextColor(0xF600);tft.fillRect(270, 30, 40, 15, 0x0000);tft.setCursor(270,35);tft.print(mid);tft.setCursor(290,35);tft.print(" dB");w2=0;}
 
 if(w3==1){audio();
  for(i=0,i2=0;i<=80;i++,i2++){i2=bass*2+40;
    tft.drawFastHLine(i*2+70,51,1, 0xcdcd);tft.drawFastHLine(i2*2+70,51,1, 0x07ff);tft.drawFastHLine(i*2+72,51,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,53,1, 0xcdcd);tft.drawFastHLine(i2*2+70,53,1, 0x07ff);tft.drawFastHLine(i*2+72,53,1, 0xcdcd);
    tft.drawFastHLine(i*2+70,55,1, 0xcdcd);tft.drawFastHLine(i2*2+70,55,1, 0x07ff);tft.drawFastHLine(i*2+72,55,1, 0xcdcd);
  }w3=0;tft.setTextColor(0xF600);tft.fillRect(270, 45, 40, 15, 0x0000);tft.setCursor(270,50);tft.print(bass);tft.setCursor(290,50);tft.print(" dB");w3=0;}
 ///////////////////////////////////////////////////////////input + gain//////////////////////////////////////////////////////////////////////////////////////////
   if(pluse==HIGH&&set==1){in++;if(in>3){in=3;}audio();w4=1;}
   if(minus==HIGH&&set==1){in--;if(in<1){in=1;}audio();w4=1;}
   tft.setCursor(10,75);if(set==1){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("INPUT: ");
   tft.setCursor(60,75);if(in==1&&set==1){tft.setTextColor(0xFFFF);}else if(in==1&&set!=1){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("IN 1");
   tft.setCursor(90,75);if(in==2&&set==1){tft.setTextColor(0xFFFF);}else if(in==2&&set!=1){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("IN 2");
   tft.setCursor(120,75);if(in==3&&set==1){tft.setTextColor(0xFFFF);}else if(in==3&&set!=1){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("IN 3");
   tft.setCursor(150,75);
   if(set==2){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}
   if(in==1){gain=gain1;tft.print("   GAIN IN 1");}
   if(in==2){gain=gain2;tft.print("   GAIN IN 2");}
   if(in==3){gain=gain3;tft.print("   GAIN IN 3");}
      if(pluse==HIGH&&set==2){gain++;if(gain>15){gain=15;}audio();w4=1;}
      if(minus==HIGH&&set==2){gain--;if(gain<0){gain=0;}audio();w4=1;}
   if(in==1){gain1=gain;}if(in==2){gain2=gain;}if(in==3){gain3=gain;}   
    if(w4==1){audio();
  for(i=0,i2=0;i<=15;i++,i2++){if(i2<gain){}else{i2=gain;}
    tft.drawFastHLine(i2*2+240,76,1, 0x07ff);tft.drawFastHLine(i*2+242,76,1, 0xcdcd);
    tft.drawFastHLine(i2*2+240,78,1, 0x07ff);tft.drawFastHLine(i*2+242,78,1, 0xcdcd);
    tft.drawFastHLine(i2*2+240,80,1, 0x07ff);tft.drawFastHLine(i*2+242,80,1, 0xcdcd);
  }w4=0;tft.fillRect(195, 75, 40, 10, 0x0000);}
   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   tft.setCursor(10,100);if(set==3){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("LF ");
   tft.setCursor(70,100);if(set==4){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("RF ");
   tft.setCursor(130,100);if(set==5){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("LT ");
   tft.setCursor(190,100);if(set==6){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("RT ");
   tft.setCursor(250,100);if(set==7){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("SUB");
   if(pluse==HIGH&&set==3){lf++;if(lf>30){lf=30;}audio();w5=1;}
   if(minus==HIGH&&set==3){lf--;if(lf<0){lf=0;}audio();w5=1;}
    if(w5==1){audio();
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<lf){}else{i2=lf;}
    tft.drawFastHLine(i2+30,101,1, 0xf800);tft.drawFastHLine(i+31,101,1, 0xcdcd);
    tft.drawFastHLine(i2+30,103,1, 0xf800);tft.drawFastHLine(i+31,103,1, 0xcdcd);
    tft.drawFastHLine(i2+30,105,1, 0xf800);tft.drawFastHLine(i+31,105,1, 0xcdcd);
  }w5=0;}
 
   if(pluse==HIGH&&set==4){rf++;if(rf>30){rf=30;}audio();w6=1;}
   if(minus==HIGH&&set==4){rf--;if(rf<0){rf=0;}audio();w6=1;}
    if(w6==1){audio();
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<rf){}else{i2=rf;}
    tft.drawFastHLine(i2+90,101,1, 0xf800);tft.drawFastHLine(i+91,101,1, 0xcdcd);
    tft.drawFastHLine(i2+90,103,1, 0xf800);tft.drawFastHLine(i+91,103,1, 0xcdcd);
    tft.drawFastHLine(i2+90,105,1, 0xf800);tft.drawFastHLine(i+91,105,1, 0xcdcd);
  }w6=0;}
 
   if(pluse==HIGH&&set==5){lt++;if(lt>30){lt=30;}audio();w7=1;}
   if(minus==HIGH&&set==5){lt--;if(lt<0){lt=0;}audio();w7=1;}
    if(w7==1){audio();
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<lt){}else{i2=lt;}
    tft.drawFastHLine(i2+150,101,1, 0xf800);tft.drawFastHLine(i+151,101,1, 0xcdcd);
    tft.drawFastHLine(i2+150,103,1, 0xf800);tft.drawFastHLine(i+151,103,1, 0xcdcd);
    tft.drawFastHLine(i2+150,105,1, 0xf800);tft.drawFastHLine(i+151,105,1, 0xcdcd);
  }w7=0;}
 
   if(pluse==HIGH&&set==6){rt++;if(rt>30){rt=30;}audio();w8=1;}
   if(minus==HIGH&&set==6){rt--;if(rt<0){rt=0;}audio();w8=1;}
    if(w8==1){audio();
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<rt){}else{i2=rt;}
    tft.drawFastHLine(i2+210,101,1, 0xf800);tft.drawFastHLine(i+211,101,1, 0xcdcd);
    tft.drawFastHLine(i2+210,103,1, 0xf800);tft.drawFastHLine(i+211,103,1, 0xcdcd);
    tft.drawFastHLine(i2+210,105,1, 0xf800);tft.drawFastHLine(i+211,105,1, 0xcdcd);
  }w8=0;}
 
   if(pluse==HIGH&&set==7){sab++;if(sab>30){sab=30;}audio();w9=1;}
   if(minus==HIGH&&set==7){sab--;if(sab<0){sab=0;}audio();w9=1;}
    if(w9==1){audio();
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<sab){}else{i2=sab;}
    tft.drawFastHLine(i2+275,101,1, 0xf800);tft.drawFastHLine(i+276,101,1, 0xcdcd);
    tft.drawFastHLine(i2+275,103,1, 0xf800);tft.drawFastHLine(i+276,103,1, 0xcdcd);
    tft.drawFastHLine(i2+275,105,1, 0xf800);tft.drawFastHLine(i+276,105,1, 0xcdcd);
  }w9=0;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////  
  tft.setCursor(10,125);if(set==8){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("LOUDNESS: ");
 
   if(pluse==HIGH&&set==8){att_loun++;if(att_loun>15){att_loun=15;}audio();w10=1;}
   if(minus==HIGH&&set==8){att_loun--;if(att_loun<0){att_loun=0;}audio();w10=1;}
    if(w10==1){
  for(i=0,i2=0;i<=30;i++,i2++){if(i2<att_loun){}else{i2=att_loun;}
    tft.drawFastHLine(i2+80,126,1, 0xf800);tft.drawFastHLine(i+82,126,1, 0xcdcd);
    tft.drawFastHLine(i2+80,128,1, 0xf800);tft.drawFastHLine(i+82,128,1, 0xcdcd);
    tft.drawFastHLine(i2+80,130,1, 0xf800);tft.drawFastHLine(i+82,130,1, 0xcdcd);
  }w10=0;}
 
   if(pluse==HIGH&&set==9){s_loun++;if(s_loun>3){s_loun=3;}audio();w11=1;}
   if(minus==HIGH&&set==9){s_loun--;if(s_loun<0){s_loun=0;}audio();w11=1;}
   if(w11==1){audio();
   tft.setCursor(130,125);if(s_loun==0&&set==9){tft.setTextColor(0xFFFF);}else if(s_loun==0&&set!=9){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("FLAT");
   tft.setCursor(175,125);if(s_loun==1&&set==9){tft.setTextColor(0xFFFF);}else if(s_loun==1&&set!=9){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("400Hz");
   tft.setCursor(225,125);if(s_loun==2&&set==9){tft.setTextColor(0xFFFF);}else if(s_loun==2&&set!=9){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("800Hz");
   tft.setCursor(275,125);if(s_loun==3&&set==9){tft.setTextColor(0xFFFF);}else if(s_loun==3&&set!=9){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("2400Hz");w11=0;}
/////////////////////////////////////////////////////////////////////////////////////////////////////  
   tft.setCursor(10,150);if(set==10){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("TREBLE CENTER: ");
    if(pluse==HIGH&&set==10){treb_c++;if(treb_c>3){treb_c=3;}audio();w12=1;}
    if(minus==HIGH&&set==10){treb_c--;if(treb_c<0){treb_c=0;}audio();w12=1;}
   if(w12==1){audio();
   tft.setCursor(110,150);if(treb_c==0&&set==10){tft.setTextColor(0xFFFF);}else if(treb_c==0&&set!=10){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("10KHz");
   tft.setCursor(160,150);if(treb_c==1&&set==10){tft.setTextColor(0xFFFF);}else if(treb_c==1&&set!=10){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("12.5kHz");
   tft.setCursor(220,150);if(treb_c==2&&set==10){tft.setTextColor(0xFFFF);}else if(treb_c==2&&set!=10){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("15kHz");
   tft.setCursor(270,150);if(treb_c==3&&set==10){tft.setTextColor(0xFFFF);}else if(treb_c==3&&set!=10){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("17.5kHz");w12=0;}
//////////////////////////////////////////////////////////////////////////////////////////////
   tft.setCursor(10,165);if(set==11){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("MIDDLE CENTER: ");
    if(pluse==HIGH&&set==11){middle_c++;if(middle_c>3){middle_c=3;}audio();w13=1;}
    if(minus==HIGH&&set==11){middle_c--;if(middle_c<0){middle_c=0;}audio();w13=1;}
   if(w13==1){audio();
   tft.setCursor(110,165);if(middle_c==0&&set==11){tft.setTextColor(0xFFFF);}else if(middle_c==0&&set!=11){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("0.5KHz");
   tft.setCursor(160,165);if(middle_c==1&&set==11){tft.setTextColor(0xFFFF);}else if(middle_c==1&&set!=11){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1kHz");
   tft.setCursor(220,165);if(middle_c==2&&set==11){tft.setTextColor(0xFFFF);}else if(middle_c==2&&set!=11){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.5kHz");
   tft.setCursor(270,165);if(middle_c==3&&set==11){tft.setTextColor(0xFFFF);}else if(middle_c==3&&set!=11){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("2.5kHz");w13=0;}
//////////////////////////////////////////////////////////////////////////////////////////////
   tft.setCursor(10,180);if(set==12){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("BASS CENTER: ");
    if(pluse==HIGH&&set==12){bass_c++;if(bass_c>3){bass_c=3;}audio();w14=1;}
    if(minus==HIGH&&set==12){bass_c--;if(bass_c<0){bass_c=0;}audio();w14=1;}
   if(w14==1){audio();
   tft.setCursor(110,180);if(bass_c==0&&set==12){tft.setTextColor(0xFFFF);}else if(bass_c==0&&set!=12){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("60Hz");
   tft.setCursor(160,180);if(bass_c==1&&set==12){tft.setTextColor(0xFFFF);}else if(bass_c==1&&set!=12){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("80Hz");
   tft.setCursor(220,180);if(bass_c==2&&set==12){tft.setTextColor(0xFFFF);}else if(bass_c==2&&set!=12){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("100Hz");
   tft.setCursor(270,180);if(bass_c==3&&set==12){tft.setTextColor(0xFFFF);}else if(bass_c==3&&set!=12){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("200Hz");w14=0;}
//////////////////////////////////////////////////////////////////////////////////////////////
    tft.setCursor(10,195);if(set==13){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("SUBWOOFER FREQ:");
    if(pluse==HIGH&&set==13){sub_f++;if(sub_f>3){sub_f=3;}audio();w15=1;}
    if(minus==HIGH&&set==13){sub_f--;if(sub_f<0){sub_f=0;}audio();w15=1;}
   if(w15==1){audio();
   tft.setCursor(110,195);if(sub_f==0&&set==13){tft.setTextColor(0xFFFF);}else if(sub_f==0&&set!=13){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("FLAT");
   tft.setCursor(160,195);if(sub_f==1&&set==13){tft.setTextColor(0xFFFF);}else if(sub_f==1&&set!=13){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("80Hz");
   tft.setCursor(220,195);if(sub_f==2&&set==13){tft.setTextColor(0xFFFF);}else if(sub_f==2&&set!=13){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("120Hz");
   tft.setCursor(270,195);if(sub_f==3&&set==13){tft.setTextColor(0xFFFF);}else if(sub_f==3&&set!=13){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("160Hz");w15=0;}
 
//////////////////////////////////////////////////////middle q factor////////////////////////////////////////
    tft.setCursor(10,210);if(set==14){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("MIDDLE Q FACTOR:");
    if(pluse==HIGH&&set==14){middle_q++;if(middle_q>3){middle_q=3;}audio();w16=1;}
    if(minus==HIGH&&set==14){middle_q--;if(middle_q<0){middle_q=0;}audio();w16=1;}
   if(w16==1){audio();
   tft.setCursor(110,210);if(middle_q==0&&set==14){tft.setTextColor(0xFFFF);}else if(middle_q==0&&set!=14){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("0.5");
   tft.setCursor(160,210);if(middle_q==1&&set==14){tft.setTextColor(0xFFFF);}else if(middle_q==1&&set!=14){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("0.75");
   tft.setCursor(220,210);if(middle_q==2&&set==14){tft.setTextColor(0xFFFF);}else if(middle_q==2&&set!=14){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.0");
   tft.setCursor(270,210);if(middle_q==3&&set==14){tft.setTextColor(0xFFFF);}else if(middle_q==3&&set!=14){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.25");w16=0;}
 
 //////////////////////////////////////////////////bass q factor////////////////////////////////////////////
    tft.setCursor(10,225);if(set==15){tft.setTextColor(0xFFFF);}else{tft.setTextColor(0xcdcd);}tft.print("BASS Q FACTOR:");
    if(pluse==HIGH&&set==15){bass_q++;if(bass_q>3){bass_q=3;}audio();w17=1;}
    if(minus==HIGH&&set==15){bass_q--;if(bass_q<0){bass_q=0;}audio();w17=1;}
   if(w17==1){audio();
   tft.setCursor(110,225);if(bass_q==0&&set==15){tft.setTextColor(0xFFFF);}else if(bass_q==0&&set!=15){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.0");
   tft.setCursor(160,225);if(bass_q==1&&set==15){tft.setTextColor(0xFFFF);}else if(bass_q==1&&set!=15){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.25");
   tft.setCursor(220,225);if(bass_q==2&&set==15){tft.setTextColor(0xFFFF);}else if(bass_q==2&&set!=15){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("1.5");
   tft.setCursor(270,225);if(bass_q==3&&set==15){tft.setTextColor(0xFFFF);}else if(bass_q==3&&set!=15){tft.setTextColor(0xF600);}else{tft.setTextColor(0xcdcd);}tft.print("2.0");w17=0;}
 
   if(millis()-time>1000 && eeprom==1){
    EEPROM.update(0,vol);EEPROM.update(1,treb+15);EEPROM.update(2,mid+15);EEPROM.update(3,bass+15);EEPROM.update(4,in);
    EEPROM.update(5,gain1);EEPROM.update(6,gain2);EEPROM.update(7,gain3);
    EEPROM.update(8,lf);EEPROM.update(9,lt);EEPROM.update(10,rf);EEPROM.update(11,rt);EEPROM.update(12,sab);
    EEPROM.update(13,att_loun);EEPROM.update(14,s_loun);EEPROM.update(15,treb_c);EEPROM.update(16,middle_c);EEPROM.update(17,bass_c);
    EEPROM.update(18,sub_f);EEPROM.update(19,middle_q);EEPROM.update(20,bass_q);
    eeprom=0;}
    times=millis()-times;
    Serial.println(times);
 }//loop
 void sbros(){w10=1,w11=1,w12=1,w13=1,w14=1,w15=1,w16=1;w17=1;}
 void audio(){
tda.setInput(in,gain,0);    //вх1=1, вх2=2, вх3=3
tda.setInput2(2,0,0);   // не используется
tda.setAtt_loudness(att_loun,s_loun,0,0);
tda.setSoft(mute,0,0,0,0);//mute off (не менять)
tda.setVolume(vol-79,0);   // общая громкость от 0 до 79 макс
tda.setAtt_LF(79-lf,0);   // гром. лк фронт
tda.setAtt_RF(79-rf,0);   // гром. пк фронт
tda.setAtt_LT(79-lt,0);   // гром. лк тыл
tda.setAtt_RT(79-rt,0);   // гром. пк тыл
tda.setAtt_SUB(79-sab,0);  // гром. савбуфер
tda.setAtt_Mix(79,0);   // не используется
tda.setFilter_Treble(treb,treb_c,0); 
tda.setFilter_Middle(mid,middle_q,0);
tda.setFilter_Bass(bass,bass_q,0);
tda.setSub_M_B(sub_f,middle_c,bass_c,0,0);
tda.setMix_Gain_Eff(1,0,0,0,0); // не используется
tda.setSpektor(0,0,0,0,0,0,0);
}

2

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

С энкодером и ИК правлением могу помочь, с дисплеем 480x320 не смогу помочь, у меня нет такого.

3

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

PT2314 у Вас еще не активен в скетче?

4

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

У Вас аудиопроцессор работает? Звук есть?
В функции audio() в скетче стоят значения:

  pt.setVolume(10); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(0); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(0); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(0, 1, 0);
  // input      int 0..2 === IN 1...3 (выбор стереовхода (у автора небольшая ошибка rt2314 имеет 4 стереовхода на моей плате они пронумерованы :l1-r1; l2-r2 и т.д.)
  // loudness   int 0...1 === 1-on 0-off (расширение стереобазы)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(2);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(7); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)

Вам их надо заменить на переменные которые регулируете:

  pt.setVolume(vol); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(lf); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(rf); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(in, att_loun, gain);
  // input      int 0..2 === IN 1...3 (выбор стереовхода (у автора небольшая ошибка rt2314 имеет 4 стереовхода на моей плате они пронумерованы :l1-r1; l2-r2 и т.д.)
  // loudness   int 0...1 === 1-on 0-off (расширение стереобазы)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)

5

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Рекомендованное напряжение питания 9 В

6

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

#include <Wire.h> 
#include <PT2314.h>

PT2314 pt;

void setup() {
     audio();
}

void loop() {
}

void audio(){
  pt.setVolume(55); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(0); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)   
  pt.setAttR(0); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(0, 1, 0); 
        // input      int 0..3 === IN 1...4 
        // loudness   int 0...1 === 1-on 0-off (расширение стереобазы)
        // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(2);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(7); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)
  }

7

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Загрузите I2C сканер, посмотрите определяется ли адрес микросхемы - http://forum.rcl-radio.ru/viewtopic.php?id=64
Должен быть 0x44

8

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Я добавил в скетч пример регулировки громкости с пульта. Откройте монитор порта получите свои коды кнопок VOL++ и VOL --.

ИК датчик на D6

#define VOL_PLUSE 0x2FDB04F // укажите свой код кнопки
#define VOL_MINUS 0x2FDB04F

#include <Wire.h>
#include <SPI.h>
#include <EEPROM.h>
#include <PT2314.h>
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#include <Encoder.h>
#include <boarddefs.h>
#include <IRremote.h>          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <Fonts/FreeMonoBoldOblique9pt7b.h>
PT2314 pt;                 //Выход ИМС SDA и SCL подключаются к аналоговым входам платы Arduino А4 и А5
IRrecv irrecv(6); // указываем вывод модуля IR приемника
decode_results ir; 
#define TFT_DC 9
#define TFT_CS 10
//Encoder myEnc(6, 7);// DT, CLK
ILI9488 tft = ILI9488(TFT_CS, TFT_DC);// Подключения дисплея RESET-8 DC-9 CS-10 CDI(MOSI)-11 SDO(MISO)-12 SCLK-13
int menu, pluse, minus, mute = 1;
int i, i2, vol = 50, set, treb, bass, in, gain, gain1, gain2, gain3, gain4, lf, rf, att_loun;
byte eeprom;
int  w = 1, w1 = 1, w2 = 1, w3 = 1, w4 = 1, w5 = 1, w6 = 1;//w-vol w1-tre w2-bas w3-in w4-lf w5-rf w6-loun
unsigned long time, times, t;
byte gr1,gr2;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);
  tft.begin(); Serial.begin(9600);
  tft.setRotation(1); tft.fillScreen(0x39E9); tft.setTextColor(ILI9488_WHITE); tft.setFont(&FreeMonoBoldOblique9pt7b);
  pinMode(2, INPUT); /// set
  pinMode(3, INPUT); /// menu
  pinMode(4, INPUT); /// +
  pinMode(5, INPUT); /// -
  // pinMode(A0, INPUT); // МЕНЮ КНОПКА SW энкодера
  vol = EEPROM.read(0); treb = EEPROM.read(1) - 15; bass = EEPROM.read(2) - 15; in = EEPROM.read(3);
  gain1 = EEPROM.read(4); gain2 = EEPROM.read(5); gain3 = EEPROM.read(6); gain4 = EEPROM.read(7); gain = EEPROM.read(8);
  lf = EEPROM.read(9); rf = EEPROM.read(10);
  att_loun = EEPROM.read(11);
  audio();
}

void loop() {
    /// IR
  if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();time=millis();}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
  if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта  
  
  times = millis();
  tft.setTextColor(ILI9488_WHITE);; tft.setTextSize(1);
  pluse = digitalRead(4); minus = digitalRead(5);
  tft.setTextColor(0xcdcd);
  tft.setCursor(170, 12); tft.print("Audio Sistem");              // название системы
  ////////////////////////////////////////////////////////////////////////////////////////////
  if (menu == 0) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 42); tft.print("VOLUME");
  if (menu == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 67); tft.print("TREBLE");

  if (menu == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 92); tft.print("BASS");

  // разделительные линии
  tft.drawFastHLine(5, 105, 470, 0xcdcd); tft.drawFastHLine(5, 163, 470, 0xcdcd); tft.drawFastHLine(5, 192, 470, 0xcdcd); //tft.drawFastHLine(5, 140, 470, 0xcdcd);

  if (digitalRead(3) == HIGH) {
    menu++;

    eeprom = 1;
    time = millis();
    if (menu > 2) {
      menu = 0;
      set = 0;
    }
  }
  if (digitalRead(2) == HIGH) {
    set++;
    eeprom = 1;
    time = millis();
    menu = 100;
    if (set > 5) {
      set = 0;
      menu = 0;
    }
  }

  if (pluse == HIGH && minus == HIGH) {
    mute++;
    w = 1;
    if (mute > 1) {
      mute = 0;
    }
  }

  if (pluse == HIGH && menu == 0) {
   if(ir.value==VOL_PLUSE){vol++;gr1=1;gr2=0;cl1();time=millis();w =1;if(vol > 55){vol = 55;}}// кнопка > 
   if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();time=millis();w=1;if(vol > 55){vol = 55;}}// кнопка >>>>>>
  
    vol++;
    eeprom = 1;
    time = millis();
    if (vol > 55) {
      vol = 55;
    } w = 1;
  }
  if (minus == HIGH && menu == 0) { 
   if(ir.value==VOL_MINUS){vol--;gr1=1;gr2=0;cl1();time=millis();w =1;if(vol < 0){vol = 0;}}// кнопка > 
   if(ir.value==0xFFFFFFFF and gr1==1){vol--;gr2=0;cl1();time=millis();w=1;if(vol < 0){vol = 0;}}// кнопка >>>>>>
    vol--;
    eeprom = 1;
    time = millis();
    if (vol < 0) {
      vol = 0;
    } w = 1;
  }

  if (pluse == HIGH && menu == 1) {
    treb++;
    if (treb > 7) {
      treb = 7;
    } w1 = 1;
  }
  if (minus == HIGH && menu == 1) {
    treb--;
    if (treb < -7) {
      treb = -7;
    } w1 = 1;
  }
  if (pluse == HIGH && menu == 2) {
    bass++;
    if (bass > 7) {
      bass = 7;
    } w2 = 1;
  }
  if (minus == HIGH && menu == 2) {
    bass--;
    if (bass < -7) {
      bass = -7;
    } w2 = 1;
  }

  if (w == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 58; i++, i2++) {
      if (i2 < vol) {} else {
        i2 = vol;
      }
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 31, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 33, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 35, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 37, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 39, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 41, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 43, 10, 0xcdcd);
    } w = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 30, 42, 15, 0x39E9); tft.setCursor(413, 42); tft.print(-55 + vol); tft.setCursor(442, 42); tft.print(" dB");
  }

  if (w1 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = treb * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 56, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 58, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 60, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 62, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 64, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 66, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 68, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd);
    } w1 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 55, 40, 15, 0x39E9); tft.setCursor(413, 67); tft.print(treb); tft.setCursor(442, 67); tft.print(" dB"); w1 = 0;
  }

  if (w2 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = bass * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 81, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 83, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 85, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 87, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 89, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 91, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 93, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd);
    } w2 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 80, 40, 15, 0x39E9); tft.setCursor(413, 92); tft.print(bass); tft.setCursor(442, 92); tft.print(" dB"); w2 = 0;
  }
  ///////////////////////////////////////////////////////////input + gain//////////////////////////////////////////////////////////////////////////////////////////
  if (pluse == HIGH && set == 1) {
    in++;
    if (in > 4) {
      in = 4;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 1) {
    in--;
    if (in < 1) {
      in = 1;
    } audio();
    w3 = 1;
  }
  tft.setCursor(5, 127); if (set == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("INPUT: ");
  tft.setCursor(110, 127); if (in == 1 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 1 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 1");
  tft.setCursor(210, 127); if (in == 2 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 2 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 2");
  tft.setCursor(310, 127); if (in == 3 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 3 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 3");
  tft.setCursor(410, 127); if (in == 4 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 4 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 4");
  tft.setCursor(5, 152);
  if (set == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  }
  if (in == 1) {
    gain = gain1;
    tft.print("GAIN IN 1");                                        //Чуствительность входа
  }
  if (in == 2) {
    gain = gain2;
    tft.print("GAIN IN 2");
  }
  if (in == 3) {
    gain = gain3;
    tft.print("GAIN IN 3");
  }
  if (in == 4) {
    gain = gain4;
    tft.print("GAIN IN 4");
  }
  if (pluse == HIGH && set == 2) {
    gain++;
    if (gain > 15) {
      gain = 15;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 2) {
    gain--;
    if (gain < 0) {
      gain = 0;
    } audio();
    w3 = 1;
  }
  if (in == 1) {
    gain1 = gain;
  } if (in == 2) {
    gain2 = gain;
  } if (in == 3) {
    gain3 = gain;
  }
  if (in == 4) {
    gain4 = gain;
  }
  if (w3 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 15; i++, i2++) {
      if (i2 < gain) {} else {
        i2 = gain;
      }
      tft.drawFastHLine(i2 * 4 + 120, 141, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 141, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 143, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 143, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 145, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 145, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 147, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 147, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 149, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 149, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 151, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 151, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 153, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 153, 10, 0xcdcd);
    } w3 = 0; tft.fillRect(93, 140, 15, 15, 0x39E9);
  }
  /////////////////////////////баланс////////////////////////////////////////////////////////////
  tft.setCursor(210, 152); if (set == 3) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LF ");
  tft.setCursor(310, 152); if (set == 4) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("RF ");

  if (pluse == HIGH && set == 3) {
    lf++;
    if (lf > 30) {
      lf = 30;
    } audio();
    w4 = 1;
  }
  if (minus == HIGH && set == 3) {
    lf--;
    if (lf < 0) {
      lf = 0;
    } audio();
    w4 = 1;
  }
  if (w4 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < lf) {} else {
        i2 = lf;
      }
      tft.drawFastHLine(i2 + 245, 141, 1, 0x000F); tft.drawFastHLine(i + 246, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 143, 1, 0x000F); tft.drawFastHLine(i + 246, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 145, 1, 0x000F); tft.drawFastHLine(i + 246, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 147, 1, 0x000F); tft.drawFastHLine(i + 246, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 149, 1, 0x000F); tft.drawFastHLine(i + 246, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 151, 1, 0x000F); tft.drawFastHLine(i + 246, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 153, 1, 0x000F); tft.drawFastHLine(i + 246, 153, 1, 0xcdcd);
    } w4 = 0;
  }

  if (pluse == HIGH && set == 4) {
    rf++;
    if (rf > 30) {
      rf = 30;
    } audio();
    w5 = 1;
  }
  if (minus == HIGH && set == 4) {
    rf--;
    if (rf < 0) {
      rf = 0;
    } audio();
    w5 = 1;
  }
  if (w5 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < rf) {} else {
        i2 = rf;
      }
      tft.drawFastHLine(i2 + 345, 141, 1, 0x000F); tft.drawFastHLine(i + 346, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 143, 1, 0x000F); tft.drawFastHLine(i + 346, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 145, 1, 0x000F); tft.drawFastHLine(i + 346, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 147, 1, 0x000F); tft.drawFastHLine(i + 346, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 149, 1, 0x000F); tft.drawFastHLine(i + 346, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 151, 1, 0x000F); tft.drawFastHLine(i + 346, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 153, 1, 0x000F); tft.drawFastHLine(i + 346, 153, 1, 0xcdcd);
    } w5 = 0;
  }
  ///////////////////////////////////////тонокомпенсация//////////////////////////////////////////////////////////////////
  tft.setCursor(5, 182); if (set == 5) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LOUDNESS: ");

  if (pluse == HIGH && set == 5) {
    att_loun++;
    if (att_loun > 14) {
      att_loun = 14;
    } audio();
    w6 = 1;
  }
  if (minus == HIGH && set == 5) {
    att_loun--;
    if (att_loun < 0) {
      att_loun = 0;
    } audio();
    w6 = 1;
  }
  if (w6 == 1) {
    for (i = 0, i2 = 0; i <= 14; i++, i2++) {
      if (i2 < att_loun) {} else {
        i2 = att_loun;
      }
      tft.drawFastHLine(i2 + 115, 170, 1, 0xf800); tft.drawFastHLine(i + 116, 170, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 172, 1, 0xf800); tft.drawFastHLine(i + 116, 172, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 174, 1, 0xf800); tft.drawFastHLine(i + 116, 174, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 176, 1, 0xf800); tft.drawFastHLine(i + 116, 176, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 178, 1, 0xf800); tft.drawFastHLine(i + 116, 178, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 180, 1, 0xf800); tft.drawFastHLine(i + 116, 180, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 182, 1, 0xf800); tft.drawFastHLine(i + 116, 182, 1, 0xcdcd);
    } w6 = 0;
  }
  if (millis() - time > 1000 && eeprom == 1) {
    EEPROM.update(0, vol); EEPROM.update(1, treb + 15); EEPROM.update(2, bass + 15); EEPROM.update(3, in);
    EEPROM.update(4, gain1); EEPROM.update(5, gain2); EEPROM.update(6, gain3); EEPROM.update(7, gain4);
    EEPROM.update(8, gain); EEPROM.update(9, lf); EEPROM.update(10, rf); EEPROM.update(11, att_loun);

    eeprom = 0;
  }
  times = millis() - times;
  Serial.println(times);
}                              //loop
void audio() {
  pt.setVolume(vol); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(lf); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(rf); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(in, att_loun, gain);
  // input      int 0..2 === IN 1...3 (выбор стереовхода 4)
  // loudness   int 0...1 === 1-on 0-off (тонокомпесация)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)
}

void cl1(){ir.value=0;delay(300);}

9

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

#define VOL_PLUSE 0x2FDB04F // укажите свой код кнопки
#define VOL_MINUS 0x2FDB04F

#include <Wire.h>
#include <SPI.h>
#include <EEPROM.h>
#include <PT2314.h>
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#include <Encoder.h>
#include <boarddefs.h>
#include <IRremote.h>          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <Fonts/FreeMonoBoldOblique9pt7b.h>
PT2314 pt;                 //Выход ИМС SDA и SCL подключаются к аналоговым входам платы Arduino А4 и А5
IRrecv irrecv(6); // указываем вывод модуля IR приемника
decode_results ir; 
#define TFT_DC 9
#define TFT_CS 10
//Encoder myEnc(6, 7);// DT, CLK
ILI9488 tft = ILI9488(TFT_CS, TFT_DC);// Подключения дисплея RESET-8 DC-9 CS-10 CDI(MOSI)-11 SDO(MISO)-12 SCLK-13
int menu, pluse, minus, mute = 1;
int i, i2, vol = 50, set, treb, bass, in, gain, gain1, gain2, gain3, gain4, lf, rf, att_loun;
byte eeprom;
int  w = 1, w1 = 1, w2 = 1, w3 = 1, w4 = 1, w5 = 1, w6 = 1;//w-vol w1-tre w2-bas w3-in w4-lf w5-rf w6-loun
unsigned long time, times, t;
byte gr1,gr2;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);
  tft.begin(); Serial.begin(9600);
  tft.setRotation(1); tft.fillScreen(0x39E9); tft.setTextColor(ILI9488_WHITE); tft.setFont(&FreeMonoBoldOblique9pt7b);
  pinMode(2, INPUT); /// set
  pinMode(3, INPUT); /// menu
  pinMode(4, INPUT); /// +
  pinMode(5, INPUT); /// -
  // pinMode(A0, INPUT); // МЕНЮ КНОПКА SW энкодера
  vol = EEPROM.read(0); treb = EEPROM.read(1) - 15; bass = EEPROM.read(2) - 15; in = EEPROM.read(3);
  gain1 = EEPROM.read(4); gain2 = EEPROM.read(5); gain3 = EEPROM.read(6); gain4 = EEPROM.read(7); gain = EEPROM.read(8);
  lf = EEPROM.read(9); rf = EEPROM.read(10);
  att_loun = EEPROM.read(11);
  audio();
}

void loop() {
    /// IR
  if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();time=millis();}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
  if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта  
  
  times = millis();
  tft.setTextColor(ILI9488_WHITE);; tft.setTextSize(1);
  pluse = digitalRead(4); minus = digitalRead(5);
  tft.setTextColor(0xcdcd);
  tft.setCursor(170, 12); tft.print("Audio Sistem");              // название системы
  ////////////////////////////////////////////////////////////////////////////////////////////
  if (menu == 0) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 42); tft.print("VOLUME");
  if (menu == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 67); tft.print("TREBLE");

  if (menu == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 92); tft.print("BASS");

  // разделительные линии
  tft.drawFastHLine(5, 105, 470, 0xcdcd); tft.drawFastHLine(5, 163, 470, 0xcdcd); tft.drawFastHLine(5, 192, 470, 0xcdcd); //tft.drawFastHLine(5, 140, 470, 0xcdcd);

  if (digitalRead(3) == HIGH) {
    menu++;

    eeprom = 1;
    time = millis();
    if (menu > 2) {
      menu = 0;
      set = 0;
    }
  }
  if (digitalRead(2) == HIGH) {
    set++;
    eeprom = 1;
    time = millis();
    menu = 100;
    if (set > 5) {
      set = 0;
      menu = 0;
    }
  }

  if (pluse == HIGH && minus == HIGH) {
    mute++;
    w = 1;
    if (mute > 1) {
      mute = 0;
    }
  }
   
  if(ir.value==VOL_PLUSE){vol++;gr1=1;gr2=0;cl1();time=millis();w =1;if(vol > 55){vol = 55;}}// кнопка > 
  if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();time=millis();w=1;if(vol > 55){vol = 55;}}// кнопка >>>>>>
  if(ir.value==VOL_MINUS){vol--;gr1=1;gr2=0;cl1();time=millis();w =1;if(vol < 0){vol = 0;}}// кнопка > 
  if(ir.value==0xFFFFFFFF and gr1==1){vol--;gr2=0;cl1();time=millis();w=1;if(vol < 0){vol = 0;}}// кнопка >>>>>>
  
  if (pluse == HIGH && menu == 0) { 
    vol++;
    eeprom = 1;
    time = millis();
    if (vol > 55) {
      vol = 55;
    } w = 1;
  }
  if (minus == HIGH && menu == 0) { 

    vol--;
    eeprom = 1;
    time = millis();
    if (vol < 0) {
      vol = 0;
    } w = 1;
  }

  if (pluse == HIGH && menu == 1) {
    treb++;
    if (treb > 7) {
      treb = 7;
    } w1 = 1;
  }
  if (minus == HIGH && menu == 1) {
    treb--;
    if (treb < -7) {
      treb = -7;
    } w1 = 1;
  }
  if (pluse == HIGH && menu == 2) {
    bass++;
    if (bass > 7) {
      bass = 7;
    } w2 = 1;
  }
  if (minus == HIGH && menu == 2) {
    bass--;
    if (bass < -7) {
      bass = -7;
    } w2 = 1;
  }

  if (w == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 58; i++, i2++) {
      if (i2 < vol) {} else {
        i2 = vol;
      }
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 31, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 33, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 35, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 37, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 39, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 41, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 43, 10, 0xcdcd);
    } w = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 30, 42, 15, 0x39E9); tft.setCursor(413, 42); tft.print(-55 + vol); tft.setCursor(442, 42); tft.print(" dB");
  }

  if (w1 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = treb * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 56, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 58, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 60, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 62, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 64, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 66, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 68, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd);
    } w1 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 55, 40, 15, 0x39E9); tft.setCursor(413, 67); tft.print(treb); tft.setCursor(442, 67); tft.print(" dB"); w1 = 0;
  }

  if (w2 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = bass * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 81, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 83, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 85, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 87, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 89, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 91, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 93, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd);
    } w2 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 80, 40, 15, 0x39E9); tft.setCursor(413, 92); tft.print(bass); tft.setCursor(442, 92); tft.print(" dB"); w2 = 0;
  }
  ///////////////////////////////////////////////////////////input + gain//////////////////////////////////////////////////////////////////////////////////////////
  if (pluse == HIGH && set == 1) {
    in++;
    if (in > 4) {
      in = 4;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 1) {
    in--;
    if (in < 1) {
      in = 1;
    } audio();
    w3 = 1;
  }
  tft.setCursor(5, 127); if (set == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("INPUT: ");
  tft.setCursor(110, 127); if (in == 1 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 1 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 1");
  tft.setCursor(210, 127); if (in == 2 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 2 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 2");
  tft.setCursor(310, 127); if (in == 3 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 3 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 3");
  tft.setCursor(410, 127); if (in == 4 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 4 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 4");
  tft.setCursor(5, 152);
  if (set == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  }
  if (in == 1) {
    gain = gain1;
    tft.print("GAIN IN 1");                                        //Чуствительность входа
  }
  if (in == 2) {
    gain = gain2;
    tft.print("GAIN IN 2");
  }
  if (in == 3) {
    gain = gain3;
    tft.print("GAIN IN 3");
  }
  if (in == 4) {
    gain = gain4;
    tft.print("GAIN IN 4");
  }
  if (pluse == HIGH && set == 2) {
    gain++;
    if (gain > 15) {
      gain = 15;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 2) {
    gain--;
    if (gain < 0) {
      gain = 0;
    } audio();
    w3 = 1;
  }
  if (in == 1) {
    gain1 = gain;
  } if (in == 2) {
    gain2 = gain;
  } if (in == 3) {
    gain3 = gain;
  }
  if (in == 4) {
    gain4 = gain;
  }
  if (w3 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 15; i++, i2++) {
      if (i2 < gain) {} else {
        i2 = gain;
      }
      tft.drawFastHLine(i2 * 4 + 120, 141, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 141, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 143, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 143, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 145, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 145, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 147, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 147, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 149, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 149, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 151, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 151, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 153, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 153, 10, 0xcdcd);
    } w3 = 0; tft.fillRect(93, 140, 15, 15, 0x39E9);
  }
  /////////////////////////////баланс////////////////////////////////////////////////////////////
  tft.setCursor(210, 152); if (set == 3) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LF ");
  tft.setCursor(310, 152); if (set == 4) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("RF ");

  if (pluse == HIGH && set == 3) {
    lf++;
    if (lf > 30) {
      lf = 30;
    } audio();
    w4 = 1;
  }
  if (minus == HIGH && set == 3) {
    lf--;
    if (lf < 0) {
      lf = 0;
    } audio();
    w4 = 1;
  }
  if (w4 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < lf) {} else {
        i2 = lf;
      }
      tft.drawFastHLine(i2 + 245, 141, 1, 0x000F); tft.drawFastHLine(i + 246, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 143, 1, 0x000F); tft.drawFastHLine(i + 246, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 145, 1, 0x000F); tft.drawFastHLine(i + 246, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 147, 1, 0x000F); tft.drawFastHLine(i + 246, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 149, 1, 0x000F); tft.drawFastHLine(i + 246, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 151, 1, 0x000F); tft.drawFastHLine(i + 246, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 153, 1, 0x000F); tft.drawFastHLine(i + 246, 153, 1, 0xcdcd);
    } w4 = 0;
  }

  if (pluse == HIGH && set == 4) {
    rf++;
    if (rf > 30) {
      rf = 30;
    } audio();
    w5 = 1;
  }
  if (minus == HIGH && set == 4) {
    rf--;
    if (rf < 0) {
      rf = 0;
    } audio();
    w5 = 1;
  }
  if (w5 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < rf) {} else {
        i2 = rf;
      }
      tft.drawFastHLine(i2 + 345, 141, 1, 0x000F); tft.drawFastHLine(i + 346, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 143, 1, 0x000F); tft.drawFastHLine(i + 346, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 145, 1, 0x000F); tft.drawFastHLine(i + 346, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 147, 1, 0x000F); tft.drawFastHLine(i + 346, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 149, 1, 0x000F); tft.drawFastHLine(i + 346, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 151, 1, 0x000F); tft.drawFastHLine(i + 346, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 153, 1, 0x000F); tft.drawFastHLine(i + 346, 153, 1, 0xcdcd);
    } w5 = 0;
  }
  ///////////////////////////////////////тонокомпенсация//////////////////////////////////////////////////////////////////
  tft.setCursor(5, 182); if (set == 5) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LOUDNESS: ");

  if (pluse == HIGH && set == 5) {
    att_loun++;
    if (att_loun > 14) {
      att_loun = 14;
    } audio();
    w6 = 1;
  }
  if (minus == HIGH && set == 5) {
    att_loun--;
    if (att_loun < 0) {
      att_loun = 0;
    } audio();
    w6 = 1;
  }
  if (w6 == 1) {
    for (i = 0, i2 = 0; i <= 14; i++, i2++) {
      if (i2 < att_loun) {} else {
        i2 = att_loun;
      }
      tft.drawFastHLine(i2 + 115, 170, 1, 0xf800); tft.drawFastHLine(i + 116, 170, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 172, 1, 0xf800); tft.drawFastHLine(i + 116, 172, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 174, 1, 0xf800); tft.drawFastHLine(i + 116, 174, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 176, 1, 0xf800); tft.drawFastHLine(i + 116, 176, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 178, 1, 0xf800); tft.drawFastHLine(i + 116, 178, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 180, 1, 0xf800); tft.drawFastHLine(i + 116, 180, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 182, 1, 0xf800); tft.drawFastHLine(i + 116, 182, 1, 0xcdcd);
    } w6 = 0;
  }
  if (millis() - time > 1000 && eeprom == 1) {
    EEPROM.update(0, vol); EEPROM.update(1, treb + 15); EEPROM.update(2, bass + 15); EEPROM.update(3, in);
    EEPROM.update(4, gain1); EEPROM.update(5, gain2); EEPROM.update(6, gain3); EEPROM.update(7, gain4);
    EEPROM.update(8, gain); EEPROM.update(9, lf); EEPROM.update(10, rf); EEPROM.update(11, att_loun);

    eeprom = 0;
  }
  times = millis() - times;
  Serial.println(times);
}                              //loop
void audio() {
  pt.setVolume(vol); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(lf); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(rf); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(in, att_loun, gain);
  // input      int 0..2 === IN 1...3 (выбор стереовхода 4)
  // loudness   int 0...1 === 1-on 0-off (тонокомпесация)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)
}

void cl1(){ir.value=0;delay(300);}

10

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Именно так и задумано.

11

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Смысл в чём ?

При регулировке громкости, что бы постоянно не нажимать кнопку, можно нажать и удерживать ее.

12

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Разогнать экран не получится, я Вас предупреждал что на ардуино будет притормаживать, можно взять stm32, на ней будет все быстро работать.

13

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Я поправил, сейчас должно работать правильно:

#define VOL_PLUSE 0x2FDB04F // укажите свой код кнопки
#define VOL_MINUS 0x2FDB04F

#include <Wire.h>
#include <SPI.h>
#include <EEPROM.h>
#include <PT2314.h>
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#include <Encoder.h>
#include <boarddefs.h>
#include <IRremote.h>          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <Fonts/FreeMonoBoldOblique9pt7b.h>
PT2314 pt;                 //Выход ИМС SDA и SCL подключаются к аналоговым входам платы Arduino А4 и А5
IRrecv irrecv(6); // указываем вывод модуля IR приемника
decode_results ir; 
#define TFT_DC 9
#define TFT_CS 10
//Encoder myEnc(6, 7);// DT, CLK
ILI9488 tft = ILI9488(TFT_CS, TFT_DC);// Подключения дисплея RESET-8 DC-9 CS-10 CDI(MOSI)-11 SDO(MISO)-12 SCLK-13
int menu, pluse, minus, mute = 1;
int i, i2, vol = 50, set, treb, bass, in, gain, gain1, gain2, gain3, gain4, lf, rf, att_loun;
byte eeprom;
int  w = 1, w1 = 1, w2 = 1, w3 = 1, w4 = 1, w5 = 1, w6 = 1;//w-vol w1-tre w2-bas w3-in w4-lf w5-rf w6-loun
unsigned long time, times, t;
byte gr1,gr2;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);
  tft.begin(); Serial.begin(9600);
  tft.setRotation(1); tft.fillScreen(0x39E9); tft.setTextColor(ILI9488_WHITE); tft.setFont(&FreeMonoBoldOblique9pt7b);
  pinMode(2, INPUT); /// set
  pinMode(3, INPUT); /// menu
  pinMode(4, INPUT); /// +
  pinMode(5, INPUT); /// -
  // pinMode(A0, INPUT); // МЕНЮ КНОПКА SW энкодера
  vol = EEPROM.read(0); treb = EEPROM.read(1) - 15; bass = EEPROM.read(2) - 15; in = EEPROM.read(3);
  gain1 = EEPROM.read(4); gain2 = EEPROM.read(5); gain3 = EEPROM.read(6); gain4 = EEPROM.read(7); gain = EEPROM.read(8);
  lf = EEPROM.read(9); rf = EEPROM.read(10);
  att_loun = EEPROM.read(11);
  audio();
}

void loop() {
    /// IR
  if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();time=millis();}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
  if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта  
  
  times = millis();
  tft.setTextColor(ILI9488_WHITE);; tft.setTextSize(1);
  pluse = digitalRead(4); minus = digitalRead(5);
  tft.setTextColor(0xcdcd);
  tft.setCursor(170, 12); tft.print("Audio Sistem");              // название системы
  ////////////////////////////////////////////////////////////////////////////////////////////
  if (menu == 0) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 42); tft.print("VOLUME");
  if (menu == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 67); tft.print("TREBLE");

  if (menu == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 92); tft.print("BASS");

  // разделительные линии
  tft.drawFastHLine(5, 105, 470, 0xcdcd); tft.drawFastHLine(5, 163, 470, 0xcdcd); tft.drawFastHLine(5, 192, 470, 0xcdcd); //tft.drawFastHLine(5, 140, 470, 0xcdcd);

  if (digitalRead(3) == HIGH) {
    menu++;

    eeprom = 1;
    time = millis();
    if (menu > 2) {
      menu = 0;
      set = 0;
    }
  }
  if (digitalRead(2) == HIGH) {
    set++;
    eeprom = 1;
    time = millis();
    menu = 100;
    if (set > 5) {
      set = 0;
      menu = 0;
    }
  }

  if (pluse == HIGH && minus == HIGH) {
    mute++;
    w = 1;
    if (mute > 1) {
      mute = 0;
    }
  }
   
  if(ir.value==VOL_PLUSE){vol++;gr1=1;gr2=0;cl1();time=millis();w =1;if(vol > 55){vol = 55;}}// кнопка > 
  if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();time=millis();w=1;if(vol > 55){vol = 55;}}// кнопка >>>>>>
  if(ir.value==VOL_MINUS){vol--;gr1=0;gr2=1;cl1();time=millis();w =1;if(vol < 0){vol = 0;}}// кнопка > 
  if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl1();time=millis();w=1;if(vol < 0){vol = 0;}}// кнопка >>>>>>
 

 
  
  if (pluse == HIGH && menu == 0) { 
    vol++;
    eeprom = 1;
    time = millis();
    if (vol > 55) {
      vol = 55;
    } w = 1;
  }
  if (minus == HIGH && menu == 0) { 

    vol--;
    eeprom = 1;
    time = millis();
    if (vol < 0) {
      vol = 0;
    } w = 1;
  }

  if (pluse == HIGH && menu == 1) {
    treb++;
    if (treb > 7) {
      treb = 7;
    } w1 = 1;
  }
  if (minus == HIGH && menu == 1) {
    treb--;
    if (treb < -7) {
      treb = -7;
    } w1 = 1;
  }
  if (pluse == HIGH && menu == 2) {
    bass++;
    if (bass > 7) {
      bass = 7;
    } w2 = 1;
  }
  if (minus == HIGH && menu == 2) {
    bass--;
    if (bass < -7) {
      bass = -7;
    } w2 = 1;
  }

  if (w == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 58; i++, i2++) {
      if (i2 < vol) {} else {
        i2 = vol;
      }
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 31, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 33, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 35, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 37, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 39, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 41, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 43, 10, 0xcdcd);
    } w = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 30, 42, 15, 0x39E9); tft.setCursor(413, 42); tft.print(-55 + vol); tft.setCursor(442, 42); tft.print(" dB");
  }

  if (w1 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = treb * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 56, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 58, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 60, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 62, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 64, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 66, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 68, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd);
    } w1 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 55, 40, 15, 0x39E9); tft.setCursor(413, 67); tft.print(treb); tft.setCursor(442, 67); tft.print(" dB"); w1 = 0;
  }

  if (w2 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = bass * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 81, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 83, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 85, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 87, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 89, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 91, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 93, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd);
    } w2 = 0; tft.setTextColor(0xAFE5); tft.fillRect(413, 80, 40, 15, 0x39E9); tft.setCursor(413, 92); tft.print(bass); tft.setCursor(442, 92); tft.print(" dB"); w2 = 0;
  }
  ///////////////////////////////////////////////////////////input + gain//////////////////////////////////////////////////////////////////////////////////////////
  if (pluse == HIGH && set == 1) {
    in++;
    if (in > 4) {
      in = 4;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 1) {
    in--;
    if (in < 1) {
      in = 1;
    } audio();
    w3 = 1;
  }
  tft.setCursor(5, 127); if (set == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("INPUT: ");
  tft.setCursor(110, 127); if (in == 1 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 1 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 1");
  tft.setCursor(210, 127); if (in == 2 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 2 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 2");
  tft.setCursor(310, 127); if (in == 3 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 3 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 3");
  tft.setCursor(410, 127); if (in == 4 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 4 && set != 1) {
    tft.setTextColor(0xAFE5);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 4");
  tft.setCursor(5, 152);
  if (set == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  }
  if (in == 1) {
    gain = gain1;
    tft.print("GAIN IN 1");                                        //Чуствительность входа
  }
  if (in == 2) {
    gain = gain2;
    tft.print("GAIN IN 2");
  }
  if (in == 3) {
    gain = gain3;
    tft.print("GAIN IN 3");
  }
  if (in == 4) {
    gain = gain4;
    tft.print("GAIN IN 4");
  }
  if (pluse == HIGH && set == 2) {
    gain++;
    if (gain > 15) {
      gain = 15;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 2) {
    gain--;
    if (gain < 0) {
      gain = 0;
    } audio();
    w3 = 1;
  }
  if (in == 1) {
    gain1 = gain;
  } if (in == 2) {
    gain2 = gain;
  } if (in == 3) {
    gain3 = gain;
  }
  if (in == 4) {
    gain4 = gain;
  }
  if (w3 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 15; i++, i2++) {
      if (i2 < gain) {} else {
        i2 = gain;
      }
      tft.drawFastHLine(i2 * 4 + 120, 141, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 141, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 143, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 143, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 145, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 145, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 147, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 147, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 149, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 149, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 151, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 151, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 153, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 153, 10, 0xcdcd);
    } w3 = 0; tft.fillRect(93, 140, 15, 15, 0x39E9);
  }
  /////////////////////////////баланс////////////////////////////////////////////////////////////
  tft.setCursor(210, 152); if (set == 3) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LF ");
  tft.setCursor(310, 152); if (set == 4) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("RF ");

  if (pluse == HIGH && set == 3) {
    lf++;
    if (lf > 30) {
      lf = 30;
    } audio();
    w4 = 1;
  }
  if (minus == HIGH && set == 3) {
    lf--;
    if (lf < 0) {
      lf = 0;
    } audio();
    w4 = 1;
  }
  if (w4 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < lf) {} else {
        i2 = lf;
      }
      tft.drawFastHLine(i2 + 245, 141, 1, 0x000F); tft.drawFastHLine(i + 246, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 143, 1, 0x000F); tft.drawFastHLine(i + 246, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 145, 1, 0x000F); tft.drawFastHLine(i + 246, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 147, 1, 0x000F); tft.drawFastHLine(i + 246, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 149, 1, 0x000F); tft.drawFastHLine(i + 246, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 151, 1, 0x000F); tft.drawFastHLine(i + 246, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 153, 1, 0x000F); tft.drawFastHLine(i + 246, 153, 1, 0xcdcd);
    } w4 = 0;
  }

  if (pluse == HIGH && set == 4) {
    rf++;
    if (rf > 30) {
      rf = 30;
    } audio();
    w5 = 1;
  }
  if (minus == HIGH && set == 4) {
    rf--;
    if (rf < 0) {
      rf = 0;
    } audio();
    w5 = 1;
  }
  if (w5 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < rf) {} else {
        i2 = rf;
      }
      tft.drawFastHLine(i2 + 345, 141, 1, 0x000F); tft.drawFastHLine(i + 346, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 143, 1, 0x000F); tft.drawFastHLine(i + 346, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 145, 1, 0x000F); tft.drawFastHLine(i + 346, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 147, 1, 0x000F); tft.drawFastHLine(i + 346, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 149, 1, 0x000F); tft.drawFastHLine(i + 346, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 151, 1, 0x000F); tft.drawFastHLine(i + 346, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 153, 1, 0x000F); tft.drawFastHLine(i + 346, 153, 1, 0xcdcd);
    } w5 = 0;
  }
  ///////////////////////////////////////тонокомпенсация//////////////////////////////////////////////////////////////////
  tft.setCursor(5, 182); if (set == 5) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LOUDNESS: ");

  if (pluse == HIGH && set == 5) {
    att_loun++;
    if (att_loun > 14) {
      att_loun = 14;
    } audio();
    w6 = 1;
  }
  if (minus == HIGH && set == 5) {
    att_loun--;
    if (att_loun < 0) {
      att_loun = 0;
    } audio();
    w6 = 1;
  }
  if (w6 == 1) {
    for (i = 0, i2 = 0; i <= 14; i++, i2++) {
      if (i2 < att_loun) {} else {
        i2 = att_loun;
      }
      tft.drawFastHLine(i2 + 115, 170, 1, 0xf800); tft.drawFastHLine(i + 116, 170, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 172, 1, 0xf800); tft.drawFastHLine(i + 116, 172, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 174, 1, 0xf800); tft.drawFastHLine(i + 116, 174, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 176, 1, 0xf800); tft.drawFastHLine(i + 116, 176, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 178, 1, 0xf800); tft.drawFastHLine(i + 116, 178, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 180, 1, 0xf800); tft.drawFastHLine(i + 116, 180, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 182, 1, 0xf800); tft.drawFastHLine(i + 116, 182, 1, 0xcdcd);
    } w6 = 0;
  }
  if (millis() - time > 1000 && eeprom == 1) {
    EEPROM.update(0, vol); EEPROM.update(1, treb + 15); EEPROM.update(2, bass + 15); EEPROM.update(3, in);
    EEPROM.update(4, gain1); EEPROM.update(5, gain2); EEPROM.update(6, gain3); EEPROM.update(7, gain4);
    EEPROM.update(8, gain); EEPROM.update(9, lf); EEPROM.update(10, rf); EEPROM.update(11, att_loun);

    eeprom = 0;
  }
  times = millis() - times;
  Serial.println(times);
}                              //loop
void audio() {
  pt.setVolume(vol); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(lf); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(rf); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(in, att_loun, gain);
  // input      int 0..2 === IN 1...3 (выбор стереовхода 4)
  // loudness   int 0...1 === 1-on 0-off (тонокомпесация)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)
}

void cl1(){ir.value=0;delay(300);}

14

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Мега ни чего не даст, она тоже медленная только память большая, stm32 много работы, библиотеку надо тестировать, может не заработать, енкодер, пульт весь код надо менять. Если есть желание можно попробовать.

15

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

STM32 сложно программировать, там все библиотеки другие. С экраном я не смогу Вам помочь, справитесь? У Вас практически закончен проект на ардуино.
Веб интерфейс не сложно сделать, но для этого лучше применить ESP8266.

16

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Протестируйте код, добавил кнопки пульта BASS TREB IN MENU MUTE

#define VOL_PLUSE 0x807F0AF5 // укажите свой код кнопки
#define VOL_MINUS 0x807F8A75
#define TREB_PLUSE 0x0000
#define TREB_MINUS 0x0000
#define BASS_PLUSE 0x0000
#define BASS_MINUS 0x0000
#define MENU 0x0000
#define MUTE 0x0000
#define IN_PLUSE 0x0000
#define IN_MINUS 0x0000



#include <Wire.h>
#include <SPI.h>
#include <EEPROM.h>
#include <PT2314.h>
#include <Adafruit_GFX.h>
#include <ILI9488.h>
#include <Encoder.h>
#include <boarddefs.h>
#include <IRremote.h>          // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <Fonts/FreeMonoBoldOblique9pt7b.h>
PT2314 pt;                 //Выход ИМС SDA и SCL подключаются к аналоговым входам платы Arduino А4 и А5
IRrecv irrecv(6); // указываем вывод модуля IR приемника
decode_results ir;
#define TFT_DC 9
#define TFT_CS 10
//Encoder myEnc(6, 7);// DT, CLK
ILI9488 tft = ILI9488(TFT_CS, TFT_DC);// Подключения дисплея RESET-8 DC-9 CS-10 CDI(MOSI)-11 SDO(MISO)-12 SCLK-13
int menu, pluse, minus, mute = 1;
int i, i2, vol = 50, set, treb, bass, in, gain, gain1, gain2, gain3, gain4, lf, rf, att_loun;
byte eeprom;
int  w = 1, w1 = 1, w2 = 1, w3 = 1, w4 = 1, w5 = 1, w6 = 1;//w-vol w1-tre w2-bas w3-in w4-lf w5-rf w6-loun
unsigned long time, times, t;
byte gr1, gr2;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);
  tft.begin(); Serial.begin(9600);
  tft.setRotation(1); tft.setTextSize(1); tft.fillScreen(0x39E9); tft.setTextColor(ILI9488_WHITE); tft.setFont(&FreeMonoBoldOblique9pt7b);
  pinMode(2, INPUT); /// set
  pinMode(3, INPUT); /// menu
  pinMode(4, INPUT); /// +
  pinMode(5, INPUT); /// -
  // pinMode(A0, INPUT); // МЕНЮ КНОПКА SW энкодера
  vol = EEPROM.read(0); treb = EEPROM.read(1) - 15; bass = EEPROM.read(2) - 15; in = EEPROM.read(3);
  gain1 = EEPROM.read(4); gain2 = EEPROM.read(5); gain3 = EEPROM.read(6); gain4 = EEPROM.read(7); gain = EEPROM.read(8);
  lf = EEPROM.read(9); rf = EEPROM.read(10);
  att_loun = EEPROM.read(11);
  audio();
}

void loop() {
  /// IR
  if ( irrecv.decode( &ir )) {
    Serial.print("0x");  // IR приемник - чтение, в мониторе порта отображаются коды кнопок
    Serial.println( ir.value, HEX);
    irrecv.resume();
    time = millis();
  }
  if (ir.value == 0) {
    gr1 = 0;  // запрет нажатий не активных кнопок пульта
    gr2 = 0;
  }

  times = millis();
  tft.setTextColor(ILI9488_WHITE);
  pluse = digitalRead(4); minus = digitalRead(5);
  tft.setTextColor(0xcdcd);
  tft.setCursor(170, 15); tft.print("Audio Sistem");              // название системы
  ////////////////////////////////////////////////////////////////////////////////////////////
  if (menu == 0) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 42); tft.print("VOLUME");
  if (menu == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 67); tft.print("TREBLE");

  if (menu == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.setCursor(5, 92); tft.print("BASS");

  // разделительные линии
  tft.drawFastHLine(5, 105, 470, 0xcdcd); tft.drawFastHLine(5, 163, 470, 0xcdcd); tft.drawFastHLine(5, 192, 470, 0xcdcd); //tft.drawFastHLine(5, 140, 470, 0xcdcd);




  if (digitalRead(3) == HIGH||ir.value == MENU) {
    menu++;
    cl1();
    eeprom = 1;
    time = millis();
    if (menu > 2) {
      menu = 0;
      set = 0;
    }
  }
  if (digitalRead(2) == HIGH) {
    set++;
    eeprom = 1;
    time = millis();
    menu = 100;
    if (set > 5) {
      set = 0;
      menu = 0;
    }
  }

  if ((pluse == HIGH && minus == HIGH)||ir.value == MUTE) {
    mute++;
    cl1();
    w = 1;
    if (mute > 1) {
      mute = 0;
    }
  }

  if (ir.value == VOL_PLUSE) {
    vol++;  // кнопка >
    gr1 = 1;
    gr2 = 0;
    cl1();
    time = millis();
    w = 1;
    if (vol > 55) {
      vol = 55;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr1 == 1) {
    vol++;  // кнопка >>>>>>
    gr2 = 0;
    cl1();
    time = millis();
    w = 1;
    if (vol > 55) {
      vol = 55;
    }
  }
  if (ir.value == VOL_MINUS) {
    vol--;  // кнопка >
    gr1 = 0;
    gr2 = 1;
    cl1();
    time = millis();
    w = 1;
    if (vol < 0) {
      vol = 0;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr2 == 1) {
    vol--;  // кнопка >>>>>>
    gr1 = 0;
    cl1();
    time = millis();
    w = 1;
    if (vol < 0) {
      vol = 0;
    }
  }




  if (pluse == HIGH && menu == 0) {
    vol++;
    eeprom = 1;
    time = millis();
    if (vol > 55) {
      vol = 55;
    } w = 1;
  }
  if (minus == HIGH && menu == 0) {

    vol--;
    eeprom = 1;
    time = millis();
    if (vol < 0) {
      vol = 0;
    } w = 1;
  }

  if (ir.value == TREB_PLUSE) {
    treb++;  // кнопка >
    gr1 = 1;
    gr2 = 0;
    cl1();
    time = millis();
    w1 = 1;
    if (treb > 7) {
      treb = 7;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr1 == 1) {
    treb++;  // кнопка >>>>>>
    gr2 = 0;
    cl1();
    time = millis();
    w1 = 1;
    if (treb > 7) {
      treb = 7;
    }
  }
  if (ir.value == TREB_MINUS) {
    treb--;  // кнопка >
    gr1 = 0;
    gr2 = 1;
    cl1();
    time = millis();
    w1 = 1;
    if (treb < -7) {
      treb = -7;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr2 == 1) {
    treb--;  // кнопка >>>>>>
    gr1 = 0;
    cl1();
    time = millis();
    w1 = 1;
    if (treb < -7) {
      treb = -7;
    }
  }


  if (pluse == HIGH && menu == 1) {
    treb++;
    if (treb > 7) {
      treb = 7;
    } w1 = 1;
  }
  if (minus == HIGH && menu == 1) {
    treb--;
    if (treb < -7) {
      treb = -7;
    } w1 = 1;
  }


  if (ir.value == BASS_PLUSE) {
    bass++;  // кнопка >
    gr1 = 1;
    gr2 = 0;
    cl1();
    time = millis();
    w2 = 1;
    if (bass > 7) {
      bass = 7;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr1 == 1) {
    bass++;  // кнопка >>>>>>
    gr2 = 0;
    cl1();
    time = millis();
    w2 = 1;
    if (bass > 7) {
      bass = 7;
    }
  }
  if (ir.value == BASS_MINUS) {
    bass--;  // кнопка >
    gr1 = 0;
    gr2 = 1;
    cl1();
    time = millis();
    w2 = 1;
    if (bass < -7) {
      bass = -7;
    }
  }
  if (ir.value == 0xFFFFFFFF and gr2 == 1) {
    bass--;  // кнопка >>>>>>
    gr1 = 0;
    cl1();
    time = millis();
    w2 = 1;
    if (bass < -7) {
      bass = -7;
    }
  }
  
  if (pluse == HIGH && menu == 2) {
    bass++;
    if (bass > 7) {
      bass = 7;
    } w2 = 1;
  }
  if (minus == HIGH && menu == 2) {
    bass--;
    if (bass < -7) {
      bass = -7;
    } w2 = 1;
  }

  if (w == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 58; i++, i2++) {
      if (i2 < vol) {} else {
        i2 = vol;
      }
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 31, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 31, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 33, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 33, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 35, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 35, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 37, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 37, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 39, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 39, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 41, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 41, 10, 0xcdcd);
      if (mute == 1) {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x000F);
      } else {
        tft.drawFastHLine(i2 * 5.5 + 78, 43, 10, 0x0f800);
      } tft.drawFastHLine(i * 5.5 + 80, 43, 10, 0xcdcd);
    } w = 0; tft.setTextColor(0x07FF); tft.fillRect(413, 30, 42, 15, 0x39E9); tft.setCursor(413, 42); tft.print(-55 + vol); tft.setCursor(442, 42); tft.print(" dB");

    if ( menu == 0 && w == 0 ) {
      tft.setTextSize(2); tft.fillRect(250, 245, 180, 30, 0x39E9); tft.setCursor(250, 270); tft.setTextColor(0x1D74); tft.print("Vol:"); tft.setCursor(360, 270); tft.print(-55 + vol); tft.setCursor(410, 270); tft.print(" dB");
    }
  }

  if (w1 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = treb * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 56, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 56, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 58, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 58, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 60, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 60, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 62, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 62, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 64, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 64, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 66, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 66, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 68, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 68, 10, 0xcdcd);
    } w1 = 0; tft.setTextSize(1); tft.setTextColor(0x07FF); tft.fillRect(413, 55, 40, 15, 0x39E9); tft.setCursor(413, 67); tft.print(treb); tft.setCursor(442, 67); tft.print(" dB"); w1 = 0;

    if ( menu == 1 && w1 == 0 ) {
      tft.setTextSize(2); tft.fillRect(250, 245, 180, 30, 0x39E9); tft.setTextColor(0x1D74); tft.setCursor(250, 270); tft.print("Tre:");tft.setCursor(360, 270); tft.print(treb);
    }
  }

  if (w2 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 80; i++, i2++) {
      i2 = bass * 5 + 40;
      tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 81, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 81, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 83, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 83, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 85, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 85, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 87, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 87, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 89, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 89, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 91, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 91, 10, 0xcdcd);
      tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd); tft.drawFastHLine(i2 * 4 + 80, 93, 10, 0x000F); tft.drawFastHLine(i * 4 + 80, 93, 10, 0xcdcd);
    } w2 = 0; tft.setTextSize(1); tft.setTextColor(0x07FF); tft.fillRect(413, 80, 40, 15, 0x39E9); tft.setCursor(413, 92); tft.print(bass); tft.setCursor(442, 92); tft.print(" dB"); w2 = 0;

    if ( menu == 2 && w2 == 0 ) {
      tft.setTextSize(2); tft.fillRect(250, 245, 180, 30, 0x39E9); tft.setCursor(250, 270);tft.setTextColor(0x1D74); tft.print("Bas:"); tft.setCursor(360, 270); tft.print(bass);
    }



  }
  ///////////////////////////////////////////////////////////input + gain//////////////////////////////////////////////////////////////////////////////////////////
  tft.setTextSize(1);

   if (ir.value == IN_PLUSE) {
    in++;  // кнопка >
    gr1 = 1;
    gr2 = 0;
    cl1();
    time = millis();
    w3 = 1;
    if (in > 4) {
      in = 4;
    }
  }
  if (ir.value == IN_MINUS) {
    in--;  // кнопка >
    gr1 = 0;
    gr2 = 1;
    cl1();
    time = millis();
    w3 = 1;
    if (in < 1) {
      in = 1;
    }
  }
  
  if (pluse == HIGH && set == 1) {
    in++;
    if (in > 4) {
      in = 4;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 1) {
    in--;
    if (in < 1) {
      in = 1;
    } audio();
    w3 = 1;
  }
  tft.setCursor(5, 127); if (set == 1) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("INPUT: ");
  tft.setCursor(110, 127); if (in == 1 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 1 && set != 1) {
    tft.setTextColor(0x07FF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 1");
  tft.setCursor(210, 127); if (in == 2 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 2 && set != 1) {
    tft.setTextColor(0x07FF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 2");
  tft.setCursor(310, 127); if (in == 3 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 3 && set != 1) {
    tft.setTextColor(0x07FF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 3");
  tft.setCursor(410, 127); if (in == 4 && set == 1) {
    tft.setTextColor(0xFFFF);
  } else if (in == 4 && set != 1) {
    tft.setTextColor(0x07FF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("IN 4");
  tft.setCursor(5, 152);
  if (set == 2) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  }
  if (in == 1) {
    gain = gain1;
    tft.print("GAIN IN 1");                                        //Чуствительность входа
  }
  if (in == 2) {
    gain = gain2;
    tft.print("GAIN IN 2");
  }
  if (in == 3) {
    gain = gain3;
    tft.print("GAIN IN 3");
  }
  if (in == 4) {
    gain = gain4;
    tft.print("GAIN IN 4");
  }
  if (pluse == HIGH && set == 2) {
    gain++;
    if (gain > 15) {
      gain = 15;
    } audio();
    w3 = 1;
  }
  if (minus == HIGH && set == 2) {
    gain--;
    if (gain < 0) {
      gain = 0;
    } audio();
    w3 = 1;
  }
  if (in == 1) {
    gain1 = gain;
  } if (in == 2) {
    gain2 = gain;
  } if (in == 3) {
    gain3 = gain;
  }
  if (in == 4) {
    gain4 = gain;
  }
  if (w3 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 15; i++, i2++) {
      if (i2 < gain) {} else {
        i2 = gain;
      }
      tft.drawFastHLine(i2 * 4 + 120, 141, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 141, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 143, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 143, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 145, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 145, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 147, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 147, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 149, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 149, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 151, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 151, 10, 0xcdcd);
      tft.drawFastHLine(i2 * 4 + 120, 153, 10, 0x000F); tft.drawFastHLine(i * 4 + 122, 153, 10, 0xcdcd);
    } w3 = 0; tft.fillRect(93, 140, 15, 15, 0x39E9);
  }
  /////////////////////////////баланс////////////////////////////////////////////////////////////
  tft.setCursor(210, 152); if (set == 3) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LF ");
  tft.setCursor(310, 152); if (set == 4) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("RF ");

  if (pluse == HIGH && set == 3) {
    lf++;
    if (lf > 30) {
      lf = 30;
    } audio();
    w4 = 1;
  }
  if (minus == HIGH && set == 3) {
    lf--;
    if (lf < 0) {
      lf = 0;
    } audio();
    w4 = 1;
  }
  if (w4 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < lf) {} else {
        i2 = lf;
      }
      tft.drawFastHLine(i2 + 245, 141, 1, 0x000F); tft.drawFastHLine(i + 246, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 143, 1, 0x000F); tft.drawFastHLine(i + 246, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 145, 1, 0x000F); tft.drawFastHLine(i + 246, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 147, 1, 0x000F); tft.drawFastHLine(i + 246, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 149, 1, 0x000F); tft.drawFastHLine(i + 246, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 151, 1, 0x000F); tft.drawFastHLine(i + 246, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 245, 153, 1, 0x000F); tft.drawFastHLine(i + 246, 153, 1, 0xcdcd);
    } w4 = 0;
  }

  if (pluse == HIGH && set == 4) {
    rf++;
    if (rf > 30) {
      rf = 30;
    } audio();
    w5 = 1;
  }
  if (minus == HIGH && set == 4) {
    rf--;
    if (rf < 0) {
      rf = 0;
    } audio();
    w5 = 1;
  }
  if (w5 == 1) {
    audio();
    for (i = 0, i2 = 0; i <= 30; i++, i2++) {
      if (i2 < rf) {} else {
        i2 = rf;
      }
      tft.drawFastHLine(i2 + 345, 141, 1, 0x000F); tft.drawFastHLine(i + 346, 141, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 143, 1, 0x000F); tft.drawFastHLine(i + 346, 143, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 145, 1, 0x000F); tft.drawFastHLine(i + 346, 145, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 147, 1, 0x000F); tft.drawFastHLine(i + 346, 147, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 149, 1, 0x000F); tft.drawFastHLine(i + 346, 149, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 151, 1, 0x000F); tft.drawFastHLine(i + 346, 151, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 345, 153, 1, 0x000F); tft.drawFastHLine(i + 346, 153, 1, 0xcdcd);
    } w5 = 0;
  }
  ///////////////////////////////////////тонокомпенсация//////////////////////////////////////////////////////////////////
  tft.setCursor(5, 182); if (set == 5) {
    tft.setTextColor(0xFFFF);
  } else {
    tft.setTextColor(0xcdcd);
  } tft.print("LOUDNESS: ");

  if (pluse == HIGH && set == 5) {
    att_loun++;
    if (att_loun > 14) {
      att_loun = 14;
    } audio();
    w6 = 1;
  }
  if (minus == HIGH && set == 5) {
    att_loun--;
    if (att_loun < 0) {
      att_loun = 0;
    } audio();
    w6 = 1;
  }
  if (w6 == 1) {
    for (i = 0, i2 = 0; i <= 14; i++, i2++) {
      if (i2 < att_loun) {} else {
        i2 = att_loun;
      }
      tft.drawFastHLine(i2 + 115, 170, 1, 0xf800); tft.drawFastHLine(i + 116, 170, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 172, 1, 0xf800); tft.drawFastHLine(i + 116, 172, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 174, 1, 0xf800); tft.drawFastHLine(i + 116, 174, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 176, 1, 0xf800); tft.drawFastHLine(i + 116, 176, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 178, 1, 0xf800); tft.drawFastHLine(i + 116, 178, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 180, 1, 0xf800); tft.drawFastHLine(i + 116, 180, 1, 0xcdcd);
      tft.drawFastHLine(i2 + 115, 182, 1, 0xf800); tft.drawFastHLine(i + 116, 182, 1, 0xcdcd);
    } w6 = 0;
  }
  if (millis() - time > 1000 && eeprom == 1) {
    EEPROM.update(0, vol); EEPROM.update(1, treb + 15); EEPROM.update(2, bass + 15); EEPROM.update(3, in);
    EEPROM.update(4, gain1); EEPROM.update(5, gain2); EEPROM.update(6, gain3); EEPROM.update(7, gain4);
    EEPROM.update(8, gain); EEPROM.update(9, lf); EEPROM.update(10, rf); EEPROM.update(11, att_loun);

    eeprom = 0;
  }
  times = millis() - times;
  Serial.println(times);
}                              //loop
void audio() {
  pt.setVolume(vol); // int 0...55 === -70...0 dB step 1.25 dB (Уровень громкости Лк+Пк)
  pt.setAttL(lf); // int 0...23 === 0...-30 db step 1.25 dB > int 31 === mute on (регулировка баланса по Лк практически до 0)
  pt.setAttR(rf); // int 0...23 === 0...-30 dB step 1.25 dB > int 31 === mute on (регулировка баланса по Пк практически до 0)
  pt.setSwitch(in, att_loun, gain);
  // input      int 0..2 === IN 1...3 (выбор стереовхода 4)
  // loudness   int 0...1 === 1-on 0-off (тонокомпесация)
  // input gain int 0...3 === 0...11.25dB step 3.75 dB(регулировка предусиления по входам)
  pt.setBass(bass);   // int -7...+7 === -14...+14 dB step 2 dB (регулировка низких частот)
  pt.setTreble(treb); // int -7...+7 === -14...+14 dB step 2 dB (регулировка верхних частот)
}

void cl1() {
  ir.value = 0;
  delay(300);
}

17

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Вам нужен модуль часов реального времени DS3231.

18

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Вот код опроса часов, занимает мало места - http://forum.rcl-radio.ru/viewtopic.php?id=303

19

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Лучше перейти на ESP8266, в ней памяти больше, экран быстрее работать будет, время для часов можно из интернета брать.

20

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

библиотека эквалайзера очень простая:

https://github.com/liman324/TDA7317.git

#include <Wire.h>
#include <TDA7317.h>
  TDA7317 tda;
 
void setup(){ 
  Serial.begin(9600);Wire.begin();
  audio();
}
 
void loop(){}
 
void audio(){
  tda.setVolume(47); // громкость 0...47
  tda.setBand(0,0);  // номер полосы, дБ (-7...+7)
  tda.setBand(1,0);
  tda.setBand(2,0);
  tda.setBand(3,0);
  tda.setBand(4,0);
}

Веб интерфейс - посмотрите один из моих проектов http://rcl-radio.ru/?p=97415

Многоуровневое меню - сделайте кнопку - эквалайзер, вывод на экран сделайте через if .

21

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Спасибо , но не помогло .
В браузере нужно регулировка потенциометра везде в интернете только кнопки вкл . выкл .
Библиотека проста согласен , но нужно соединить параметры audio() TDA и TP ...

22

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

обращайтесь к  audio_tda()

void audio_tda(){
  tda.setVolume(47); // громкость 0...47
  tda.setBand(0,0);  // номер полосы, дБ (-7...+7)
  tda.setBand(1,0);
  tda.setBand(2,0);
  tda.setBand(3,0);
  tda.setBand(4,0);
}

Потенциометр это сложно и не будет работать как Вы хотите, Вы просто ползунок передвигаете на нужное место, но это не изменить громкость, для изменения громкости нужно нажать кнопку (на веб странице) "Применить", только после этого изминения вступять в силу.
Посмотрите этот проект - http://rcl-radio.ru/?p=68615
в ESP32 есть Bluetooth

23

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Очень интересный проект!
Но где окончательный скетч?

24

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

http://forum.rcl-radio.ru/uploads/images/2021/11/1c7e3e6868b4b8f186a7b60439ed2df6.jpg

25 (2021-11-15 10:28:02 отредактировано sanj76a)

Re: Аудиопроцессор TDA7419 + LCD TFT 2,4 (SPFD5408)

Такой будет работать?