Skip to content

Commit f065d15

Browse files
committed
v0.6.450
1 parent f1186e0 commit f065d15

File tree

19 files changed

+266
-176
lines changed

19 files changed

+266
-176
lines changed

Controls.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,27 @@ You can connect one or two encoders to replace/complete the buttons. One encoder
5151

5252
---
5353
### IR receiver
54-
- IR_CODE_PLAY: start/stop playing
55-
- IR_CODE_PREV: previous station
56-
- IR_CODE_NEXT: next station
57-
- IR_CODE_VOLUP: volume up, longpress - quick volume up
58-
- IR_CODE_VOLDN: volume down, longpress - quick volume down
59-
- IR_CODE_HASH: toggle between PLAYER/PLAYLIST mode
60-
- IR_CODE_NUM0-NUM9:\
61-
Start entering the station number. To finish input and start playback, press the play button. To cancel, press hash.
54+
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.
55+
1. go to Settings - IR (fig.1)
56+
2. press the button you need on the left to record the IR code (fig.2)
57+
58+
<img src="images/irRecorder01.png" width="830" height="490"><br>
59+
60+
3. select the slot on the right and press the button on the physical IR remote (fig.3). Avoid the inscription "UNKNOWN" (fig.4)
61+
62+
<img src="images/irRecorder02.png" width="830" height="490"><br>
63+
64+
4. repeat steps 2 and 3 for other buttons
65+
5. select BACK, select DONE
66+
67+
**Button assignment:**
68+
- &#9199; - start/stop playing
69+
- &#9194; - previous station
70+
- &#9193; - next station
71+
- &#9650; - volume up, longpress - quick volume up
72+
- &#9660; - volume down, longpress - quick volume down
73+
- &nbsp;**\#** &nbsp;- toggle between PLAYER/PLAYLIST mode
74+
- **0-9** - Start entering the station number. To finish input and start playback, press the play button. To cancel, press hash.
6275

6376
---
6477
### Joystick

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ Work is in progress...
295295

