Приветствую! что на что нужно изменить в скетче, чтобы вместо input 1..2..3 было aux... rca... bluetooth?
#define IR_1 0x2FDD02F // Кнопка вверх
#define IR_2 0x2FD32CD // Кнопка вниз
#define IR_3 0x2FD906F // Кнопка >
#define IR_4 0x2FDF20D // Кнопка <
#define IR_5 0x2FD708F // Кнопка IN
#define IR_6 0x2FD6A95 // Кнопка MUTE
#define IR_7 0x2FD00FF // Кнопка POWER
#define IR_8 0x2FDB24D // Кнопка MENU2
#include <Wire.h>
#include <BD37534FV.h>// https://github.com/liman324/BD37534FV/archive/master.zip
#include <EEPROM.h>
#include <Encoder.h> // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
#include <MsTimer2.h> // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip
#include <boarddefs.h>
#include <IRremote.h> // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <LiquidCrystal_I2C.h> //Библиотека - http://forum.rcl-radio.ru/misc.php?action=pan_download&item=45&download=1
BD37534FV tda;
LiquidCrystal_I2C lcd(0x27,16,2); // Устанавливаем дисплей
IRrecv irrecv(12); // указываем вывод модуля IR приемника
Encoder myEnc(9, 8);//DT,CLK
decode_results ir;
byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};
unsigned long time,oldPosition = -999,newPosition;
int gr1,gr2,vol,vol_d,z,z0,z1,w,w2,menu,treb,treb_d,middle,middle_d,bass,bass_d,in,mute,power,menu2=100,www,gain0,gain1,gain2,gain3,gain_d,lon_f,lon,lon_d;
int out,vol_out,rf,lf,rt,lt,sab,treb_c,mid_c,bas_c,sab_f,treb_q,mid_q,bas_q,faza;
void setup(){
Wire.begin();lcd.init();lcd.backlight();irrecv.enableIRIn();Serial.begin(9600);
lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);
lcd.setCursor(0,0);lcd.print(" POWER ON ");delay(1000);lcd.clear();// ЗАСТАВКА
MsTimer2::set(3, to_Timer);MsTimer2::start();
if(EEPROM.read(100)!=0){for(int i=0;i<101;i++){EEPROM.update(i,0);}}// очистка памяти при первом включении
pinMode(2,INPUT);// МЕНЮ КНОПКА SW энкодера
pinMode(3,INPUT);// ВЫБОР ВХОДА КНОПКА IN
pinMode(4,INPUT);// КНОПКА MENU2
pinMode(5,INPUT);// КНОПКА POWER
pinMode(6,INPUT);// КНОПКА MUTE
pinMode(7,OUTPUT);// STANDBY
vol = EEPROM.read(0)-79;treb = EEPROM.read(1)-20;middle = EEPROM.read(2)-20;bass = EEPROM.read(3)-20;in = EEPROM.read(4);
gain1 = EEPROM.read(5);gain2 = EEPROM.read(6);gain3 = EEPROM.read(7);lon = EEPROM.read(8);lon_f = EEPROM.read(9);
rf = EEPROM.read(10);lf = EEPROM.read(11);rt = EEPROM.read(12);lt = EEPROM.read(13);sab = EEPROM.read(14);
treb_c = EEPROM.read(15);mid_c = EEPROM.read(16);bas_c = EEPROM.read(17);sab_f = EEPROM.read(18);treb_q = EEPROM.read(19);
mid_q = EEPROM.read(20);bas_q = EEPROM.read(21);faza = EEPROM.read(22);
audio();
}
void loop(){
if(digitalRead(2)==LOW&&power==0&&menu2==100){menu++;cl();time=millis();w=1;w2=1;if(menu>3){menu=0;}}// меню
if(digitalRead(3)==HIGH&&power==0&&menu2!=3&&mute==0){in++;;cl();time=millis();w=1;w2=1;www=1;if(in>2){in=0;};lcd.setCursor(0,0);lcd.print(" INPUT ");lcd.print(in+1);audio();delay(2000);}// КНОПКА ВЫБОРА ВХОДА IN
if(digitalRead(6)==HIGH&&mute==0&&power==0){mute=1;cl();w=0;w2=1;lcd.print(" MUTE ");menu=100;menu2=100;audio();}// mute on
if(digitalRead(6)==HIGH&&mute==1&&power==0){mute=0;cl();time=millis();w=1;w2=1;menu=0;myEnc.write(0);audio();}// mute off
if(digitalRead(5)==HIGH&&power==0){power=1;mute=1;audio();lcd.clear();lcd.setCursor(0,0);lcd.print(" POWER OFF ");w=0;menu=100;menu2=100;delay(3000);lcd.noBacklight();}// power off
if(digitalRead(5)==HIGH&&power==1){power=0;mute=0;audio();lcd.backlight();lcd.clear();lcd.setCursor(0,0);lcd.print(" POWER ON ");menu=0;time=millis();w=1;w2=1;myEnc.write(0);delay(3000);lcd.clear();}// power on
if(power==0){digitalWrite(7,HIGH);}if(power==1){digitalWrite(7,LOW);} // выход STANDBY
if(digitalRead(4)==HIGH&&power==0&&menu<4){menu2=0;menu=100;cl();time=millis();w=1;w2=1;lcd.setCursor(0,0);lcd.print(" MENU 2 ");delay(2000);}// menu 2 on
if(digitalRead(4)==HIGH&&power==0&&menu>3){menu2=100;menu=0;cl();time=millis();w=1;w2=1;}// menu2 off
if(digitalRead(2)==LOW&&power==0&&menu>3){menu2++;cl();time=millis();w=1;w2=1;if(menu2>11){menu2=0;}}// меню 2
////////////////////// IR /////////////////////////////////////////////////
if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();time=millis();w=1;}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
if(ir.value==IR_1&&power==0&&menu2==100){menu++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu>3){menu=0;}}// меню кнопка вверх
if(ir.value==IR_2&&power==0&&menu2==100){menu--;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu<0){menu=3;}}// меню кнопка вниз
if(ir.value==IR_1&&power==0&&menu==100){menu2++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu2>11){menu2=0;}}// меню2 кнопка вверх
if(ir.value==IR_2&&power==0&&menu==100){menu2--;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu2<0){menu2=11;}}// меню2 кнопка вниз
if(ir.value==IR_5&&power==0&&menu2!=3&&mute==0){in++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;www=1;if(in>2){in=0;};lcd.setCursor(0,0);lcd.print(" INPUT ");lcd.print(in+1);audio();delay(2000);}// КНОПКА ВЫБОРА ВХОДА IN
if(ir.value==IR_6&&mute==0&&power==0){mute=1;gr1=0;gr2=0;cl();w=0;w2=1;lcd.print(" MUTE ");menu=100;menu2=100;audio();}// mute on
if(ir.value==IR_6&&mute==1&&power==0){mute=0;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;menu=0;myEnc.write(0);audio();}// mute off
if(ir.value==IR_8&&power==0&&menu<4){menu2=0;gr1=0;gr2=0;menu=100;cl();time=millis();w=1;w2=1;lcd.setCursor(0,0);lcd.print(" MENU 2 ");delay(2000);}// menu 2 on
if(ir.value==IR_8&&power==0&&menu>3){menu2=100;gr1=0;gr2=0;menu=0;cl();time=millis();w=1;w2=1;}// menu2 off
if(ir.value==IR_7&&power==0){power=1;mute=1;audio();gr1=0;gr2=0;cl();lcd.setCursor(0,0);lcd.print(" POWER OFF ");w=0;menu=100;menu2=100;delay(3000);lcd.noBacklight();}// power off
if(ir.value==IR_7&&power==1){power=0;mute=0;audio();gr1=0;gr2=0;lcd.backlight();cl();lcd.setCursor(0,0);lcd.print(" POWER ON ");menu=0;time=millis();w=1;w2=1;myEnc.write(0);delay(3000);lcd.clear();}// power on
//Serial.println(vol);
/////////////////////////////// VOLUME -79 ... +15 дБ ////////////////////////////////////////////////
if(menu==0){
if(ir.value==IR_3){vol++;gr1=1;gr2=0;cl1();w2=1;vol_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();w2=1;vol_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){vol--;gr1=0;gr2=1;cl1();w2=1;vol_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl1();w2=1;vol_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;vol_func();audio();}
lcd.setCursor(0,0);lcd.print("VOLUME ");
lcd.print(" ");lcd.print(vol);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");vol_d=vol/2+40;
if(w2==1){
for(z=0,z0=0,z1=0;z<=vol_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0,1);lcd.write((uint8_t)2);}w2=0;}}
///////////////////////// TREBLE +/-20 dB /////////////////////////////////////////////////////////
if(menu==1){
if(ir.value==IR_3){treb++;gr1=1;gr2=0;cl1();w2=1;treb_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl1();w2=1;treb_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){treb--;gr1=0;gr2=1;cl1();w2=1;treb_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl1();w2=1;treb_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
treb=treb+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;treb_func();audio();}
lcd.setCursor(0,0);lcd.print("TREBLE ");
lcd.print(" ");lcd.print(treb);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");treb_d=treb+20;
if(w2==1){
for(z=0,z0=0,z1=0;z<=treb_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}w2=0;}}
/////////////////////////// MIDDLE +/-20 dB ////////////////////////////////////////////////////////
if(menu==2){
if(ir.value==IR_3){middle++;gr1=1;gr2=0;cl1();w2=1;middle_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){middle++;gr2=0;cl1();w2=1;middle_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){middle--;gr1=0;gr2=1;cl1();w2=1;middle_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){middle--;gr1=0;cl1();w2=1;middle_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
middle=middle+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;middle_func();audio();}
lcd.setCursor(0,0);lcd.print("MIDDLE ");
lcd.print(" ");lcd.print(middle);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");middle_d=middle+20;
if(w2==1){
for(z=0,z0=0,z1=0;z<=middle_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}w2=0;}}
/////////////////////// BASS +/-20 dB ///////////////////////////////////////////////////////////
if(menu==3){
if(ir.value==IR_3){bass++;gr1=1;gr2=0;cl1();w2=1;bass_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl1();w2=1;bass_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){bass--;gr1=0;gr2=1;cl1();w2=1;bass_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl1();w2=1;bass_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
bass=bass+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;bass_func();audio();}
lcd.setCursor(0,0);lcd.print("BASS ");
lcd.print(" ");lcd.print(bass);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");bass_d=bass+20;
if(w2==1){
for(z=0,z0=0,z1=0;z<=bass_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}w2=0;}}
////////////////////////// MENU 2 //////////////////////////////////////////////////////////////////////
//////////////// IN + GAIN /////////////////////////////////////////////////////////////
if(menu2==0){
switch(in){
case 0: gain0 = gain1;break;
case 1: gain0 = gain2;break;
case 2: gain0 = gain3;break;
}
if(ir.value==IR_3){gain0++;gr1=1;gr2=0;cl1();w2=1;gain_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){gain0++;gr2=0;cl1();w2=1;gain_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){gain0--;gr1=0;gr2=1;cl1();w2=1;gain_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){gain0--;gr1=0;cl1();w2=1;gain_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
gain0=gain0+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;gain_func();audio();}
switch(in){
case 0: gain1 = gain0;break;
case 1: gain2 = gain0;break;
case 2: gain3 = gain0;break;
}
if(www==1){audio();www=0;}
lcd.setCursor(0,0);lcd.print("Gain IN ");lcd.print(in+1);
lcd.setCursor(10,0);lcd.print(" ");lcd.print(gain0);lcd.print(" ");lcd.setCursor(14,0);lcd.print("dB");gain_d=gain0*2;
if(w2==1){
for(z=0,z0=0,z1=0;z<=gain_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}}w2=0;}
////////////////////////////// loudness ////////////////////////////////////////////////////
if(menu2==1){
if(ir.value==IR_3){lon_f++;gr1=1;gr2=0;cl1();w2=1;lon_f_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){lon_f++;gr2=0;cl1();w2=1;lon_f_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){lon_f--;gr1=0;gr2=1;cl1();w2=1;lon_f_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){lon_f--;gr1=0;cl1();w2=1;lon_f_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
lon_f=lon_f+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;lon_f_func();audio();}
lcd.setCursor(0,0);lcd.print("Loudness: ");
switch(lon_f){
case 0: lcd.print("250Hz ");break;
case 1: lcd.print("400Hz ");break;
case 2: lcd.print("800Hz ");break;
case 3: lcd.print("FLAT ");break;}}
//////////////////////////// loudness gain ////////////////////////////////////////////////
if(menu2==2){
if(ir.value==IR_3){lon++;gr1=1;gr2=0;cl1();w2=1;lon_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){lon++;gr2=0;cl1();w2=1;lon_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){lon--;gr1=0;gr2=1;cl1();w2=1;lon_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){lon--;gr1=0;cl1();w2=1;lon_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
lon=lon+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;lon_func();audio();}
lcd.setCursor(0,0);lcd.print("Loud gain");
lcd.print(" ");lcd.print(lon);lcd.print(" ");lcd.setCursor(13,0);lcd.print("dB");lon_d=lon*2;
if(w2==1){
for(z=0,z0=0,z1=0;z<=lon_d;z++,z1++){if(z1>2){z1=0;z0++;}
if(z1==1){lcd.setCursor(z0+1,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+1,1);lcd.print(" ");}}
if(z1==3){lcd.setCursor(z0+1,1);lcd.write((uint8_t)1);}
if(z1==2){lcd.setCursor(z0+1,1);lcd.write((uint8_t)2);}w2=0;}}
////////////////////////////////////////// out /////////////////////////////////////////////////
if(menu2==3){
if(digitalRead(3)==HIGH){out++;cl();time=millis();www=1;w=1;if(out>4){out=0;}audio();} // перебор выходов кнопкой IN
if(ir.value==IR_5){out++;cl();time=millis();www=1;w=1;if(out>4){out=0;}audio();} // перебор выходов кнопкой IN
switch(out){
case 0:vol_out=rf;break;
case 1:vol_out=lf;break;
case 2:vol_out=rt;break;
case 3:vol_out=lt;break;
case 4:vol_out=sab;break;
}
if(ir.value==IR_3){vol_out++;gr1=1;gr2=0;cl1();w2=1;vol_out_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){vol_out++;gr2=0;cl1();w2=1;vol_out_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){vol_out--;gr1=0;gr2=1;cl1();w2=1;vol_out_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){vol_out--;gr1=0;cl1();w2=1;vol_out_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
vol_out=vol_out+newPosition;myEnc.write(0);newPosition=0;time=millis();www=1;w=1;w2=1;vol_out_func();audio();}
lcd.setCursor(0,0);lcd.print("Volume OUT");lcd.setCursor(0,1);
switch(out){
case 0:rf=vol_out;lcd.print("RF: ");lcd.print(rf);break;
case 1:lf=vol_out;lcd.print("LF: ");lcd.print(lf);break;
case 2:rt=vol_out;lcd.print("RT: ");lcd.print(rt);break;
case 3:lt=vol_out;lcd.print("LT: ");lcd.print(lt);break;
case 4:sab=vol_out;lcd.print("SUBW: ");lcd.print(sab);break;
}
if(www==1){audio();www=0;}
lcd.print(" dB ");}
/////////////////////////////////treble center//////////////////////////////////////////////////
if(menu2==4){
if(ir.value==IR_3){treb_c++;gr1=1;gr2=0;cl1();w2=1;treb_c_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb_c++;gr2=0;cl1();w2=1;treb_c_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){treb_c--;gr1=0;gr2=1;cl1();w2=1;treb_c_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb_c--;gr1=0;cl1();w2=1;treb_c_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
treb_c=treb_c+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;treb_c_func();audio();}
lcd.setCursor(0,0);lcd.print("Treble Center ");
lcd.setCursor(1,6);
switch(treb_c){
case 0: lcd.print(" 7.5 kHz");break;
case 1: lcd.print("10.0 kHz");break;
case 2: lcd.print("12.5 kHz");break;
case 3: lcd.print("15.0 kHz");break;}}
/////////////////////////////////middle center//////////////////////////////////////////////////
if(menu2==5){
if(ir.value==IR_3){mid_c++;gr1=1;gr2=0;cl1();w2=1;mid_c_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){mid_c++;gr2=0;cl1();w2=1;mid_c_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){mid_c--;gr1=0;gr2=1;cl1();w2=1;mid_c_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){mid_c--;gr1=0;cl1();w2=1;mid_c_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
mid_c=mid_c+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;mid_c_func();audio();}
lcd.setCursor(0,0);lcd.print("Middle Center ");
lcd.setCursor(1,6);
switch(mid_c){
case 0: lcd.print("0.5 kHz");break;
case 1: lcd.print("1.0 kHz");break;
case 2: lcd.print("1.5 kHz");break;
case 3: lcd.print("2.5 kHz");break;}}
////////////////////////////////////bass center///////////////////////////////////////////
if(menu2==6){
if(ir.value==IR_3){bas_c++;gr1=1;gr2=0;cl1();w2=1;bas_c_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bas_c++;gr2=0;cl1();w2=1;bas_c_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){bas_c--;gr1=0;gr2=1;cl1();w2=1;bas_c_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bas_c--;gr1=0;cl1();w2=1;bas_c_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
bas_c=bas_c+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;bas_c_func();audio();}
lcd.setCursor(0,0);lcd.print("Bass Center ");
lcd.setCursor(1,6);
switch(bas_c){
case 0: lcd.print("60 Hz ");break;
case 1: lcd.print("80 Hz ");break;
case 2: lcd.print("100 Hz");break;
case 3: lcd.print("120 Hz");break;}}
//////////////////////////////////////subw////////////////////////////////////////////////
if(menu2==7){
if(ir.value==IR_3){sab_f++;gr1=1;gr2=0;cl1();w2=1;sab_f_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){sab_f++;gr2=0;cl1();w2=1;sab_f_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){sab_f--;gr1=0;gr2=1;cl1();w2=1;sab_f_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){sab_f--;gr1=0;cl1();w2=1;sab_f_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
sab_f=sab_f+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;sab_f_func();audio();}
lcd.setCursor(0,0);lcd.print("Subwoofer Freq.");
lcd.setCursor(1,6);
switch(sab_f){
case 0: lcd.print("FLAT ");break;
case 1: lcd.print("55 Hz ");break;
case 2: lcd.print("85 Hz ");break;
case 3: lcd.print("120 Hz");break;
case 4: lcd.print("160 Hz");break;}}
/////////////////////////////////treble Q//////////////////////////////////////////////////
if(menu2==8){
if(ir.value==IR_3){treb_q++;gr1=1;gr2=0;cl1();w2=1;treb_q_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb_q++;gr2=0;cl1();w2=1;treb_q_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){treb_q--;gr1=0;gr2=1;cl1();w2=1;treb_q_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb_q--;gr1=0;cl1();w2=1;treb_q_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
treb_q=treb_q+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;treb_q_func();audio();}
lcd.setCursor(0,0);lcd.print("Treble Q ");
lcd.setCursor(1,6);
switch(treb_q){
case 0: lcd.print("0.75");break;
case 1: lcd.print("1.25");break;}}
/////////////////////////////////middle Q//////////////////////////////////////////////////
if(menu2==9){
if(ir.value==IR_3){mid_q++;gr1=1;gr2=0;cl1();w2=1;mid_q_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){mid_q++;gr2=0;cl1();w2=1;mid_q_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){mid_q--;gr1=0;gr2=1;cl1();w2=1;mid_q_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){mid_q--;gr1=0;cl1();w2=1;mid_q_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
mid_q=mid_q+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;mid_q_func();audio();}
lcd.setCursor(0,0);lcd.print("Middle Q ");
lcd.setCursor(1,6);
switch(mid_q){
case 0: lcd.print("0.75");break;
case 1: lcd.print("1.00");break;
case 2: lcd.print("1.25");break;
case 3: lcd.print("1.50");break;}}
/////////////////////////////////bass Q//////////////////////////////////////////////////
if(menu2==10){
if(ir.value==IR_3){bas_q++;gr1=1;gr2=0;cl1();w2=1;bas_q_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bas_q++;gr2=0;cl1();w2=1;bas_q_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){bas_q--;gr1=0;gr2=1;cl1();w2=1;bas_q_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bas_q--;gr1=0;cl1();w2=1;bas_q_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
bas_q=bas_q+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;bas_q_func();audio();}
lcd.setCursor(0,0);lcd.print("Bass Q ");
lcd.setCursor(1,6);
switch(bas_q){
case 0: lcd.print("0.5");break;
case 1: lcd.print("1.0");break;
case 2: lcd.print("1.5");break;
case 3: lcd.print("2.0");break;}}
/////////////////////////////////LPF Phase//////////////////////////////////////////////////
if(menu2==11){
if(ir.value==IR_3){faza++;gr1=1;gr2=0;cl1();w2=1;faza_func();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){faza++;gr2=0;cl1();w2=1;faza_func();audio();}// кнопка >>>>>>
if(ir.value==IR_4){faza--;gr1=0;gr2=1;cl1();w2=1;faza_func();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){faza--;gr1=0;cl1();w2=1;faza_func();audio();}// кнопка <<<<<<
if (newPosition != oldPosition) {
oldPosition = newPosition;
faza=faza+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;faza_func();audio();}
lcd.setCursor(0,0);lcd.print("LPF Phase ");
lcd.setCursor(1,6);
switch(faza){
case 0: lcd.print(" 0");break;
case 1: lcd.print("180");break;}}
///////////////////// EEPROM ///////////////////////////////////////////////////////////////
if(millis()-time>10000 && w==1 && power==0){
EEPROM.update(0,vol+79);EEPROM.update(1,treb+20);EEPROM.update(2,middle+20);EEPROM.update(3,bass+20);EEPROM.update(4,in);
EEPROM.update(5,gain1);EEPROM.update(6,gain2);EEPROM.update(7,gain3);EEPROM.update(8,lon);EEPROM.update(9,lon_f);
EEPROM.update(10,rf);EEPROM.update(11,lf);EEPROM.update(12,rt);EEPROM.update(13,lt);EEPROM.update(14,sab);
EEPROM.update(15,treb_c);EEPROM.update(16,mid_c);EEPROM.update(17,bas_c);EEPROM.update(18,sab_f);EEPROM.update(19,treb_q);
EEPROM.update(20,mid_q);EEPROM.update(21,bas_q);EEPROM.update(22,faza);
menu2=100;menu=0;w=0;w2=1;cl();}
}// loop
void faza_func(){if(faza>1){faza=0;}if(faza<0){faza=1;}}
void bas_q_func(){if(bas_q>3){bas_q=0;}if(bas_q<0){bas_q=3;}}
void mid_q_func(){if(mid_q>3){mid_q=0;}if(mid_q<0){mid_q=3;}}
void treb_q_func(){if(treb_q>1){treb_q=0;}if(treb_q<0){treb_q=1;}}
void sab_f_func(){if(sab_f>4){sab_f=0;}if(sab_f<0){sab_f=4;}}
void bas_c_func(){if(bas_c>3){bas_c=0;}if(bas_c<0){bas_c=3;}}
void mid_c_func(){if(mid_c>3){mid_c=0;}if(mid_c<0){mid_c=3;}}
void treb_c_func(){if(treb_c>3){treb_c=0;}if(treb_c<0){treb_c=3;}}
void vol_out_func(){if(vol_out>15){vol_out=15;}if(vol_out<-79){vol_out=-79;}}
void lon_func(){if(lon>20){lon=20;}if(lon<0){lon=0;}}
void lon_f_func(){if(lon_f>3){lon_f=0;}if(lon_f<0){lon_f=3;}}
void gain_func(){if(gain0<0){gain0=0;}if(gain0>20){gain0=20;}}
void bass_func(){if(bass>20){bass=20;}if(bass<-20){bass=-20;}}
void middle_func(){if(middle>20){middle=20;}if(middle<-20){middle=-20;}}
void treb_func(){if(treb>20){treb=20;}if(treb<-20){treb=-20;}}
void vol_func(){if(vol<-79){vol=-79;}if(vol>15){vol=15;}}
void cl(){ir.value=0;delay(300);lcd.clear();}
void cl1(){ir.value=0;delay(100);}
void to_Timer(){newPosition = myEnc.read()/4;}
void audio(){
tda.setSetup_1(1,2,0); // default (1,2,0)
tda.setSetup_2(sab_f,1,0,faza);
// int sub_f ------ OFF 55Hz 85Hz 120Hz 160Hz = int 0...4
// int sub_out ---- LPF Front Rear Prohibition = int 0...3
// int level_metr - HOLD REST = int 0..1
// int faza ------- 0 180 = int 0...1
tda.setLoudness_f(lon_f); // 250Hz 400Hz 800Hz Prohibition = int 0...3
tda.setIn(in); // 0...2
tda.setIn_gain(gain0,mute); // in_gain -- 0...20 = 0...20 dB, mute -- 0 default
tda.setVol(vol); // -79...+15 dB = int -79...15
tda.setFront_1(rf); // -79...+15 dB = int -79...15
tda.setFront_2(lf); // -79...+15 dB = int -79...15
tda.setRear_1(rt); // -79...+15 dB = int -79...15
tda.setRear_2(lt); // -79...+15 dB = int -79...15
tda.setSub(sab); // -79...+15 dB = int -79...15
tda.mix();
tda.setBass_setup(bas_q,bas_c); // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
tda.setMiddle_setup(mid_q,mid_c); // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
tda.setTreble_setup(treb_q,treb_c); // 0.75 1.25 --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
tda.setBass_gain(bass); // --20 ... +20 dB = int -20 ... 20
tda.setMiddle_gain(middle); // --20 ... +20 dB = int -20 ... 20
tda.setTreble_gain(treb); // --20 ... +20 dB = int -20 ... 20
tda.setLoudness_gain(lon); // 0 ... 20 dB = int 0 ... 20
}