v0.5.035
This commit is contained in:
68
Controls.md
Normal file
68
Controls.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
## Controls
|
||||||
|
|
||||||
|
<img src="images/controls.jpg" width="830" height="440"><br />
|
||||||
|
|
||||||
|
---
|
||||||
|
- [Buttons](#buttons)
|
||||||
|
- [Encoders](#encoders)
|
||||||
|
- [IR receiver](#ir-receiver)
|
||||||
|
- [Joystick](#joystic)
|
||||||
|
- [Back to Readme](Readme.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
### Buttons
|
||||||
|
Up to 5 buttons can be connected to the device. Three buttons are enough to control it.
|
||||||
|
|
||||||
|
Button actions:
|
||||||
|
- BTN_LEFT\
|
||||||
|
click: volume down\
|
||||||
|
dblclick: previous station\
|
||||||
|
longpress: quick volume down
|
||||||
|
- BTN_CENTER\
|
||||||
|
click: start/stop playing\
|
||||||
|
dblclick: toggle between PLAYER/PLAYLIST mode\
|
||||||
|
longpress: toggle between PLAYER/PLAYLIST mode
|
||||||
|
- BTN_RIGHT\
|
||||||
|
click: volume up\
|
||||||
|
dblclick: next station\
|
||||||
|
longpress: quick volume up
|
||||||
|
- BTN_UP\
|
||||||
|
click: without display - next station, with display - move up\
|
||||||
|
dblclick: doing nothing\
|
||||||
|
longpress: with display - quick move up
|
||||||
|
- BTN_DOWN\
|
||||||
|
click: without display - prev station, with display - move down\
|
||||||
|
dblclick: doing nothing\
|
||||||
|
longpress: with display - quick move down
|
||||||
|
|
||||||
|
---
|
||||||
|
### Encoders
|
||||||
|
You can connect one or two encoders to replace/complete the buttons. One encoder (without buttons) is enough to control the device.
|
||||||
|
|
||||||
|
- ENCODER1\
|
||||||
|
rotate left: (ENC_BTNL) in PLAYER mode - volume down, in PLAYLIST mode - move up\
|
||||||
|
rotate right: (ENC_BTNR) in PLAYER mode - volume up, in PLAYLIST mode - move down\
|
||||||
|
click, dblclick, longpress: (ENC_BTNB) same as BTN_CENTER
|
||||||
|
- ENCODER2\
|
||||||
|
rotate left: (ENC2_BTNL) if not pressed - switch to PLAYLIST mode and move up, if pressed - volume down\
|
||||||
|
rotate right: (ENC2_BTNR) if not pressed - switch to PLAYLIST mode and move down, if pressed - volume up\
|
||||||
|
click, dblclick: (ENC2_BTNB) same as BTN_CENTER
|
||||||
|
|
||||||
|
---
|
||||||
|
### IR receiver
|
||||||
|
- IR_CODE_PLAY: start/stop playing
|
||||||
|
- IR_CODE_PREV: previous station
|
||||||
|
- IR_CODE_NEXT: next station
|
||||||
|
- IR_CODE_VOLUP: volume up, longpress - quick volume up
|
||||||
|
- IR_CODE_VOLDN: volume down, longpress - quick volume down
|
||||||
|
- IR_CODE_HASH: toggle between PLAYER/PLAYLIST mode
|
||||||
|
- IR_CODE_NUM0-NUM9:\
|
||||||
|
Start entering the station number. To finish input and start playback, press the play button. To cancel, press hash.
|
||||||
|
|
||||||
|
---
|
||||||
|
### Joystick
|
||||||
|
You can use a joystick [like this](https://aliexpress.com/item/4000681560472.html) instead of connecting five buttons
|
||||||
|
|
||||||
|
<img src="images/joystick.jpg" width="300" height="300"><br />
|
||||||
|
|
||||||
|
---
|
||||||
@@ -25,4 +25,8 @@
|
|||||||
\
|
\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||

|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|

|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
- [Hardware setup](#hardware-setup)
|
- [Hardware setup](#hardware-setup)
|
||||||
- [Quick start](#quick-start)
|
- [Quick start](#quick-start)
|
||||||
- [Update](#update)
|
- [Update](#update)
|
||||||
|
- [Controls](Controls.md)
|
||||||
- [MQTT](#mqtt)
|
- [MQTT](#mqtt)
|
||||||
- [Home Assistant](#home-assistant)
|
- [Home Assistant](#home-assistant)
|
||||||
- [More features](#more-features)
|
- [More features](#more-features)
|
||||||
@@ -243,6 +244,13 @@ download _http://\<yoradioip\>/data/playlist.csv_ and _http://\<yoradioip\>/data
|
|||||||
|
|
||||||
---
|
---
|
||||||
## Version history
|
## Version history
|
||||||
|
#### v0.5.033
|
||||||
|
- added two buttons BTN_UP, BTN_DOWN
|
||||||
|
- added the pins for the second encoder ENC2_BTNL, ENC2_BTNB, ENC2_BTNR
|
||||||
|
- fixed display of playlist with SSD1306 configuration
|
||||||
|
- improvements in the displays work
|
||||||
|
- bugs fixes, some improvements
|
||||||
|
|
||||||
#### v0.5.020
|
#### v0.5.020
|
||||||
- added support for SSD1306 128x32 I2C displays
|
- added support for SSD1306 128x32 I2C displays
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
|||||||
//#define ENC_HALFQUARD true /* Experiment with it */
|
//#define ENC_HALFQUARD true /* Experiment with it */
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
|
/* ENCODER2 */
|
||||||
|
//#define ENC2_BTNL 255 /* Left rotation */
|
||||||
|
//#define ENC2_BTNB 255 /* Encoder button */
|
||||||
|
//#define ENC2_BTNR 255 /* Right rotation */
|
||||||
|
//#define ENC2_INTERNALPULLUP true /* Enable the weak pull up resistors */
|
||||||
|
//#define ENC2_HALFQUARD true /* Experiment with it */
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
/* BUTTONS */
|
/* BUTTONS */
|
||||||
//#define BTN_LEFT 255 /* VolDown, Prev */
|
//#define BTN_LEFT 255 /* VolDown, Prev */
|
||||||
//#define BTN_CENTER 255 /* Play, Stop, Show playlist */
|
//#define BTN_CENTER 255 /* Play, Stop, Show playlist */
|
||||||
|
|||||||
BIN
images/controls.jpg
Normal file
BIN
images/controls.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
BIN
images/img13.jpg
BIN
images/img13.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 263 KiB |
BIN
images/img14.jpg
Normal file
BIN
images/img14.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
BIN
images/joystick.jpg
Normal file
BIN
images/joystick.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -6,19 +6,25 @@
|
|||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
long encOldPosition = 0;
|
long encOldPosition = 0;
|
||||||
|
long enc2OldPosition = 0;
|
||||||
int lpId = -1;
|
int lpId = -1;
|
||||||
|
|
||||||
#define ISPUSHBUTTONS BTN_LEFT!=255 || BTN_LEFT!=255 || BTN_RIGHT!=255 || ENC_BTNB!=255
|
#define ISPUSHBUTTONS BTN_LEFT!=255 || BTN_CENTER!=255 || BTN_RIGHT!=255 || ENC_BTNB!=255 || BTN_UP!=255 || BTN_DOWN!=255 || ENC2_BTNB!=255
|
||||||
#if ISPUSHBUTTONS
|
#if ISPUSHBUTTONS
|
||||||
#include "OneButton.h"
|
#include "OneButton.h"
|
||||||
OneButton button[] {{BTN_LEFT, true, BTN_INTERNALPULLUP}, {BTN_CENTER, true, BTN_INTERNALPULLUP}, {BTN_RIGHT, true, BTN_INTERNALPULLUP}, {ENC_BTNB, true, ENC_INTERNALPULLUP}};
|
OneButton button[] {{BTN_LEFT, true, BTN_INTERNALPULLUP}, {BTN_CENTER, true, BTN_INTERNALPULLUP}, {BTN_RIGHT, true, BTN_INTERNALPULLUP}, {ENC_BTNB, true, ENC_INTERNALPULLUP}, {BTN_UP, true, BTN_INTERNALPULLUP}, {BTN_DOWN, true, BTN_INTERNALPULLUP}, {ENC2_BTNB, true, ENC2_INTERNALPULLUP}};
|
||||||
constexpr uint8_t nrOfButtons = sizeof(button) / sizeof(button[0]);
|
constexpr uint8_t nrOfButtons = sizeof(button) / sizeof(button[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENC_BTNL!=255 && ENC_BTNR!=255
|
#if (ENC_BTNL!=255 && ENC_BTNR!=255) || (ENC2_BTNL!=255 && ENC2_BTNR!=255)
|
||||||
#include <ESP32Encoder.h>
|
#include <ESP32Encoder.h>
|
||||||
|
#if (ENC_BTNL!=255 && ENC_BTNR!=255)
|
||||||
ESP32Encoder encoder;
|
ESP32Encoder encoder;
|
||||||
#endif
|
#endif
|
||||||
|
#if (ENC2_BTNL!=255 && ENC2_BTNR!=255)
|
||||||
|
ESP32Encoder encoder2;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IR_PIN!=255
|
#if IR_PIN!=255
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@@ -41,17 +47,25 @@ decode_results irResults;
|
|||||||
|
|
||||||
void initControls() {
|
void initControls() {
|
||||||
#if ENC_BTNL!=255
|
#if ENC_BTNL!=255
|
||||||
ESP32Encoder::useInternalWeakPullResistors = ENC_INTERNALPULLUP ? UP : DOWN;
|
encoder.useInternalWeakPullResistors = ENC_INTERNALPULLUP ? UP : DOWN;
|
||||||
if (ENC_HALFQUARD) {
|
if (ENC_HALFQUARD) {
|
||||||
encoder.attachHalfQuad(ENC_BTNL, ENC_BTNR);
|
encoder.attachHalfQuad(ENC_BTNL, ENC_BTNR);
|
||||||
} else {
|
} else {
|
||||||
encoder.attachFullQuad(ENC_BTNL, ENC_BTNR);
|
encoder.attachFullQuad(ENC_BTNL, ENC_BTNR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if ENC2_BTNL!=255
|
||||||
|
encoder2.useInternalWeakPullResistors = ENC2_INTERNALPULLUP ? UP : DOWN;
|
||||||
|
if (ENC2_HALFQUARD) {
|
||||||
|
encoder2.attachHalfQuad(ENC2_BTNL, ENC2_BTNR);
|
||||||
|
} else {
|
||||||
|
encoder2.attachFullQuad(ENC2_BTNL, ENC2_BTNR);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if ISPUSHBUTTONS
|
#if ISPUSHBUTTONS
|
||||||
for (int i = 0; i < nrOfButtons; i++)
|
for (int i = 0; i < nrOfButtons; i++)
|
||||||
{
|
{
|
||||||
if ((i == 0 && BTN_LEFT == 255) || (i == 1 && BTN_CENTER == 255) || (i == 2 && BTN_RIGHT == 255) || (i == 3 && ENC_BTNB == 255)) continue;
|
if ((i == 0 && BTN_LEFT == 255) || (i == 1 && BTN_CENTER == 255) || (i == 2 && BTN_RIGHT == 255) || (i == 3 && ENC_BTNB == 255) || (i == 4 && BTN_UP == 255) || (i == 5 && BTN_DOWN == 255) || (i == 6 && ENC2_BTNB == 255)) continue;
|
||||||
button[i].attachClick([](void* p) {
|
button[i].attachClick([](void* p) {
|
||||||
onBtnClick((int)p);
|
onBtnClick((int)p);
|
||||||
}, (void*)i);
|
}, (void*)i);
|
||||||
@@ -84,14 +98,20 @@ void loopControls() {
|
|||||||
#if ENC_BTNL!=255
|
#if ENC_BTNL!=255
|
||||||
encoderLoop();
|
encoderLoop();
|
||||||
#endif
|
#endif
|
||||||
|
#if ENC2_BTNL!=255
|
||||||
|
encoder2Loop();
|
||||||
|
#endif
|
||||||
#if ISPUSHBUTTONS
|
#if ISPUSHBUTTONS
|
||||||
for (unsigned i = 0; i < nrOfButtons; i++)
|
for (unsigned i = 0; i < nrOfButtons; i++)
|
||||||
{
|
{
|
||||||
if ((i == 0 && BTN_LEFT == 255) || (i == 1 && BTN_CENTER == 255) || (i == 2 && BTN_RIGHT == 255) || (i == 3 && ENC_BTNB == 255)) continue;
|
if ((i == 0 && BTN_LEFT == 255) || (i == 1 && BTN_CENTER == 255) || (i == 2 && BTN_RIGHT == 255) || (i == 3 && ENC_BTNB == 255) || (i == 4 && BTN_UP == 255) || (i == 5 && BTN_DOWN == 255) || (i == 6 && ENC2_BTNB == 255)) continue;
|
||||||
button[i].tick();
|
button[i].tick();
|
||||||
if (lpId >= 0) {
|
if (lpId >= 0) {
|
||||||
|
if(DSP_MODEL==DSP_DUMMY && (lpId==4 || lpId==5)) continue;
|
||||||
onBtnDuringLongPress(lpId);
|
onBtnDuringLongPress(lpId);
|
||||||
|
yield();
|
||||||
}
|
}
|
||||||
|
yield();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if IR_PIN!=255
|
#if IR_PIN!=255
|
||||||
@@ -111,6 +131,22 @@ void encoderLoop() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENC2_BTNL!=255
|
||||||
|
void encoder2Loop() {
|
||||||
|
long encNewPosition = encoder2.getCount() / 2;
|
||||||
|
if (encNewPosition != 0 && encNewPosition != enc2OldPosition) {
|
||||||
|
enc2OldPosition = encNewPosition;
|
||||||
|
encoder2.setCount(0);
|
||||||
|
uint8_t bp = 2;
|
||||||
|
if(ENC2_BTNB!=255){
|
||||||
|
bp = digitalRead(ENC2_BTNB);
|
||||||
|
}
|
||||||
|
if(bp==HIGH && display.mode!=STATIONS) display.swichMode(STATIONS);
|
||||||
|
controlsEvent(encNewPosition > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IR_PIN!=255
|
#if IR_PIN!=255
|
||||||
void irBlink() {
|
void irBlink() {
|
||||||
if (player.mode == STOPPED) {
|
if (player.mode == STOPPED) {
|
||||||
@@ -183,6 +219,7 @@ void irLoop() {
|
|||||||
}
|
}
|
||||||
case IR_CODE_HASH: {
|
case IR_CODE_HASH: {
|
||||||
if (display.mode == NUMBERS) {
|
if (display.mode == NUMBERS) {
|
||||||
|
display.returnTile();
|
||||||
display.swichMode(PLAYER);
|
display.swichMode(PLAYER);
|
||||||
display.numOfNextStation = 0;
|
display.numOfNextStation = 0;
|
||||||
break;
|
break;
|
||||||
@@ -236,14 +273,16 @@ void irLoop() {
|
|||||||
#endif // if IR_PIN!=255
|
#endif // if IR_PIN!=255
|
||||||
|
|
||||||
void onBtnLongPressStart(int id) {
|
void onBtnLongPressStart(int id) {
|
||||||
switch (id) {
|
switch ((controlEvt_e)id) {
|
||||||
case 0:
|
case EVT_BTNLEFT:
|
||||||
case 2: {
|
case EVT_BTNRIGHT:
|
||||||
|
case EVT_BTNUP:
|
||||||
|
case EVT_BTNDOWN:{
|
||||||
lpId = id;
|
lpId = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case EVT_BTNCENTER:
|
||||||
case 3: {
|
case EVT_ENCBTNB: {
|
||||||
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -251,9 +290,11 @@ void onBtnLongPressStart(int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onBtnLongPressStop(int id) {
|
void onBtnLongPressStop(int id) {
|
||||||
switch (id) {
|
switch ((controlEvt_e)id) {
|
||||||
case 0:
|
case EVT_BTNLEFT:
|
||||||
case 2: {
|
case EVT_BTNRIGHT:
|
||||||
|
case EVT_BTNUP:
|
||||||
|
case EVT_BTNDOWN:{
|
||||||
lpId = -1;
|
lpId = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,15 +313,25 @@ boolean checklpdelay(int m, unsigned long &tstamp) {
|
|||||||
|
|
||||||
void onBtnDuringLongPress(int id) {
|
void onBtnDuringLongPress(int id) {
|
||||||
if (checklpdelay(BTN_LONGPRESS_LOOP_DELAY, lpdelay)) {
|
if (checklpdelay(BTN_LONGPRESS_LOOP_DELAY, lpdelay)) {
|
||||||
switch (id) {
|
switch ((controlEvt_e)id) {
|
||||||
case 0: {
|
case EVT_BTNLEFT: {
|
||||||
controlsEvent(false);
|
controlsEvent(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case EVT_BTNRIGHT: {
|
||||||
controlsEvent(true);
|
controlsEvent(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EVT_BTNUP:
|
||||||
|
case EVT_BTNDOWN: {
|
||||||
|
if (display.mode == PLAYER) {
|
||||||
|
display.swichMode(STATIONS);
|
||||||
|
}
|
||||||
|
if (display.mode == STATIONS) {
|
||||||
|
controlsEvent(id==EVT_BTNDOWN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,13 +356,14 @@ void controlsEvent(bool toRight) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onBtnClick(int id) {
|
void onBtnClick(int id) {
|
||||||
switch (id) {
|
switch ((controlEvt_e)id) {
|
||||||
case 0: {
|
case EVT_BTNLEFT: {
|
||||||
controlsEvent(false);
|
controlsEvent(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case EVT_BTNCENTER:
|
||||||
case 3: {
|
case EVT_ENCBTNB:
|
||||||
|
case EVT_ENC2BTNB: {
|
||||||
if (display.mode == NUMBERS) {
|
if (display.mode == NUMBERS) {
|
||||||
display.numOfNextStation = 0;
|
display.numOfNextStation = 0;
|
||||||
display.swichMode(PLAYER);
|
display.swichMode(PLAYER);
|
||||||
@@ -325,26 +377,45 @@ void onBtnClick(int id) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case EVT_BTNRIGHT: {
|
||||||
controlsEvent(true);
|
controlsEvent(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EVT_BTNUP:
|
||||||
|
case EVT_BTNDOWN: {
|
||||||
|
if(DSP_MODEL==DSP_DUMMY){
|
||||||
|
if(id==EVT_BTNUP){
|
||||||
|
player.next();
|
||||||
|
}else{
|
||||||
|
player.prev();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (display.mode == PLAYER) {
|
||||||
|
display.swichMode(STATIONS);
|
||||||
|
}
|
||||||
|
if (display.mode == STATIONS) {
|
||||||
|
controlsEvent(id==EVT_BTNDOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onBtnDoubleClick(int id) {
|
void onBtnDoubleClick(int id) {
|
||||||
switch (id) {
|
switch ((controlEvt_e)id) {
|
||||||
case 0: {
|
case EVT_BTNLEFT: {
|
||||||
if (display.mode != PLAYER) return;
|
if (display.mode != PLAYER) return;
|
||||||
player.prev();
|
player.prev();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case EVT_BTNCENTER:
|
||||||
case 3: {
|
case EVT_ENCBTNB:
|
||||||
|
case EVT_ENC2BTNB: {
|
||||||
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case EVT_BTNRIGHT: {
|
||||||
if (display.mode != PLAYER) return;
|
if (display.mode != PLAYER) return;
|
||||||
player.next();
|
player.next();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#ifndef controls_h
|
#ifndef controls_h
|
||||||
#define controls_h
|
#define controls_h
|
||||||
|
|
||||||
|
enum controlEvt_e { EVT_BTNLEFT, EVT_BTNCENTER, EVT_BTNRIGHT, EVT_ENCBTNB, EVT_BTNUP, EVT_BTNDOWN, EVT_ENC2BTNB };
|
||||||
|
|
||||||
boolean checklpdelay(int m, unsigned long &tstamp);
|
boolean checklpdelay(int m, unsigned long &tstamp);
|
||||||
|
|
||||||
void initControls();
|
void initControls();
|
||||||
void loopControls();
|
void loopControls();
|
||||||
void encoderLoop();
|
void encoderLoop();
|
||||||
|
void encoder2Loop();
|
||||||
void irLoop();
|
void irLoop();
|
||||||
void irNum(byte num);
|
void irNum(byte num);
|
||||||
void irBlink();
|
void irBlink();
|
||||||
|
|||||||
@@ -260,7 +260,9 @@ void Display::swichMode(displayMode_e newmode) {
|
|||||||
volume();
|
volume();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
if (newmode != NUMBERS) {
|
||||||
meta.lock();
|
meta.lock();
|
||||||
|
}
|
||||||
title1.lock();
|
title1.lock();
|
||||||
if (TITLE_SIZE2 != 0) title2.lock();
|
if (TITLE_SIZE2 != 0) title2.lock();
|
||||||
#ifdef CLOCK_SPACE
|
#ifdef CLOCK_SPACE
|
||||||
@@ -271,7 +273,8 @@ void Display::swichMode(displayMode_e newmode) {
|
|||||||
dsp.frameTitle("VOLUME");
|
dsp.frameTitle("VOLUME");
|
||||||
}
|
}
|
||||||
if (newmode == NUMBERS) {
|
if (newmode == NUMBERS) {
|
||||||
dsp.frameTitle("STATION");
|
//dsp.frameTitle("STATION");
|
||||||
|
meta.reset();
|
||||||
}
|
}
|
||||||
if (newmode == STATIONS) {
|
if (newmode == STATIONS) {
|
||||||
currentPlItem = config.store.lastStation;
|
currentPlItem = config.store.lastStation;
|
||||||
@@ -305,6 +308,11 @@ void Display::drawPlaylist() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::drawNextStationNum(uint16_t num) {
|
void Display::drawNextStationNum(uint16_t num) {
|
||||||
|
char plMenu[1][40];
|
||||||
|
char currentItemText[40] = {0};
|
||||||
|
config.fillPlMenu(plMenu, num, 1);
|
||||||
|
strlcpy(currentItemText, plMenu[0], 39);
|
||||||
|
meta.setText(dsp.utf8Rus(currentItemText, true));
|
||||||
dsp.drawNextStationNum(num);
|
dsp.drawNextStationNum(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,6 +327,7 @@ void Display::loop() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NUMBERS: {
|
case NUMBERS: {
|
||||||
|
meta.loop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATIONS: {
|
case STATIONS: {
|
||||||
@@ -354,6 +363,12 @@ void Display::station() {
|
|||||||
netserver.requestOnChange(STATION, 0);
|
netserver.requestOnChange(STATION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Display::returnTile(){
|
||||||
|
meta.setText(dsp.utf8Rus(config.station.name, true));
|
||||||
|
meta.reset();
|
||||||
|
dsp.loop();
|
||||||
|
}
|
||||||
|
|
||||||
void Display::title(const char *str) {
|
void Display::title(const char *str) {
|
||||||
const char *title = str;
|
const char *title = str;
|
||||||
char ttl[BUFLEN / 2] = { 0 };
|
char ttl[BUFLEN / 2] = { 0 };
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class Display {
|
|||||||
void bootLogo();
|
void bootLogo();
|
||||||
void station();
|
void station();
|
||||||
void title(const char *str);
|
void title(const char *str);
|
||||||
|
void returnTile();
|
||||||
void time(bool redraw = false);
|
void time(bool redraw = false);
|
||||||
void volume();
|
void volume();
|
||||||
void ip();
|
void ip();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define VERSION "0.5.020"
|
#define VERSION "0.5.035"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
@@ -96,6 +96,22 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
|||||||
#define ENC_HALFQUARD true
|
#define ENC_HALFQUARD true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENC2_BTNL
|
||||||
|
#define ENC2_BTNL 255
|
||||||
|
#endif
|
||||||
|
#ifndef ENC2_BTNB
|
||||||
|
#define ENC2_BTNB 255
|
||||||
|
#endif
|
||||||
|
#ifndef ENC2_BTNR
|
||||||
|
#define ENC2_BTNR 255
|
||||||
|
#endif
|
||||||
|
#ifndef ENC2_INTERNALPULLUP
|
||||||
|
#define ENC2_INTERNALPULLUP true
|
||||||
|
#endif
|
||||||
|
#ifndef ENC2_HALFQUARD
|
||||||
|
#define ENC2_HALFQUARD true
|
||||||
|
#endif
|
||||||
|
|
||||||
/* BUTTONS */
|
/* BUTTONS */
|
||||||
#ifndef BTN_LEFT
|
#ifndef BTN_LEFT
|
||||||
#define BTN_LEFT 255
|
#define BTN_LEFT 255
|
||||||
@@ -106,6 +122,12 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
|||||||
#ifndef BTN_RIGHT
|
#ifndef BTN_RIGHT
|
||||||
#define BTN_RIGHT 255
|
#define BTN_RIGHT 255
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef BTN_UP
|
||||||
|
#define BTN_UP 255
|
||||||
|
#endif
|
||||||
|
#ifndef BTN_DOWN
|
||||||
|
#define BTN_DOWN 255
|
||||||
|
#endif
|
||||||
#ifndef BTN_INTERNALPULLUP
|
#ifndef BTN_INTERNALPULLUP
|
||||||
#define BTN_INTERNALPULLUP true
|
#define BTN_INTERNALPULLUP true
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void LiquidCrystal_I2C::init_priv()
|
|||||||
if((_sda_pin==255 && _scl_pin==255) || (_sda_pin==21 && _scl_pin==22)){
|
if((_sda_pin==255 && _scl_pin==255) || (_sda_pin==21 && _scl_pin==22)){
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
}else{
|
}else{
|
||||||
Wire.begin(_sda_pin, _scl_pin, (uint32_t)100000);
|
Wire.begin((int)_sda_pin, (int)_scl_pin, (uint32_t)100000);
|
||||||
}
|
}
|
||||||
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
|
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
|
||||||
begin(_cols, _rows);
|
begin(_cols, _rows);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void DisplayLC1602::getScrolBbounds(const char* text, const char* separator, byt
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DisplayLC1602::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
for(uint16_t x=0; x<swidth-controlspaces[texttop]; x++){
|
for(uint16_t x=0; x<swidth-(fillSpaces?controlspaces[texttop]:0); x++){
|
||||||
setCursor(x, texttop);
|
setCursor(x, texttop);
|
||||||
print(" ");
|
print(" ");
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ void DisplayLC1602::drawVolumeBar(bool withNumber) {
|
|||||||
void DisplayLC1602::drawNextStationNum(uint16_t num) {
|
void DisplayLC1602::drawNextStationNum(uint16_t num) {
|
||||||
char numstr[7];
|
char numstr[7];
|
||||||
sprintf(numstr, "%d", num);
|
sprintf(numstr, "%d", num);
|
||||||
centerText(" ", 1, 0, 0);
|
clearScroll(1, 0, 0);
|
||||||
centerText(numstr, 1, TFT_LOGO, TFT_BG);
|
centerText(numstr, 1, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,13 +167,13 @@ void DisplaySSD1306::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
config.fillPlMenu(plMenu, currentItem - ((DSP_MODEL==DSP_SSD1306)?3:2), PLMITEMS);
|
config.fillPlMenu(plMenu, currentItem - 2, PLMITEMS);
|
||||||
setTextSize(1);
|
setTextSize((DSP_MODEL==DSP_SSD1306)?2:1);
|
||||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) + 1, swidth, PLMITEMHEIGHT, TFT_LOGO);
|
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) + 1, swidth, PLMITEMHEIGHT, TFT_LOGO);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
if (i == ((DSP_MODEL==DSP_SSD1306)?3:2)) {
|
if (i == 2) {
|
||||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||||
} else {
|
} else {
|
||||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||||
|
|||||||
@@ -10,17 +10,18 @@
|
|||||||
#define PLMITEMLENGHT 40
|
#define PLMITEMLENGHT 40
|
||||||
|
|
||||||
#if DSP_MODEL==DSP_SSD1306
|
#if DSP_MODEL==DSP_SSD1306
|
||||||
#define PLMITEMS 7
|
|
||||||
#define PLMITEMHEIGHT 9
|
#define PLMITEMS 5
|
||||||
|
#define PLMITEMHEIGHT 18
|
||||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||||
#define PLCURRENT_SIZE 1
|
#define PLCURRENT_SIZE 2
|
||||||
#define BOOTSTR_TOP1 64-TFT_LINEHGHT*2-5
|
#define BOOTSTR_TOP1 64-TFT_LINEHGHT*2-5
|
||||||
#define BOOTSTR_TOP2 64-TFT_LINEHGHT
|
#define BOOTSTR_TOP2 64-TFT_LINEHGHT
|
||||||
#define VOL_TOP 24
|
#define VOL_TOP 24
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define PLMITEMS 5
|
#define PLMITEMS 5
|
||||||
|
|
||||||
#define PLMITEMHEIGHT 10
|
#define PLMITEMHEIGHT 10
|
||||||
#define TITLE_TOP2 TFT_FRAMEWDT + 2 * TFT_LINEHGHT
|
#define TITLE_TOP2 TFT_FRAMEWDT + 2 * TFT_LINEHGHT
|
||||||
#define PLCURRENT_SIZE 1
|
#define PLCURRENT_SIZE 1
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
#define CLOCK_SPACE 38
|
#define CLOCK_SPACE 38
|
||||||
#define VOL_SPACE 0
|
#define VOL_SPACE 0
|
||||||
#define VOL_TOP 16
|
#define VOL_TOP 16
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
class DisplaySSD1306: public Adafruit_SSD1306 {
|
class DisplaySSD1306: public Adafruit_SSD1306 {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user