296296
---
297297
## Version history
298+
#### v0.6.450
299+
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!**
300+
- adding an IR remote control has been moved to the web-interface (more info in [Controls.md](Controls.md#ir-receiver))
301+
- fixed broken internal DAC on esp32 core 2.0.3 and highest
302+
298303
#### v0.6.400
299304
- fixed compilation errors with esp32 core 2.0.4
300305

exsamples/myoptions.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,8 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
115115

116116
/* IR control */
117117
//#define IR_PIN 255
118-
//#define IR_DEBUG 0 /* Set this to 1, capture ir codes from serial, insert the captured codes below and set this back to 0 */
119118
//#define IR_TIMEOUT 80 /* see kTimeout description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
120119
//#define IR_TLP 40 /* see kTolerancePercentage description in IRremoteESP8266 exsample https://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino */
121-
//#define IR_CODE_PLAY 0xFF02FD
122-
//#define IR_CODE_PREV 0xFF22DD
123-
//#define IR_CODE_NEXT 0xFFC23DP
124-
//#define IR_CODE_VOLUP 0xFF629D
125-
//#define IR_CODE_VOLDN 0xFFA857
126-
//#define IR_CODE_NUM0 0xFF4AB5
127-
//#define IR_CODE_NUM1 0xFF6897
128-
//#define IR_CODE_NUM2 0xFF9867
129-
//#define IR_CODE_NUM3 0xFFB04F
130-
//#define IR_CODE_NUM4 0xFF30CF
131-
//#define IR_CODE_NUM5 0xFF18E7
132-
//#define IR_CODE_NUM6 0xFF7A85
133-
//#define IR_CODE_NUM7 0xFF10EF
134-
//#define IR_CODE_NUM8 0xFF38C7
135-
//#define IR_CODE_NUM9 0xFF5AA5
136-
//#define IR_CODE_HASH 0xFF52AD /* Toggle playlist mode */
137-
//#define IR_CODE_AST 0xFF42BD /* Not used */
138-
139120

140121
/******************************************/
141122

images/irRecorder01.png

241 KB
Loading

images/irRecorder02.png

141 KB
Loading

yoRadio/config.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Config config;
77

88
void Config::init() {
99
EEPROM.begin(EEPROM_SIZE);
10+
#if IR_PIN!=255
11+
irindex=-1;
12+
#endif
1013
eepromRead(EEPROM_START, store);
1114
if (store.tz_set != 57) { // update to v0.4.200
1215
store.tz_set = 57;
@@ -26,6 +29,13 @@ void Config::init() {
2629
save();
2730
}
2831
loadStation(store.lastStation);
32+
#if IR_PIN!=255
33+
eepromRead(EEPROM_START_IR, ircodes);
34+
if(ircodes.ir_set!=4224){
35+
ircodes.ir_set=4224;
36+
memset(ircodes.irVals, 0, sizeof(ircodes.irVals));
37+
}
38+
#endif
2939
}
3040

3141
template <class T> int Config::eepromWrite(int ee, const T& value) {
@@ -82,6 +92,12 @@ void Config::save() {
8292
eepromWrite(EEPROM_START, store);
8393
}
8494

95+
#if IR_PIN!=255
96+
void Config::saveIR(){
97+
eepromWrite(EEPROM_START_IR, ircodes);
98+
}
99+
#endif
100+
85101
byte Config::setVolume(byte val, bool dosave) {
86102
store.volume = val;
87103
if (dosave) {

yoRadio/config.h

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#ifndef config_h
22
#define config_h
33
#include "Arduino.h"
4+
#include "options.h"
45

5-
#define EEPROM_SIZE 32
6-
#define EEPROM_START 0
7-
#define BUFLEN 140
8-
#define PLAYLIST_PATH "/data/playlist.csv"
9-
#define SSIDS_PATH "/data/wifi.csv"
10-
#define TMP_PATH "/data/tmpfile.txt"
11-
#define INDEX_PATH "/data/index.dat"
6+
#define EEPROM_SIZE 768
7+
#define EEPROM_START 0
8+
#define EEPROM_START_IR 100
9+
#define BUFLEN 140
10+
#define PLAYLIST_PATH "/data/playlist.csv"
11+
#define SSIDS_PATH "/data/wifi.csv"
12+
#define TMP_PATH "/data/tmpfile.txt"
13+
#define INDEX_PATH "/data/index.dat"
1214

1315
struct config_t
1416
{
@@ -29,6 +31,14 @@ struct config_t
2931
uint16_t timezoneOffset;
3032
};
3133

34+
#if IR_PIN!=255
35+
struct ircodes_t
36+
{
37+
unsigned int ir_set; //must be 4224
38+
uint64_t irVals[20][3];
39+
};
40+
#endif
41+
3242
struct station_t
3343
{
3444
char name[BUFLEN];
@@ -48,11 +58,19 @@ class Config {
4858
public:
4959
config_t store;
5060
station_t station;
61+
#if IR_PIN!=255
62+
int irindex;
63+
uint8_t irchck;
64+
ircodes_t ircodes;
65+
#endif
5166
neworkItem ssids[5];
5267
byte ssidsCount;
5368
public:
5469
Config() {};
5570
void save();
71+
#if IR_PIN!=255
72+
void saveIR();
73+
#endif
5674
void init();
5775
byte setVolume(byte val, bool dosave);
5876
void setTone(int8_t bass, int8_t middle, int8_t trebble);

yoRadio/controls.cpp

Lines changed: 98 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "config.h"
55
#include "player.h"
66
#include "display.h"
7+
#include "netserver.h"
78

89
long encOldPosition = 0;
910
long enc2OldPosition = 0;
@@ -210,8 +211,12 @@ void irNum(byte num) {
210211

211212
void irLoop() {
212213
if (irrecv.decode(&irResults)) {
213-
if (IR_DEBUG) {
214+
if(irResults.value<256) return;
215+
if (netserver.irRecordEnable) {
214216
Serial.print(resultToHumanReadableBasic(&irResults));
217+
Serial.println("--------------------------");
218+
config.ircodes.irVals[config.irindex][config.irchck]=irResults.value;
219+
netserver.irToWs(typeToString(irResults.decode_type, irResults.repeat).c_str(), irResults.value);
215220
return;
216221
}
217222
if (!irResults.repeat/* && irResults.command!=0*/) {
@@ -227,88 +232,99 @@ void irLoop() {
227232
break;
228233
}
229234
}
230-
switch (irResults.value) {
231-
case IR_CODE_PLAY: {
232-
irBlink();
233-
if (display.mode == NUMBERS) {
234-
display.putRequest({NEWMODE, PLAYER});
235-
player.play(display.numOfNextStation);
236-
display.numOfNextStation = 0;
237-
break;
238-
}
239-
onBtnClick(1);
240-
break;
241-
}
242-
case IR_CODE_PREV: {
243-
player.prev();
244-
break;
245-
}
246-
case IR_CODE_NEXT: {
247-
player.next();
248-
break;
249-
}
250-
case IR_CODE_VOLUP: {
251-
controlsEvent(display.mode == STATIONS ? false : true);
252-
irVolRepeat = 1;
253-
break;
254-
}
255-
case IR_CODE_VOLDN: {
256-
controlsEvent(display.mode == STATIONS ? true : false);
257-
irVolRepeat = 2;
258-
break;
259-
}
260-
case IR_CODE_HASH: {
261-
if (display.mode == NUMBERS) {
262-
display.putRequest({RETURNTITLE, 0});
263-
display.putRequest({NEWMODE, PLAYER});
264-
display.numOfNextStation = 0;
265-
break;
266-
}
267-
display.putRequest({NEWMODE, display.mode == PLAYER ? STATIONS : PLAYER});
268-
break;
269-
}
270-
case IR_CODE_NUM0: {
271-
irNum(0);
272-
break;
273-
}
274-
case IR_CODE_NUM1: {
275-
irNum(1);
276-
break;
277-
}
278-
case IR_CODE_NUM2: {
279-
irNum(2);
280-
break;
281-
}
282-
case IR_CODE_NUM3: {
283-
irNum(3);
284-
break;
285-
}
286-
case IR_CODE_NUM4: {
287-
irNum(4);
288-
break;
289-
}
290-
case IR_CODE_NUM5: {
291-
irNum(5);
292-
break;
293-
}
294-
case IR_CODE_NUM6: {
295-
irNum(6);
296-
break;
297-
}
298-
case IR_CODE_NUM7: {
299-
irNum(7);
300-
break;
301-
}
302-
case IR_CODE_NUM8: {
303-
irNum(8);
304-
break;
305-
}
306-
case IR_CODE_NUM9: {
307-
irNum(9);
235+
for(int target=0; target<17; target++){
236+
for(int j=0; j<3; j++){
237+
if(config.ircodes.irVals[target][j]==irResults.value){
238+
switch (target){
239+
case IR_PLAY: {
240+
irBlink();
241+
if (display.mode == NUMBERS) {
242+
display.putRequest({NEWMODE, PLAYER});
243+
player.play(display.numOfNextStation);
244+
display.numOfNextStation = 0;
245+
break;
246+
}
247+
onBtnClick(1);
248+
break;
249+
}
250+
case IR_PREV: {
251+
player.prev();
252+
break;
253+
}
254+
case IR_NEXT: {
255+
player.next();
256+
break;
257+
}
258+
case IR_UP: {
259+
controlsEvent(display.mode == STATIONS ? false : true);
260+
irVolRepeat = 1;
261+
break;
262+
}
263+
case IR_DOWN: {
264+
controlsEvent(display.mode == STATIONS ? true : false);
265+
irVolRepeat = 2;
266+
break;
267+
}
268+
case IR_HASH: {
269+
if (display.mode == NUMBERS) {
270+
display.putRequest({RETURNTITLE, 0});
271+
display.putRequest({NEWMODE, PLAYER});
272+
display.numOfNextStation = 0;
273+
break;
274+
}
275+
display.putRequest({NEWMODE, display.mode == PLAYER ? STATIONS : PLAYER});
276+
break;
277+
}
278+
case IR_0: {
279+
irNum(0);
280+
break;
281+
}
282+
case IR_1: {
283+
irNum(1);
284+
break;
285+
}
286+
case IR_2: {
287+
irNum(2);
288+
break;
289+
}
290+
case IR_3: {
291+
irNum(3);
292+
break;
293+
}
294+
case IR_4: {
295+
irNum(4);
296+
break;
297+
}
298+
case IR_5: {
299+
irNum(5);
300+
break;
301+
}
302+
case IR_6: {
303+
irNum(6);
304+
break;
305+
}
306+
case IR_7: {
307+
irNum(7);
308+
break;
309+
}
310+
case IR_8: {
311+
irNum(8);
312+
break;
313+
}
314+
case IR_9: {
315+
irNum(9);
316+
break;
317+
}
318+
case IR_AST: {
319+
break;
320+
}
321+
} /* switch (target) */
322+
target=17;
308323
break;
309-
}
310-
}
311-
}
324+
} /* if(config.ircodes.irVals[target][j]==irResults.value) */
325+
} /* for(int j=0; j<3; j++) */
326+
} /* for(int target=0; target<16; target++) */
327+
} /* if (irrecv.decode(&irResults)) */
312328
}
313329
#endif // if IR_PIN!=255
314330

yoRadio/controls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#ifndef controls_h
22
#define controls_h
3+
#include "options.h"
34

45
enum controlEvt_e { EVT_BTNLEFT, EVT_BTNCENTER, EVT_BTNRIGHT, EVT_ENCBTNB, EVT_BTNUP, EVT_BTNDOWN, EVT_ENC2BTNB };
56

67
enum tsDirection_e { TSD_STAY, TSD_LEFT, TSD_RIGHT, TSD_UP, TSD_DOWN, TDS_REQUEST };
78

9+
#if IR_PIN!=255
10+
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 };
11+
#endif
812

913
boolean checklpdelay(int m, unsigned long &tstamp);
1014

0 commit comments

Comments
 (0)