Browse Source

Check Buttons Enabled

master
Daniel Rieper 4 years ago
committed by Torsten Stauder
parent
commit
2fd9758d93
  1. 35
      src/main.cpp
  2. 8
      src/settings-custom.h
  3. 8
      src/settings-espa1s.h
  4. 10
      src/settings-lolin32.h
  5. 6
      src/settings-lolin_d32.h
  6. 8
      src/settings-lolin_d32_pro.h

35
src/main.cpp

@ -316,6 +316,25 @@ QueueHandle_t rfidCardQueue;
RingbufHandle_t explorerFileUploadRingBuffer;
QueueHandle_t explorerFileUploadStatusQueue;
#if (NEXT_BUTTON > 0 && NEXT_BUTTON<50)
#define BUTTON_0_ENABLE
#endif
#if (PREVIOUS_BUTTON > 0 && PREVIOUS_BUTTON<50)
#define BUTTON_1_ENABLE
#endif
#if (PAUSEPLAY_BUTTON > 0 && PAUSEPLAY_BUTTON<50)
#define BUTTON_2_ENABLE
#endif
#ifdef USEROTARY_ENABLE
#define BUTTON_3_ENABLE
#endif
#if (BUTTON_4 > 0 && BUTTON_4<50)
#define BUTTON_4_ENABLE
#endif
#if (BUTTON_5 > 0 && BUTTON_5<50)
#define BUTTON_5_ENABLE
#endif
// Prototypes
void accessPointStart(const char *SSID, IPAddress ip, IPAddress netmask);
static int arrSortHelper(const void* a, const void* b);
@ -491,14 +510,24 @@ void buttonHandler() {
return;
}
unsigned long currentTimestamp = millis();
#ifdef BUTTON_0_ENABLE
buttons[0].currentState = digitalRead(NEXT_BUTTON);
#endif
#ifdef BUTTON_1_ENABLE
buttons[1].currentState = digitalRead(PREVIOUS_BUTTON);
#endif
#ifdef BUTTON_2_ENABLE
buttons[2].currentState = digitalRead(PAUSEPLAY_BUTTON);
#ifdef USEROTARY_ENABLE
#endif
#ifdef BUTTON_3_ENABLE
buttons[3].currentState = digitalRead(DREHENCODER_BUTTON);
#endif
if(BUTTON_4 > 0 && BUTTON_4 < 50) buttons[4].currentState = digitalRead(BUTTON_4);
if(BUTTON_5 > 0 && BUTTON_5 < 50) buttons[5].currentState = digitalRead(BUTTON_5);
#ifdef BUTTON_4_ENABLE
buttons[4].currentState = digitalRead(BUTTON_4);
#endif
#ifdef BUTTON_5_ENABLE
buttons[5].currentState = digitalRead(BUTTON_5);
#endif
// Iterate over all buttons in struct-array
for (uint8_t i=0; i < sizeof(buttons) / sizeof(buttons[0]); i++) {

8
src/settings-custom.h

@ -46,12 +46,12 @@
// Rotary encoder
#define DREHENCODER_CLK 34 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
#define DREHENCODER_DT 35 // Info: Lolin D32 / Lolin D32 pro 35 are using 35 for battery-voltage-monitoring!
#define DREHENCODER_BUTTON 32 // Button is used to switch ESPuino on and off
#define DREHENCODER_BUTTON 32 // Button 3: is used to switch ESPuino on and off
// Control-buttons
#define PAUSEPLAY_BUTTON 5 // GPIO to detect pause/play
#define NEXT_BUTTON 4 // GPIO to detect next
#define PREVIOUS_BUTTON 2 // GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define NEXT_BUTTON 4 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 2 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define PAUSEPLAY_BUTTON 0 // Button 2: GPIO to detect pause/play
#define BUTTON_4 99 // Button 4
#define BUTTON_5 99 // Button 5

8
src/settings-espa1s.h

@ -40,12 +40,12 @@
// Rotary encoder
#define DREHENCODER_CLK 5 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
#define DREHENCODER_DT 18 // Info: Lolin D32 / Lolin D32 pro 35 are using 35 for battery-voltage-monitoring!
#define DREHENCODER_BUTTON 4 // Button is used to switch ESPuino on and off
#define DREHENCODER_BUTTON 4 // Button 3: is used to switch ESPuino on and off
// Control-buttons
#define PAUSEPLAY_BUTTON 36 // GPIO to detect pause/play
#define NEXT_BUTTON 199 // GPIO to detect next
#define PREVIOUS_BUTTON 198 // GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2)
#define NEXT_BUTTON 199 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 198 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define PAUSEPLAY_BUTTON 36 // Button 2: GPIO to detect pause/play
#define BUTTON_4 99 // Button 4
#define BUTTON_5 99 // Button 5

10
src/settings-lolin32.h

@ -34,7 +34,7 @@
// RFID (via SPI)
#define RST_PIN 99 // Not necessary but has to be set anyway; so let's use a dummy-number
#define RFID_CS 21 // GPIO for chip select (RFID)
#define RFID_CS 5 // GPIO for chip select (RFID)
#define RFID_MOSI 23 // GPIO for master out slave in (RFID)
#define RFID_MISO 19 // GPIO for master in slave out (RFID)
#define RFID_SCK 18 // GPIO for clock-signal (RFID)
@ -52,12 +52,12 @@
// Rotary encoder
#define DREHENCODER_CLK 34 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
#define DREHENCODER_DT 35 // Info: Lolin D32 / Lolin D32 pro 35 are using 35 for battery-voltage-monitoring!
#define DREHENCODER_BUTTON 32 // Button is used to switch ESPuino on and off
#define DREHENCODER_BUTTON 32 // Button 3: is used to switch ESPuino on and off
// Control-buttons
#define PAUSEPLAY_BUTTON 5 // GPIO to detect pause/play
#define NEXT_BUTTON 4 // GPIO to detect next
#define PREVIOUS_BUTTON 2 // GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define NEXT_BUTTON 4 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 2 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define PAUSEPLAY_BUTTON 5 // Button 2: GPIO to detect pause/play
#define BUTTON_4 99 // Button 4
#define BUTTON_5 99 // Button 5

6
src/settings-lolin_d32.h

@ -56,9 +56,9 @@
#define DREHENCODER_BUTTON 32 // Button is used to switch ESPuino on and off
// Control-buttons
#define PAUSEPLAY_BUTTON 5 // GPIO to detect pause/play
#define NEXT_BUTTON 4 // GPIO to detect next
#define PREVIOUS_BUTTON 2 // GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2)
#define NEXT_BUTTON 4 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 2 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define PAUSEPLAY_BUTTON 5 // Button 2: GPIO to detect pause/play
#define BUTTON_4 99 // Button 4
#define BUTTON_5 99 // Button 5

8
src/settings-lolin_d32_pro.h

@ -48,12 +48,12 @@
// Rotary encoder
#define DREHENCODER_CLK 34 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
#define DREHENCODER_DT 39 // 39 = 'VN'
#define DREHENCODER_BUTTON 36 // Button is used to switch ESPuino on and off; 36 = 'VP'
#define DREHENCODER_BUTTON 36 // Button 3: is used to switch ESPuino on and off; 36 = 'VP'
// Control-buttons
#define PAUSEPLAY_BUTTON 32 // GPIO to detect pause/play
#define NEXT_BUTTON 0 // GPIO to detect next
#define PREVIOUS_BUTTON 2 // GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2)
#define NEXT_BUTTON 0 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 2 // Button 1: GPIO to detect previous (Important: as of 19.11.2020 changed from 33 to 2; make sure to change in SD-MMC-mode)
#define PAUSEPLAY_BUTTON 32 // Button 2: GPIO to detect pause/play
#define BUTTON_4 99 // Button 4
#define BUTTON_5 99 // Button 5

Loading…
Cancel
Save