diff --git a/yoRadio/data/www/ir.css.gz b/yoRadio/data/www/ir.css.gz
new file mode 100644
index 0000000..c901046
Binary files /dev/null and b/yoRadio/data/www/ir.css.gz differ
diff --git a/yoRadio/data/www/ir.html b/yoRadio/data/www/ir.html
new file mode 100644
index 0000000..5007e80
--- /dev/null
+++ b/yoRadio/data/www/ir.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
ёRadio IR recorder
+
+
+
+
+
IR Recorder
+
+
+
+
▲
+
⏪
⏯
⏩
+
▼
+
1
2
3
+
4
5
6
+
7
8
9
+
*
0
#
+
+
+
+
+
powered by
ёRadio | v%VERSION%
+
+
+
diff --git a/yoRadio/data/www/ir.js.gz b/yoRadio/data/www/ir.js.gz
new file mode 100644
index 0000000..6a85b00
Binary files /dev/null and b/yoRadio/data/www/ir.js.gz differ
diff --git a/yoRadio/data/www/script.js.gz b/yoRadio/data/www/script.js.gz
index efde540..73a0ba8 100644
Binary files a/yoRadio/data/www/script.js.gz and b/yoRadio/data/www/script.js.gz differ
diff --git a/yoRadio/data/www/style.css.gz b/yoRadio/data/www/style.css.gz
index 497ec00..9d408f1 100644
Binary files a/yoRadio/data/www/style.css.gz and b/yoRadio/data/www/style.css.gz differ
diff --git a/yoRadio/netserver.cpp b/yoRadio/netserver.cpp
index 03542ef..14b7de0 100644
--- a/yoRadio/netserver.cpp
+++ b/yoRadio/netserver.cpp
@@ -36,7 +36,7 @@ char* updateError(){
bool NetServer::begin() {
importRequest = false;
-
+ irRecordEnable = false;
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
ssidCount = 0;
int mcb = heap_caps_get_free_size(MALLOC_CAP_8BIT);
@@ -73,6 +73,11 @@ bool NetServer::begin() {
webserver.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/www/update.html", String(), false, processor);
});
+#if IR_PIN!=255
+ webserver.on("/ir", HTTP_GET, [](AsyncWebServerRequest *request){
+ request->send(SPIFFS, "/www/ir.html", String(), false, processor);
+ });
+#endif
webserver.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
shouldReboot = !Update.hasError();
AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", shouldReboot?"OK": updateError());
@@ -139,7 +144,19 @@ void NetServer::loop() {
requestOnChange(NRSSI, 0);
}
}
-
+#if IR_PIN!=255
+void NetServer::irToWs(const char* protocol, uint64_t irvalue) {
+ char buf[BUFLEN] = { 0 };
+ sprintf (buf, "{\"ircode\": %llu, \"protocol\": \"%s\"}", irvalue, protocol);
+ websocket.textAll(buf);
+}
+void NetServer::irValsToWs(){
+ if(!irRecordEnable) return;
+ char buf[BUFLEN] = { 0 };
+ sprintf (buf, "{\"irvals\": [%llu, %llu, %llu]}", config.ircodes.irVals[config.irindex][0], config.ircodes.irVals[config.irindex][1], config.ircodes.irVals[config.irindex][2]);
+ websocket.textAll(buf);
+}
+#endif
void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len) {
AwsFrameInfo *info = (AwsFrameInfo*)arg;
if (info->final && info->index == 0 && info->len == len && info->opcode == WS_TEXT) {
@@ -150,6 +167,22 @@ void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len) {
byte v = atoi(val);
player.setVol(v, false);
}
+#if IR_PIN!=255
+ if (strcmp(cmd, "irbtn") == 0) {
+ config.irindex=atoi(val);
+ irRecordEnable=(config.irindex>=0);
+ config.irchck=0;
+ irValsToWs();
+ if(config.irindex<0) config.saveIR();
+ }
+ if (strcmp(cmd, "chkid") == 0) {
+ config.irchck=atoi(val);
+ }
+ if (strcmp(cmd, "irclr") == 0) {
+ byte cl = atoi(val);
+ config.ircodes.irVals[config.irindex][cl]=0;
+ }
+#endif
}
}
}
@@ -323,6 +356,9 @@ String processor(const String& var) { // %Templates%
if (var == "NOTAPMODE") {
return network.status == CONNECTED ? " hidden" : "";
}
+ if (var == "IRMODE") {
+ return IR_PIN == 255 ? "" : " ir";
+ }
return String();
}
diff --git a/yoRadio/netserver.h b/yoRadio/netserver.h
index 21b3416..62a562b 100644
--- a/yoRadio/netserver.h
+++ b/yoRadio/netserver.h
@@ -20,6 +20,11 @@ class NetServer {
void setRSSI(int val);
void onWsMessage(void *arg, uint8_t *data, size_t len);
bool savePlaylist(const char* post);
+#if IR_PIN!=255
+ bool irRecordEnable;
+ void irToWs(const char* protocol, uint64_t irvalue);
+ void irValsToWs();
+#endif
private:
requestType_e request;
int rssi;
diff --git a/yoRadio/options.h b/yoRadio/options.h
index 7127d9a..351a421 100644
--- a/yoRadio/options.h
+++ b/yoRadio/options.h
@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h
-#define VERSION "0.6.400"
+#define VERSION "0.6.450"
/*******************************************************
DO NOT EDIT THIS FILE.
@@ -242,65 +242,11 @@ INITR_REDTAB
#ifndef IR_PIN
#define IR_PIN 255
#endif
-#ifndef IR_DEBUG
- #define IR_DEBUG 0 // 1 - for capture ir codes from serial
-#endif
#ifndef IR_TIMEOUT
#define IR_TIMEOUT 80 // kTimeout, see IRremoteESP8266 documentation
#endif
#ifndef IR_TLP
#define IR_TLP 40 // kTolerancePercentage, see IRremoteESP8266 documentation
#endif
-#ifndef IR_CODE_PLAY
- #define IR_CODE_PLAY 0xFF02FD
-#endif
-#ifndef IR_CODE_PREV
- #define IR_CODE_PREV 0xFF22DD
-#endif
-#ifndef IR_CODE_NEXT
- #define IR_CODE_NEXT 0xFFC23D
-#endif
-#ifndef IR_CODE_VOLUP
- #define IR_CODE_VOLUP 0xFF629D
-#endif
-#ifndef IR_CODE_VOLDN
- #define IR_CODE_VOLDN 0xFFA857
-#endif
-#ifndef IR_CODE_NUM0
- #define IR_CODE_NUM0 0xFF4AB5
-#endif
-#ifndef IR_CODE_NUM1
- #define IR_CODE_NUM1 0xFF6897
-#endif
-#ifndef IR_CODE_NUM2
- #define IR_CODE_NUM2 0xFF9867
-#endif
-#ifndef IR_CODE_NUM3
- #define IR_CODE_NUM3 0xFFB04F
-#endif
-#ifndef IR_CODE_NUM4
- #define IR_CODE_NUM4 0xFF30CF
-#endif
-#ifndef IR_CODE_NUM5
- #define IR_CODE_NUM5 0xFF18E7
-#endif
-#ifndef IR_CODE_NUM6
- #define IR_CODE_NUM6 0xFF7A85
-#endif
-#ifndef IR_CODE_NUM7
- #define IR_CODE_NUM7 0xFF10EF
-#endif
-#ifndef IR_CODE_NUM8
- #define IR_CODE_NUM8 0xFF38C7
-#endif
-#ifndef IR_CODE_NUM9
- #define IR_CODE_NUM9 0xFF5AA5
-#endif
-#ifndef IR_CODE_HASH
- #define IR_CODE_HASH 0xFF52AD // Toggle playlist mode
-#endif
-#ifndef IR_CODE_AST
- #define IR_CODE_AST 0xFF42BD
-#endif
#endif
diff --git a/yoRadio/src/audioI2S/Audio.cpp b/yoRadio/src/audioI2S/Audio.cpp
index b12a7f5..4f36a69 100644
--- a/yoRadio/src/audioI2S/Audio.cpp
+++ b/yoRadio/src/audioI2S/Audio.cpp
@@ -164,7 +164,7 @@ Audio::Audio(bool internalDAC /* = false */, i2s_dac_mode_t channelEnabled /* =
m_i2s_config.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN );
#if ESP_ARDUINO_VERSION_MAJOR >= 2
- m_i2s_config.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_STAND_I2S); // vers >= 2.0.0
+ m_i2s_config.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_STAND_MSB); // vers >= 2.0.0
#else
m_i2s_config.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S_MSB);
#endif