diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 3d67e33..527178b 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -710,7 +710,7 @@ void setup() { setupmode = false; if (edgebeep) radio.tone(50, -5, 2000); - + radio.I2Sin(true); if (screensaverset) { ScreensaverTimerInit(); ScreensaverTimerSet(screensaverOptions[screensaverset]); diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 35b461e..5481195 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -1569,6 +1569,10 @@ void TEF6686::tone(uint16_t time, int16_t amplitude, uint16_t frequency) { devTEF_Radio_Set_Wavegen(0, 0, 0); } +void TEF6686::I2Sin(bool mode) { + devTEF_Radio_Set_I2S_Input(mode); +} + String TEF6686::convertToUTF8(const wchar_t* input) { String output; while (*input) { diff --git a/src/TEF6686.h b/src/TEF6686.h index ba8c95f..ae29208 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -1,4 +1,4 @@ -#ifndef TEF6686_H +ifndef TEF6686_H #define TEF6686_H #include "Arduino.h" @@ -655,6 +655,7 @@ class TEF6686 { bool getStatus(int16_t &level, uint16_t &USN, uint16_t &WAM, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr); bool getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel, int16_t &offset, uint16_t &bandwidth, uint16_t &modulation, int8_t &snr); bool getIdentification(uint16_t &device, uint16_t &hw_version, uint16_t &sw_version); + void I2Sin(bool mode); void setSoftmuteFM(uint8_t mode); void setSoftmuteAM(uint8_t mode); void setMono(bool mono); diff --git a/src/Tuner_Drv_Lithio.cpp b/src/Tuner_Drv_Lithio.cpp index bf2a3c8..ace82cf 100644 --- a/src/Tuner_Drv_Lithio.cpp +++ b/src/Tuner_Drv_Lithio.cpp @@ -234,7 +234,7 @@ bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16 *mod = Convert8bto16b(buf + 12) / 10; if (*level < -200) *level = -200; if (*level > 1200) *level = 1200; - *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise/50) / 10) + 10; + *snr = int(0.46222375 * (float)(*level) / 10 - 0.082495118 * (float)(*noise / 50) / 10) + 10; return r; } @@ -290,3 +290,11 @@ bool devTEF_Radio_Set_Wavegen(bool mode, int16_t amplitude, uint16_t freq) { return devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_WaveGen, 15, 0); } } + +bool devTEF_Radio_Set_I2S_Input(bool mode) { + if (mode) { + return devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Input, 5, 32); + } else { + return devTEF_Set_Cmd(TEF_AUDIO, Cmd_Set_Input, 5, 0); + } +} \ No newline at end of file diff --git a/src/Tuner_Drv_Lithio.h b/src/Tuner_Drv_Lithio.h index 79a41de..56dd4c3 100644 --- a/src/Tuner_Drv_Lithio.h +++ b/src/Tuner_Drv_Lithio.h @@ -107,5 +107,6 @@ bool devTEF_Radio_Set_StHiBlend_Noise(uint8_t mode, uint16_t start, uint16_t slo bool devTEF_Radio_Set_StHiBlend_Mph(uint8_t mode, uint16_t start, uint16_t slope); bool devTEF_Radio_Set_NoisBlanker(uint8_t mode, uint16_t start); bool devTEF_Radio_Set_Wavegen(bool mode, int16_t amplitude, uint16_t freq); +bool devTEF_Radio_Set_I2S_Input(bool mode); #endif \ No newline at end of file diff --git a/src/Tuner_Interface.cpp b/src/Tuner_Interface.cpp index 4f96014..917f45a 100644 --- a/src/Tuner_Interface.cpp +++ b/src/Tuner_Interface.cpp @@ -30,7 +30,8 @@ static const unsigned char tuner_init_tab[] = { 9, 0x20, 0x4A, 0x01, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x8C, 7, 0x20, 0x4B, 0x01, 0x00, 0x00, 0x0F, 0xA0, 5, 0x20, 0x56, 0x01, 0x03, 0x84, - 7, 0x30, 0x15, 0x01, 0x00, 0x80, 0x00, 0x01 + 7, 0x30, 0x15, 0x01, 0x00, 0x80, 0x00, 0x01, + 13, 0x30, 0x16, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x12, 0xc0 }; static const unsigned char tuner_init_tab4000[] = {