v0.6.450
This commit is contained in:
29
Controls.md
29
Controls.md
@@ -51,14 +51,27 @@ You can connect one or two encoders to replace/complete the buttons. One encoder
|
|||||||
|
|
||||||
---
|
---
|
||||||
### IR receiver
|
### IR receiver
|
||||||
- IR_CODE_PLAY: start/stop playing
|
Starting from version 0.6.450, adding an IR remote control has been moved to the web interface. Can be added for up to three remotes.
|
||||||
- IR_CODE_PREV: previous station
|
1. go to Settings - IR (fig.1)
|
||||||
- IR_CODE_NEXT: next station
|
2. press the button you need on the left to record the IR code (fig.2)
|
||||||
- IR_CODE_VOLUP: volume up, longpress - quick volume up
|
|
||||||
- IR_CODE_VOLDN: volume down, longpress - quick volume down
|
<img src="images/irRecorder01.png" width="830" height="490"><br>
|
||||||
- IR_CODE_HASH: toggle between PLAYER/PLAYLIST mode
|
|
||||||
- IR_CODE_NUM0-NUM9:\
|
3. select the slot on the right and press the button on the physical IR remote (fig.3). Avoid the inscription "UNKNOWN" (fig.4)
|
||||||
Start entering the station number. To finish input and start playback, press the play button. To cancel, press hash.
|
|
||||||
|
<img src="images/irRecorder02.png" width="830" height="490"><br>
|
||||||
|
|
||||||
|
4. repeat steps 2 and 3 for other buttons
|
||||||
|
5. select BACK, select DONE
|
||||||
|
|
||||||
|
**Button assignment:**
|
||||||
|
- ⏯ - start/stop playing
|
||||||
|
- ⏪ - previous station
|
||||||
|
- ⏩ - next station
|
||||||
|
- ▲ - volume up, longpress - quick volume up
|
||||||
|
- ▼ - volume down, longpress - quick volume down
|
||||||
|
- **\#** - toggle between PLAYER/PLAYLIST mode
|
||||||
|
- **0-9** - Start entering the station number. To finish input and start playback, press the play button. To cancel, press hash.
|
||||||
|
|
||||||
---
|
---
|
||||||
### Joystick
|
### Joystick
|
||||||
|
|||||||
@@ -295,6 +295,11 @@ Work is in progress...
|
|||||||
|
|
||||||
---
|
---
|
||||||
## Version history
|
## Version history
|
||||||
|
#### v0.6.450
|
||||||
|
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!**
|
||||||
|
- adding an IR remote control has been moved to the web-interface (more info in [Controls.md](Controls.md#ir-receiver))
|
||||||
|
- fixed broken internal DAC on esp32 core 2.0.3 and highest
|
||||||
|
|
||||||
#### v0.6.400
|
#### v0.6.400
|
||||||
- fixed compilation errors with esp32 core 2.0.4
|
- fixed compilation errors with esp32 core 2.0.4
|
||||||
|
|
||||||
|
|||||||
@@ -115,27 +115,8 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
|||||||
|
|
||||||
/* IR control */
|
/* IR control */
|
||||||
//#define IR_PIN 255
|
//#define IR_PIN 255
|
||||||
//#define IR_DEBUG 0 /* Set this to 1, capture ir codes from serial, insert the captured codes below and set this back to 0 */
|
|
||||||
//#define IR_TIMEOUT 80 /* see kTimeout description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
|
//#define IR_TIMEOUT 80 /* see kTimeout description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
|
||||||
//#define IR_TLP 40 /* see kTolerancePercentage description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
|
//#define IR_TLP 40 /* see kTolerancePercentage description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
|
||||||
//#define IR_CODE_PLAY 0xFF02FD
|
|
||||||
//#define IR_CODE_PREV 0xFF22DD
|
|
||||||
//#define IR_CODE_NEXT 0xFFC23DP
|
|
||||||
//#define IR_CODE_VOLUP 0xFF629D
|
|
||||||
//#define IR_CODE_VOLDN 0xFFA857
|
|
||||||
//#define IR_CODE_NUM0 0xFF4AB5
|
|
||||||
//#define IR_CODE_NUM1 0xFF6897
|
|
||||||
//#define IR_CODE_NUM2 0xFF9867
|
|
||||||
//#define IR_CODE_NUM3 0xFFB04F
|
|
||||||
//#define IR_CODE_NUM4 0xFF30CF
|
|
||||||
//#define IR_CODE_NUM5 0xFF18E7
|
|
||||||
//#define IR_CODE_NUM6 0xFF7A85
|
|
||||||
//#define IR_CODE_NUM7 0xFF10EF
|
|
||||||
//#define IR_CODE_NUM8 0xFF38C7
|
|
||||||
//#define IR_CODE_NUM9 0xFF5AA5
|
|
||||||
//#define IR_CODE_HASH 0xFF52AD /* Toggle playlist mode */
|
|
||||||
//#define IR_CODE_AST 0xFF42BD /* Not used */
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
|
|||||||
BIN
images/irRecorder01.png
Normal file
BIN
images/irRecorder01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 241 KiB |
BIN
images/irRecorder02.png
Normal file
BIN
images/irRecorder02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
@@ -7,6 +7,9 @@ Config config;
|
|||||||
|
|
||||||
void Config::init() {
|
void Config::init() {
|
||||||
EEPROM.begin(EEPROM_SIZE);
|
EEPROM.begin(EEPROM_SIZE);
|
||||||
|
#if IR_PIN!=255
|
||||||
|
irindex=-1;
|
||||||
|
#endif
|
||||||
eepromRead(EEPROM_START, store);
|
eepromRead(EEPROM_START, store);
|
||||||
if (store.tz_set != 57) { // update to v0.4.200
|
if (store.tz_set != 57) { // update to v0.4.200
|
||||||
store.tz_set = 57;
|
store.tz_set = 57;
|
||||||
@@ -26,6 +29,13 @@ void Config::init() {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
loadStation(store.lastStation);
|
loadStation(store.lastStation);
|
||||||
|
#if IR_PIN!=255
|
||||||
|
eepromRead(EEPROM_START_IR, ircodes);
|
||||||
|
if(ircodes.ir_set!=4224){
|
||||||
|
ircodes.ir_set=4224;
|
||||||
|
memset(ircodes.irVals, 0, sizeof(ircodes.irVals));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> int Config::eepromWrite(int ee, const T& value) {
|
template <class T> int Config::eepromWrite(int ee, const T& value) {
|
||||||
@@ -82,6 +92,12 @@ void Config::save() {
|
|||||||
eepromWrite(EEPROM_START, store);
|
eepromWrite(EEPROM_START, store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IR_PIN!=255
|
||||||
|
void Config::saveIR(){
|
||||||
|
eepromWrite(EEPROM_START_IR, ircodes);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
byte Config::setVolume(byte val, bool dosave) {
|
byte Config::setVolume(byte val, bool dosave) {
|
||||||
store.volume = val;
|
store.volume = val;
|
||||||
if (dosave) {
|
if (dosave) {
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
#ifndef config_h
|
#ifndef config_h
|
||||||
#define config_h
|
#define config_h
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#define EEPROM_SIZE 32
|
#define EEPROM_SIZE 768
|
||||||
#define EEPROM_START 0
|
#define EEPROM_START 0
|
||||||
#define BUFLEN 140
|
#define EEPROM_START_IR 100
|
||||||
#define PLAYLIST_PATH "/data/playlist.csv"
|
#define BUFLEN 140
|
||||||
#define SSIDS_PATH "/data/wifi.csv"
|
#define PLAYLIST_PATH "/data/playlist.csv"
|
||||||
#define TMP_PATH "/data/tmpfile.txt"
|
#define SSIDS_PATH "/data/wifi.csv"
|
||||||
#define INDEX_PATH "/data/index.dat"
|
#define TMP_PATH "/data/tmpfile.txt"
|
||||||
|
#define INDEX_PATH "/data/index.dat"
|
||||||
|
|
||||||
struct config_t
|
struct config_t
|
||||||
{
|
{
|
||||||
@@ -29,6 +31,14 @@ struct config_t
|
|||||||
uint16_t timezoneOffset;
|
uint16_t timezoneOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if IR_PIN!=255
|
||||||
|
struct ircodes_t
|
||||||
|
{
|
||||||
|
unsigned int ir_set; //must be 4224
|
||||||
|
uint64_t irVals[20][3];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct station_t
|
struct station_t
|
||||||
{
|
{
|
||||||
char name[BUFLEN];
|
char name[BUFLEN];
|
||||||
@@ -48,11 +58,19 @@ class Config {
|
|||||||
public:
|
public:
|
||||||
config_t store;
|
config_t store;
|
||||||
station_t station;
|
station_t station;
|
||||||
|
#if IR_PIN!=255
|
||||||
|
int irindex;
|
||||||
|
uint8_t irchck;
|
||||||
|
ircodes_t ircodes;
|
||||||
|
#endif
|
||||||
neworkItem ssids[5];
|
neworkItem ssids[5];
|
||||||
byte ssidsCount;
|
byte ssidsCount;
|
||||||
public:
|
public:
|
||||||
Config() {};
|
Config() {};
|
||||||
void save();
|
void save();
|
||||||
|
#if IR_PIN!=255
|
||||||
|
void saveIR();
|
||||||
|
#endif
|
||||||
void init();
|
void init();
|
||||||
byte setVolume(byte val, bool dosave);
|
byte setVolume(byte val, bool dosave);
|
||||||
void setTone(int8_t bass, int8_t middle, int8_t trebble);
|
void setTone(int8_t bass, int8_t middle, int8_t trebble);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "netserver.h"
|
||||||
|
|
||||||
long encOldPosition = 0;
|
long encOldPosition = 0;
|
||||||
long enc2OldPosition = 0;
|
long enc2OldPosition = 0;
|
||||||
@@ -210,8 +211,12 @@ void irNum(byte num) {
|
|||||||
|
|
||||||
void irLoop() {
|
void irLoop() {
|
||||||
if (irrecv.decode(&irResults)) {
|
if (irrecv.decode(&irResults)) {
|
||||||
if (IR_DEBUG) {
|
if(irResults.value<256) return;
|
||||||
|
if (netserver.irRecordEnable) {
|
||||||
Serial.print(resultToHumanReadableBasic(&irResults));
|
Serial.print(resultToHumanReadableBasic(&irResults));
|
||||||
|
Serial.println("--------------------------");
|
||||||
|
config.ircodes.irVals[config.irindex][config.irchck]=irResults.value;
|
||||||
|
netserver.irToWs(typeToString(irResults.decode_type, irResults.repeat).c_str(), irResults.value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!irResults.repeat/* && irResults.command!=0*/) {
|
if (!irResults.repeat/* && irResults.command!=0*/) {
|
||||||
@@ -227,88 +232,99 @@ void irLoop() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (irResults.value) {
|
for(int target=0; target<17; target++){
|
||||||
case IR_CODE_PLAY: {
|
for(int j=0; j<3; j++){
|
||||||
irBlink();
|
if(config.ircodes.irVals[target][j]==irResults.value){
|
||||||
if (display.mode == NUMBERS) {
|
switch (target){
|
||||||
display.putRequest({NEWMODE, PLAYER});
|
case IR_PLAY: {
|
||||||
player.play(display.numOfNextStation);
|
irBlink();
|
||||||
display.numOfNextStation = 0;
|
if (display.mode == NUMBERS) {
|
||||||
break;
|
display.putRequest({NEWMODE, PLAYER});
|
||||||
}
|
player.play(display.numOfNextStation);
|
||||||
onBtnClick(1);
|
display.numOfNextStation = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
onBtnClick(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_PREV: {
|
||||||
|
player.prev();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_NEXT: {
|
||||||
|
player.next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_UP: {
|
||||||
|
controlsEvent(display.mode == STATIONS ? false : true);
|
||||||
|
irVolRepeat = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_DOWN: {
|
||||||
|
controlsEvent(display.mode == STATIONS ? true : false);
|
||||||
|
irVolRepeat = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_HASH: {
|
||||||
|
if (display.mode == NUMBERS) {
|
||||||
|
display.putRequest({RETURNTITLE, 0});
|
||||||
|
display.putRequest({NEWMODE, PLAYER});
|
||||||
|
display.numOfNextStation = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
display.putRequest({NEWMODE, display.mode == PLAYER ? STATIONS : PLAYER});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_0: {
|
||||||
|
irNum(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_1: {
|
||||||
|
irNum(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_2: {
|
||||||
|
irNum(2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_3: {
|
||||||
|
irNum(3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_4: {
|
||||||
|
irNum(4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_5: {
|
||||||
|
irNum(5);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_6: {
|
||||||
|
irNum(6);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_7: {
|
||||||
|
irNum(7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_8: {
|
||||||
|
irNum(8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_9: {
|
||||||
|
irNum(9);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IR_AST: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} /* switch (target) */
|
||||||
|
target=17;
|
||||||
break;
|
break;
|
||||||
}
|
} /* if(config.ircodes.irVals[target][j]==irResults.value) */
|
||||||
case IR_CODE_PREV: {
|
} /* for(int j=0; j<3; j++) */
|
||||||
player.prev();
|
} /* for(int target=0; target<16; target++) */
|
||||||
break;
|
} /* if (irrecv.decode(&irResults)) */
|
||||||
}
|
|
||||||
case IR_CODE_NEXT: {
|
|
||||||
player.next();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_VOLUP: {
|
|
||||||
controlsEvent(display.mode == STATIONS ? false : true);
|
|
||||||
irVolRepeat = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_VOLDN: {
|
|
||||||
controlsEvent(display.mode == STATIONS ? true : false);
|
|
||||||
irVolRepeat = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_HASH: {
|
|
||||||
if (display.mode == NUMBERS) {
|
|
||||||
display.putRequest({RETURNTITLE, 0});
|
|
||||||
display.putRequest({NEWMODE, PLAYER});
|
|
||||||
display.numOfNextStation = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
display.putRequest({NEWMODE, display.mode == PLAYER ? STATIONS : PLAYER});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM0: {
|
|
||||||
irNum(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM1: {
|
|
||||||
irNum(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM2: {
|
|
||||||
irNum(2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM3: {
|
|
||||||
irNum(3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM4: {
|
|
||||||
irNum(4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM5: {
|
|
||||||
irNum(5);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM6: {
|
|
||||||
irNum(6);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM7: {
|
|
||||||
irNum(7);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM8: {
|
|
||||||
irNum(8);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IR_CODE_NUM9: {
|
|
||||||
irNum(9);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // if IR_PIN!=255
|
#endif // if IR_PIN!=255
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
#ifndef controls_h
|
#ifndef controls_h
|
||||||
#define controls_h
|
#define controls_h
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
enum controlEvt_e { EVT_BTNLEFT, EVT_BTNCENTER, EVT_BTNRIGHT, EVT_ENCBTNB, EVT_BTNUP, EVT_BTNDOWN, EVT_ENC2BTNB };
|
enum controlEvt_e { EVT_BTNLEFT, EVT_BTNCENTER, EVT_BTNRIGHT, EVT_ENCBTNB, EVT_BTNUP, EVT_BTNDOWN, EVT_ENC2BTNB };
|
||||||
|
|
||||||
enum tsDirection_e { TSD_STAY, TSD_LEFT, TSD_RIGHT, TSD_UP, TSD_DOWN, TDS_REQUEST };
|
enum tsDirection_e { TSD_STAY, TSD_LEFT, TSD_RIGHT, TSD_UP, TSD_DOWN, TDS_REQUEST };
|
||||||
|
|
||||||
|
#if IR_PIN!=255
|
||||||
|
enum : uint8_t { IR_UP=0, IR_PREV=1, IR_PLAY=2, IR_NEXT=3, IR_DOWN=4, IR_1=5, IR_2=6, IR_3=7, IR_4=8, IR_5=9, IR_6=10, IR_7=11, IR_8=12, IR_9=13, IR_AST=14, IR_0=15, IR_HASH=16 };
|
||||||
|
#endif
|
||||||
|
|
||||||
boolean checklpdelay(int m, unsigned long &tstamp);
|
boolean checklpdelay(int m, unsigned long &tstamp);
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,10 @@
|
|||||||
<div id="navbar"%APMODE%>
|
<div id="navbar"%APMODE%>
|
||||||
<div class="playerbytton navbutton" id="playlistbutton" onclick="showEditor()"></div>
|
<div class="playerbytton navbutton" id="playlistbutton" onclick="showEditor()"></div>
|
||||||
<div class="playerbytton navbutton" id="settingsbutton" onclick="event.stopPropagation(); showSettings()"></div>
|
<div class="playerbytton navbutton" id="settingsbutton" onclick="event.stopPropagation(); showSettings()"></div>
|
||||||
<div id="settingspopup" class="hidden">
|
<div id="settingspopup" class="hidden%IRMODE%">
|
||||||
<div class="button" id="settingsbuttonwifi" onclick="showSettingsWifi()">Wi-Fi</div>
|
<div class="button" id="settingsbuttonwifi" onclick="showSettingsWifi()">Wi-Fi</div>
|
||||||
<div class="button" id="settingsbuttonupload" onclick="showSettingsUoload()">Update</div>
|
<div class="button" id="settingsbuttonir" onclick="location.href='/ir'">IR</div>
|
||||||
|
<div class="button" id="settingsbuttonupload" onclick="showSettingsUpload()">Update</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="playerwrap">
|
<div class="playerwrap">
|
||||||
|
|||||||
BIN
yoRadio/data/www/ir.css.gz
Normal file
BIN
yoRadio/data/www/ir.css.gz
Normal file
Binary file not shown.
49
yoRadio/data/www/ir.html
Normal file
49
yoRadio/data/www/ir.html
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, minimum-scale=0.25">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" href="elogo.png">
|
||||||
|
<link rel="icon" type="image/png" href="elogo.png">
|
||||||
|
<link rel="stylesheet" title="base" href="style.css" type="text/css">
|
||||||
|
<link rel="stylesheet" title="base" href="ir.css" type="text/css">
|
||||||
|
<title>ёRadio IR recorder</title>
|
||||||
|
<style> </style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<h2 class="irtitle">IR Recorder</h2>
|
||||||
|
<div class="playerwrap">
|
||||||
|
<div class="irwrap">
|
||||||
|
<div id="irremote">
|
||||||
|
<div class="irblank"></div><div class="irbutton blue">▲</div><div class="irblank"></div>
|
||||||
|
<div class="irbutton blue">⏪</div><div class="irbutton red">⏯</div><div class="irbutton blue">⏩</div>
|
||||||
|
<div class="irblank"></div><div class="irbutton blue">▼</div><div class="irblank"></div>
|
||||||
|
<div class="irbutton">1</div><div class="irbutton">2</div><div class="irbutton">3</div>
|
||||||
|
<div class="irbutton">4</div><div class="irbutton">5</div><div class="irbutton">6</div>
|
||||||
|
<div class="irbutton">7</div><div class="irbutton">8</div><div class="irbutton">9</div>
|
||||||
|
<div class="irbutton red">*</div><div class="irbutton">0</div><div class="irbutton red">#</div>
|
||||||
|
</div><!--irremote-->
|
||||||
|
<div id="irform">
|
||||||
|
<div id="irstartrecord"><h3>Welcome to IR Recorder!</h3>
|
||||||
|
Press the button on the left<br />to record the code.
|
||||||
|
<a href="/" class="button" id="done_ir" onclick="doneRecord()">DONE</a>
|
||||||
|
</div>
|
||||||
|
<div id="irrecord" class="hidden">
|
||||||
|
<h3 id="irrecordtitle"></h3>
|
||||||
|
<form id="irrecordfields">
|
||||||
|
<div class="irrecordrow"><div class="irradio" data-id="0"><span></span></div><div class="irrecordvalue">0xAF00B5</div><div class="irclear" onclick="irClear(this)"></div></div>
|
||||||
|
<div class="irrecordrow"><div class="irradio" data-id="1"><span></span></div><div class="irrecordvalue"></div><div class="irclear" onclick="irClear(this)"></div></div>
|
||||||
|
<div class="irrecordrow"><div class="irradio" data-id="2"><span></span></div><div class="irrecordvalue"></div><div class="irclear" onclick="irClear(this)"></div></div>
|
||||||
|
</form>
|
||||||
|
<div id="protocol"></div>
|
||||||
|
<div class="button" id="back_ir" onclick="backRecord()">Back</div>
|
||||||
|
</div>
|
||||||
|
</div><!--irform-->
|
||||||
|
</div><!--irwrap-->
|
||||||
|
</div><!--playerwrap-->
|
||||||
|
<div id="copy">powered by <a target="_blank" href="https://github.com/e2002/yoradio/">ёRadio</a> | v%VERSION%</div>
|
||||||
|
</div>
|
||||||
|
<script src="ir.js"></script>
|
||||||
|
</body>
|
||||||
BIN
yoRadio/data/www/ir.js.gz
Normal file
BIN
yoRadio/data/www/ir.js.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -36,7 +36,7 @@ char* updateError(){
|
|||||||
|
|
||||||
bool NetServer::begin() {
|
bool NetServer::begin() {
|
||||||
importRequest = false;
|
importRequest = false;
|
||||||
|
irRecordEnable = false;
|
||||||
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
|
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
|
||||||
ssidCount = 0;
|
ssidCount = 0;
|
||||||
int mcb = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
int mcb = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||||
@@ -73,6 +73,11 @@ bool NetServer::begin() {
|
|||||||
webserver.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
webserver.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(SPIFFS, "/www/update.html", String(), false, processor);
|
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){
|
webserver.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||||
shouldReboot = !Update.hasError();
|
shouldReboot = !Update.hasError();
|
||||||
AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", shouldReboot?"OK": updateError());
|
AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", shouldReboot?"OK": updateError());
|
||||||
@@ -139,7 +144,19 @@ void NetServer::loop() {
|
|||||||
requestOnChange(NRSSI, 0);
|
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) {
|
void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len) {
|
||||||
AwsFrameInfo *info = (AwsFrameInfo*)arg;
|
AwsFrameInfo *info = (AwsFrameInfo*)arg;
|
||||||
if (info->final && info->index == 0 && info->len == len && info->opcode == WS_TEXT) {
|
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);
|
byte v = atoi(val);
|
||||||
player.setVol(v, false);
|
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") {
|
if (var == "NOTAPMODE") {
|
||||||
return network.status == CONNECTED ? " hidden" : "";
|
return network.status == CONNECTED ? " hidden" : "";
|
||||||
}
|
}
|
||||||
|
if (var == "IRMODE") {
|
||||||
|
return IR_PIN == 255 ? "" : " ir";
|
||||||
|
}
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class NetServer {
|
|||||||
void setRSSI(int val);
|
void setRSSI(int val);
|
||||||
void onWsMessage(void *arg, uint8_t *data, size_t len);
|
void onWsMessage(void *arg, uint8_t *data, size_t len);
|
||||||
bool savePlaylist(const char* post);
|
bool savePlaylist(const char* post);
|
||||||
|
#if IR_PIN!=255
|
||||||
|
bool irRecordEnable;
|
||||||
|
void irToWs(const char* protocol, uint64_t irvalue);
|
||||||
|
void irValsToWs();
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
requestType_e request;
|
requestType_e request;
|
||||||
int rssi;
|
int rssi;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define VERSION "0.6.400"
|
#define VERSION "0.6.450"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
@@ -242,65 +242,11 @@ INITR_REDTAB
|
|||||||
#ifndef IR_PIN
|
#ifndef IR_PIN
|
||||||
#define IR_PIN 255
|
#define IR_PIN 255
|
||||||
#endif
|
#endif
|
||||||
#ifndef IR_DEBUG
|
|
||||||
#define IR_DEBUG 0 // 1 - for capture ir codes from serial
|
|
||||||
#endif
|
|
||||||
#ifndef IR_TIMEOUT
|
#ifndef IR_TIMEOUT
|
||||||
#define IR_TIMEOUT 80 // kTimeout, see IRremoteESP8266 documentation
|
#define IR_TIMEOUT 80 // kTimeout, see IRremoteESP8266 documentation
|
||||||
#endif
|
#endif
|
||||||
#ifndef IR_TLP
|
#ifndef IR_TLP
|
||||||
#define IR_TLP 40 // kTolerancePercentage, see IRremoteESP8266 documentation
|
#define IR_TLP 40 // kTolerancePercentage, see IRremoteESP8266 documentation
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|||||||
@@ -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 );
|
m_i2s_config.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN );
|
||||||
|
|
||||||
#if ESP_ARDUINO_VERSION_MAJOR >= 2
|
#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
|
#else
|
||||||
m_i2s_config.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S_MSB);
|
m_i2s_config.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S_MSB);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user