is no control
This commit is contained in:
@@ -35,7 +35,7 @@ Three tact buttons or Encoder or all together
|
|||||||
| ------ | ------ |
|
| ------ | ------ |
|
||||||
| GND | GND |
|
| GND | GND |
|
||||||
| VIN | +5v |
|
| VIN | +5v |
|
||||||
| DOUT(DIN) | 27* |
|
| DOUT(DIN) | 22* |
|
||||||
| BCLK | 26* |
|
| BCLK | 26* |
|
||||||
| LRC(WSEL) | 25* |
|
| LRC(WSEL) | 25* |
|
||||||
|
|
||||||
|
|||||||
@@ -9,40 +9,61 @@
|
|||||||
|
|
||||||
long encOldPosition = 0;
|
long encOldPosition = 0;
|
||||||
|
|
||||||
|
#if ENC_BTNL!=255
|
||||||
ESP32Encoder encoder;
|
ESP32Encoder encoder;
|
||||||
OneButton encbutton(ENC_BTNB, true);
|
OneButton encbutton(ENC_BTNB, true);
|
||||||
|
#endif
|
||||||
|
#if BTN_LEFT!=255
|
||||||
OneButton btnleft(BTN_LEFT, true);
|
OneButton btnleft(BTN_LEFT, true);
|
||||||
|
#endif
|
||||||
|
#if BTN_CENTER!=255
|
||||||
OneButton btncenter(BTN_CENTER, true);
|
OneButton btncenter(BTN_CENTER, true);
|
||||||
|
#endif
|
||||||
|
#if BTN_RIGHT!=255
|
||||||
OneButton btnright(BTN_RIGHT, true);
|
OneButton btnright(BTN_RIGHT, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
void initControls() {
|
void initControls() {
|
||||||
|
#if ENC_BTNL!=255
|
||||||
ESP32Encoder::useInternalWeakPullResistors = UP;
|
ESP32Encoder::useInternalWeakPullResistors = UP;
|
||||||
encoder.attachHalfQuad(ENC_BTNL, ENC_BTNR);
|
encoder.attachHalfQuad(ENC_BTNL, ENC_BTNR);
|
||||||
encbutton.attachClick(onEncClick);
|
encbutton.attachClick(onEncClick);
|
||||||
encbutton.attachDoubleClick(onEncDoubleClick);
|
encbutton.attachDoubleClick(onEncDoubleClick);
|
||||||
encbutton.attachLongPressStart(onEncLPStart);
|
encbutton.attachLongPressStart(onEncLPStart);
|
||||||
|
#endif
|
||||||
|
#if BTN_LEFT!=255
|
||||||
btnleft.attachClick(onLeftClick);
|
btnleft.attachClick(onLeftClick);
|
||||||
btnleft.attachDoubleClick(onLeftDoubleClick);
|
btnleft.attachDoubleClick(onLeftDoubleClick);
|
||||||
|
#endif
|
||||||
|
#if BTN_CENTER!=255
|
||||||
btncenter.attachClick(onEncClick);
|
btncenter.attachClick(onEncClick);
|
||||||
btncenter.attachDoubleClick(onEncDoubleClick);
|
btncenter.attachDoubleClick(onEncDoubleClick);
|
||||||
btncenter.attachLongPressStart(onEncLPStart);
|
btncenter.attachLongPressStart(onEncLPStart);
|
||||||
|
#endif
|
||||||
|
#if BTN_RIGHT!=255
|
||||||
btnright.attachClick(onRightClick);
|
btnright.attachClick(onRightClick);
|
||||||
btnright.attachDoubleClick(onRightDoubleClick);
|
btnright.attachDoubleClick(onRightDoubleClick);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loopControls() {
|
void loopControls() {
|
||||||
|
#if ENC_BTNL!=255
|
||||||
encbutton.tick();
|
encbutton.tick();
|
||||||
btnleft.tick();
|
|
||||||
btncenter.tick();
|
|
||||||
btnright.tick();
|
|
||||||
encoderLoop();
|
encoderLoop();
|
||||||
|
#endif
|
||||||
|
#if BTN_LEFT!=255
|
||||||
|
btnleft.tick();
|
||||||
|
#endif
|
||||||
|
#if BTN_CENTER!=255
|
||||||
|
btncenter.tick();
|
||||||
|
#endif
|
||||||
|
#if BTN_RIGHT!=255
|
||||||
|
btnright.tick();
|
||||||
|
#endif
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENC_BTNL!=255
|
||||||
void encoderLoop() {
|
void encoderLoop() {
|
||||||
long encNewPosition = encoder.getCount() / 2;
|
long encNewPosition = encoder.getCount() / 2;
|
||||||
if (encNewPosition != 0 && encNewPosition != encOldPosition) {
|
if (encNewPosition != 0 && encNewPosition != encOldPosition) {
|
||||||
@@ -51,6 +72,7 @@ void encoderLoop() {
|
|||||||
controlsEvent(encNewPosition > 0);
|
controlsEvent(encNewPosition > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void onEncClick() {
|
void onEncClick() {
|
||||||
if (display.mode == PLAYER) {
|
if (display.mode == PLAYER) {
|
||||||
@@ -62,6 +84,7 @@ void onEncClick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void onEncDoubleClick() {
|
void onEncDoubleClick() {
|
||||||
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
display.swichMode(display.mode == PLAYER ? STATIONS : PLAYER);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define VERSION "0.4.180"
|
#define VERSION "0.4.181"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT DISPLAY
|
* TFT DISPLAY
|
||||||
@@ -26,22 +26,21 @@
|
|||||||
/*
|
/*
|
||||||
* I2S DAC
|
* I2S DAC
|
||||||
*/
|
*/
|
||||||
#define I2S_DOUT 27 // DIN connection
|
#define I2S_DOUT 22 // DIN connection
|
||||||
#define I2S_BCLK 26 // BCLK Bit clock
|
#define I2S_BCLK 26 // BCLK Bit clock
|
||||||
#define I2S_LRC 25 // WSEL Left Right Clockz
|
#define I2S_LRC 25 // WSEL Left Right Clock
|
||||||
/*
|
/*
|
||||||
* ENCODER
|
* ENCODER
|
||||||
*/
|
*/
|
||||||
#define ENC_BTNL 13
|
#define ENC_BTNL 255
|
||||||
#define ENC_BTNB 12
|
#define ENC_BTNB 255
|
||||||
#define ENC_BTNR 14
|
#define ENC_BTNR 255
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BUTTONS
|
* BUTTONS
|
||||||
*/
|
*/
|
||||||
#define BTN_LEFT 32
|
#define BTN_LEFT 255
|
||||||
#define BTN_CENTER 31
|
#define BTN_CENTER 255
|
||||||
#define BTN_RIGHT 33
|
#define BTN_RIGHT 255
|
||||||
/*
|
/*
|
||||||
* ESP DEVBOARD
|
* ESP DEVBOARD
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user