5 changed files with 593 additions and 578 deletions
-
183src/settings-custom.h
-
201src/settings-espa1s.h
-
193src/settings-lolin_d32.h
-
187src/settings-lolin_d32_pro.h
-
407src/settings.h
@ -1,106 +1,109 @@ |
|||||
#include "Arduino.h" |
|
||||
|
#ifndef __ESPUINO_SETTINGS_CUSTOM_H__ |
||||
|
#define __ESPUINO_SETTINGS_CUSTOM_H__ |
||||
|
#include "Arduino.h" |
||||
|
|
||||
//######################### INFOS #################################### |
|
||||
/* This is not a develboard-specific config-file. It's intended for your own use. |
|
||||
It's been originally derived from lolin32, but just change it according your needs! |
|
||||
*/ |
|
||||
|
//######################### INFOS #################################### |
||||
|
/* This is not a develboard-specific config-file. It's intended for your own use. |
||||
|
It's been originally derived from lolin32, but just change it according your needs! |
||||
|
*/ |
||||
|
|
||||
//################## GPIO-configuration ############################## |
|
||||
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
|
||||
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
|
||||
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
|
||||
#ifdef SD_MMC_1BIT_MODE |
|
||||
// uSD-card-reader (via SD-MMC 1Bit) |
|
||||
// |
|
||||
// SD_MMC uses fixed pins |
|
||||
// MOSI 15 |
|
||||
// SCK 14 |
|
||||
// MISO 2 |
|
||||
#else |
|
||||
// uSD-card-reader (via SPI) |
|
||||
#define SPISD_CS 15 // GPIO for chip select (SD) |
|
||||
#ifndef SINGLE_SPI_ENABLE |
|
||||
#define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI |
|
||||
#define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
|
||||
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
|
||||
|
//################## GPIO-configuration ############################## |
||||
|
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
||||
|
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
||||
|
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
||||
|
#ifdef SD_MMC_1BIT_MODE |
||||
|
// uSD-card-reader (via SD-MMC 1Bit) |
||||
|
// |
||||
|
// SD_MMC uses fixed pins |
||||
|
// MOSI 15 |
||||
|
// SCK 14 |
||||
|
// MISO 2 |
||||
|
#else |
||||
|
// uSD-card-reader (via SPI) |
||||
|
#define SPISD_CS 15 // GPIO for chip select (SD) |
||||
|
#ifndef SINGLE_SPI_ENABLE |
||||
|
#define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI |
||||
|
#define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
||||
|
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
||||
|
#endif |
||||
#endif |
#endif |
||||
#endif |
|
||||
|
|
||||
// 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_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) |
|
||||
|
// 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_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) |
||||
|
|
||||
#ifdef RFID_READER_TYPE_PN5180 |
|
||||
#define RFID_BUSY 16 // PN5180 BUSY PIN |
|
||||
#define RFID_RST 22 // PN5180 RESET PIN |
|
||||
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
|
||||
#endif |
|
||||
// I2S (DAC) |
|
||||
#define I2S_DOUT 25 // Digital out (I2S) |
|
||||
#define I2S_BCLK 27 // BCLK (I2S) |
|
||||
#define I2S_LRC 26 // LRC (I2S) |
|
||||
|
#ifdef RFID_READER_TYPE_PN5180 |
||||
|
#define RFID_BUSY 16 // PN5180 BUSY PIN |
||||
|
#define RFID_RST 22 // PN5180 RESET PIN |
||||
|
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
||||
|
#endif |
||||
|
// I2S (DAC) |
||||
|
#define I2S_DOUT 25 // Digital out (I2S) |
||||
|
#define I2S_BCLK 27 // BCLK (I2S) |
||||
|
#define I2S_LRC 26 // LRC (I2S) |
||||
|
|
||||
// Rotary encoder |
|
||||
#ifdef USEROTARY_ENABLE |
|
||||
#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 3: is used to switch ESPuino on and off |
|
||||
#endif |
|
||||
|
// Rotary encoder |
||||
|
#ifdef USEROTARY_ENABLE |
||||
|
#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 3: is used to switch ESPuino on and off |
||||
|
#endif |
||||
|
|
||||
// Control-buttons (set to 99 to disable) |
|
||||
#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: unnamed optional button |
|
||||
#define BUTTON_5 99 // Button 5: unnamed optional button |
|
||||
|
// Control-buttons (set to 99 to disable) |
||||
|
#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: unnamed optional button |
||||
|
#define BUTTON_5 99 // Button 5: unnamed optional button |
||||
|
|
||||
// Wake-up button |
|
||||
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
|
||||
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
|
||||
|
// Wake-up button |
||||
|
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
||||
|
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
||||
|
|
||||
// (optional) Power-control |
|
||||
#define POWER 17 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
|
||||
|
// (optional) Power-control |
||||
|
#define POWER 17 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
||||
|
|
||||
// (optional) Neopixel |
|
||||
#define LED_PIN 12 // GPIO for Neopixel-signaling |
|
||||
|
// (optional) Neopixel |
||||
|
#define LED_PIN 12 // GPIO for Neopixel-signaling |
||||
|
|
||||
// (optinal) Headphone-detection |
|
||||
#ifdef HEADPHONE_ADJUST_ENABLE |
|
||||
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
|
||||
#endif |
|
||||
|
// (optinal) Headphone-detection |
||||
|
#ifdef HEADPHONE_ADJUST_ENABLE |
||||
|
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
||||
|
#endif |
||||
|
|
||||
// (optional) Monitoring of battery-voltage via ADC |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
#define VOLTAGE_READ_PIN 33 // GPIO used to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro as it's hard-wired there! |
|
||||
float referenceVoltage = 3.35; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
|
||||
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
|
||||
#endif |
|
||||
|
// (optional) Monitoring of battery-voltage via ADC |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
#define VOLTAGE_READ_PIN 33 // GPIO used to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro as it's hard-wired there! |
||||
|
float referenceVoltage = 3.35; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
||||
|
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
||||
|
#endif |
||||
|
|
||||
// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
uint8_t rdiv1 = 129; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!) |
|
||||
uint16_t rdiv2 = 129; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC! |
|
||||
#endif |
|
||||
|
// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
uint8_t rdiv1 = 129; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!) |
||||
|
uint16_t rdiv2 = 129; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC! |
||||
|
#endif |
||||
|
|
||||
// (Optional) remote control via infrared |
|
||||
#ifdef IR_CONTROL_ENABLE |
|
||||
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
|
||||
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
|
||||
|
// (Optional) remote control via infrared |
||||
|
#ifdef IR_CONTROL_ENABLE |
||||
|
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
||||
|
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
||||
|
|
||||
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
|
||||
#define RC_PLAY 0x68 // command for play |
|
||||
#define RC_PAUSE 0x67 // command for pause |
|
||||
#define RC_NEXT 0x6b // command for next track of playlist |
|
||||
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
|
||||
#define RC_FIRST 0x6c // command for first track of playlist |
|
||||
#define RC_LAST 0x6d // command for last track of playlist |
|
||||
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
|
||||
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
|
||||
#define RC_MUTE 0x1c // Command to mute ESPuino |
|
||||
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
|
||||
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
|
||||
#define RC_FTP 0x65 // Command to enable FTP-server |
|
||||
|
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
||||
|
#define RC_PLAY 0x68 // command for play |
||||
|
#define RC_PAUSE 0x67 // command for pause |
||||
|
#define RC_NEXT 0x6b // command for next track of playlist |
||||
|
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
||||
|
#define RC_FIRST 0x6c // command for first track of playlist |
||||
|
#define RC_LAST 0x6d // command for last track of playlist |
||||
|
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
||||
|
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
||||
|
#define RC_MUTE 0x1c // Command to mute ESPuino |
||||
|
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
||||
|
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
||||
|
#define RC_FTP 0x65 // Command to enable FTP-server |
||||
|
#endif |
||||
#endif |
#endif |
@ -1,100 +1,103 @@ |
|||||
#include "Arduino.h" |
|
||||
|
|
||||
//######################### INFOS #################################### |
|
||||
/* This is a develboard-specific config-file for *AI Tinker ESP32-A1S-AudioKit*. It's highly customized and almost certainly |
|
||||
not suitable for a different develboards. |
|
||||
Has a lot of stuff already onboard but needs some soldering rework as there are not all GPIOs exposed |
|
||||
PCB: Not necessary. |
|
||||
Infos: https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit |
|
||||
Status: untested |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
//################## GPIO-configuration ############################## |
|
||||
// uSD-card-reader (via SPI) |
|
||||
#define SPISD_CS 13 // GPIO for chip select (SD) |
|
||||
#ifndef SINGLE_SPI_ENABLE |
|
||||
#define SPISD_MOSI 15 // GPIO for master out slave in (SD) => not necessary for single-SPI |
|
||||
#define SPISD_MISO 2 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
|
||||
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
|
||||
#endif |
|
||||
|
|
||||
#define MFRC522_RST_PIN 12 // needed for i2c-comm MTDI on JTAG |
|
||||
#define MFRC522_ADDR 0x28 // default Address of MFRC522 |
|
||||
#define ext_IIC_CLK 23 // 14-pin-header |
|
||||
#define ext_IIC_DATA 18 // 14-pin-header |
|
||||
|
|
||||
// I2S (DAC) |
|
||||
#define I2S_DOUT 25 // Digital out (I2S) |
|
||||
#define I2S_BCLK 27 // BCLK (I2S) |
|
||||
#define I2S_LRC 26 // LRC (I2S) |
|
||||
|
|
||||
// I2C (AC101) |
|
||||
#define IIC_CLK 32 // internal |
|
||||
#define IIC_DATA 33 // internal |
|
||||
|
|
||||
// Amp enable |
|
||||
#define GPIO_PA_EN GPIO_NUM_21 // internal |
|
||||
#define GPIO_SEL_PA_EN GPIO_SEL_21 |
|
||||
|
|
||||
// Rotary encoder |
|
||||
#ifdef USEROTARY_ENABLE |
|
||||
#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 3: is used to switch ESPuino on and off |
|
||||
#endif |
|
||||
|
|
||||
// Control-buttons (set to 99 to disable) |
|
||||
#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: unnamed optional button |
|
||||
#define BUTTON_5 99 // Button 5: unnamed optional button |
|
||||
|
|
||||
// Wake-up button |
|
||||
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
|
||||
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
|
||||
|
|
||||
// Power-control |
|
||||
#define POWER 19 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
|
||||
|
|
||||
// (optional) Neopixel |
|
||||
#define LED_PIN 23 // GPIO for Neopixel-signaling |
|
||||
|
|
||||
// (optinal) Headphone-detection |
|
||||
#ifdef HEADPHONE_ADJUST_ENABLE |
|
||||
#define HP_DETECT 39 // GPIO that detects, if there's a plug in the headphone jack or not |
|
||||
#endif |
|
||||
|
|
||||
// (optional) Monitoring of battery-voltage via ADC |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
#define VOLTAGE_READ_PIN 33 // GPIO used to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro as it's hard-wired there! |
|
||||
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
|
||||
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
|
||||
#endif |
|
||||
|
|
||||
// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
uint8_t rdiv1 = 129; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!) |
|
||||
uint16_t rdiv2 = 389; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC! |
|
||||
#endif |
|
||||
|
|
||||
// (Optional) remote control via infrared |
|
||||
#ifdef IR_CONTROL_ENABLE |
|
||||
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
|
||||
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
|
||||
|
|
||||
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
|
||||
#define RC_PLAY 0x68 // command for play |
|
||||
#define RC_PAUSE 0x67 // command for pause |
|
||||
#define RC_NEXT 0x6b // command for next track of playlist |
|
||||
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
|
||||
#define RC_FIRST 0x6c // command for first track of playlist |
|
||||
#define RC_LAST 0x6d // command for last track of playlist |
|
||||
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
|
||||
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
|
||||
#define RC_MUTE 0x1c // Command to mute ESPuino |
|
||||
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
|
||||
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
|
||||
#define RC_FTP 0x65 // Command to enable FTP-server |
|
||||
|
#ifndef __ESPUINO_SETTINGS_ESPA1S_H__ |
||||
|
#define __ESPUINO_SETTINGS_ESPA1S_H__ |
||||
|
#include "Arduino.h" |
||||
|
|
||||
|
//######################### INFOS #################################### |
||||
|
/* This is a develboard-specific config-file for *AI Tinker ESP32-A1S-AudioKit*. It's highly customized and almost certainly |
||||
|
not suitable for a different develboards. |
||||
|
Has a lot of stuff already onboard but needs some soldering rework as there are not all GPIOs exposed |
||||
|
PCB: Not necessary. |
||||
|
Infos: https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit |
||||
|
Status: untested |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
//################## GPIO-configuration ############################## |
||||
|
// uSD-card-reader (via SPI) |
||||
|
#define SPISD_CS 13 // GPIO for chip select (SD) |
||||
|
#ifndef SINGLE_SPI_ENABLE |
||||
|
#define SPISD_MOSI 15 // GPIO for master out slave in (SD) => not necessary for single-SPI |
||||
|
#define SPISD_MISO 2 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
||||
|
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
||||
|
#endif |
||||
|
|
||||
|
#define MFRC522_RST_PIN 12 // needed for i2c-comm MTDI on JTAG |
||||
|
#define MFRC522_ADDR 0x28 // default Address of MFRC522 |
||||
|
#define ext_IIC_CLK 23 // 14-pin-header |
||||
|
#define ext_IIC_DATA 18 // 14-pin-header |
||||
|
|
||||
|
// I2S (DAC) |
||||
|
#define I2S_DOUT 25 // Digital out (I2S) |
||||
|
#define I2S_BCLK 27 // BCLK (I2S) |
||||
|
#define I2S_LRC 26 // LRC (I2S) |
||||
|
|
||||
|
// I2C (AC101) |
||||
|
#define IIC_CLK 32 // internal |
||||
|
#define IIC_DATA 33 // internal |
||||
|
|
||||
|
// Amp enable |
||||
|
#define GPIO_PA_EN GPIO_NUM_21 // internal |
||||
|
#define GPIO_SEL_PA_EN GPIO_SEL_21 |
||||
|
|
||||
|
// Rotary encoder |
||||
|
#ifdef USEROTARY_ENABLE |
||||
|
#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 3: is used to switch ESPuino on and off |
||||
|
#endif |
||||
|
|
||||
|
// Control-buttons (set to 99 to disable) |
||||
|
#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: unnamed optional button |
||||
|
#define BUTTON_5 99 // Button 5: unnamed optional button |
||||
|
|
||||
|
// Wake-up button |
||||
|
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
||||
|
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
||||
|
|
||||
|
// Power-control |
||||
|
#define POWER 19 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
||||
|
|
||||
|
// (optional) Neopixel |
||||
|
#define LED_PIN 23 // GPIO for Neopixel-signaling |
||||
|
|
||||
|
// (optinal) Headphone-detection |
||||
|
#ifdef HEADPHONE_ADJUST_ENABLE |
||||
|
#define HP_DETECT 39 // GPIO that detects, if there's a plug in the headphone jack or not |
||||
|
#endif |
||||
|
|
||||
|
// (optional) Monitoring of battery-voltage via ADC |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
#define VOLTAGE_READ_PIN 33 // GPIO used to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro as it's hard-wired there! |
||||
|
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
||||
|
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
||||
|
#endif |
||||
|
|
||||
|
// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
uint8_t rdiv1 = 129; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!) |
||||
|
uint16_t rdiv2 = 389; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC! |
||||
|
#endif |
||||
|
|
||||
|
// (Optional) remote control via infrared |
||||
|
#ifdef IR_CONTROL_ENABLE |
||||
|
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
||||
|
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
||||
|
|
||||
|
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
||||
|
#define RC_PLAY 0x68 // command for play |
||||
|
#define RC_PAUSE 0x67 // command for pause |
||||
|
#define RC_NEXT 0x6b // command for next track of playlist |
||||
|
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
||||
|
#define RC_FIRST 0x6c // command for first track of playlist |
||||
|
#define RC_LAST 0x6d // command for last track of playlist |
||||
|
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
||||
|
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
||||
|
#define RC_MUTE 0x1c // Command to mute ESPuino |
||||
|
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
||||
|
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
||||
|
#define RC_FTP 0x65 // Command to enable FTP-server |
||||
|
#endif |
||||
#endif |
#endif |
@ -1,112 +1,115 @@ |
|||||
#include "Arduino.h" |
|
||||
|
#ifndef __ESPUINO_SETTINGS_LOLIN_D32_H__ |
||||
|
#define __ESPUINO_SETTINGS_LOLIN_D32_H__ |
||||
|
#include "Arduino.h" |
||||
|
|
||||
//######################### INFOS #################################### |
|
||||
/* This is a develboard-specific config-file for *Wemos Lolin D32*. Specific doesn't mean it's only working with this board. |
|
||||
Lolin D32 is the successor of Lolin32 and the "little brother" of Wemos Lolin D32 pro. |
|
||||
PCB: https://github.com/biologist79/ESPuino/tree/master/PCBs/Wemos%20Lolin%20D32 |
|
||||
Infos: https://www.wemos.cc/en/latest/d32/d32.html |
|
||||
Schematics: https://www.wemos.cc/en/latest/_static/files/sch_d32_v1.0.0.pdf |
|
||||
Caveats: GPIO35 (battery monitoring) can't be changed, it's built in |
|
||||
Status: |
|
||||
tested with 2x SPI: RC522 & SD (by biologist79) |
|
||||
*/ |
|
||||
|
//######################### INFOS #################################### |
||||
|
/* This is a develboard-specific config-file for *Wemos Lolin D32*. Specific doesn't mean it's only working with this board. |
||||
|
Lolin D32 is the successor of Lolin32 and the "little brother" of Wemos Lolin D32 pro. |
||||
|
PCB: https://github.com/biologist79/ESPuino/tree/master/PCBs/Wemos%20Lolin%20D32 |
||||
|
Infos: https://www.wemos.cc/en/latest/d32/d32.html |
||||
|
Schematics: https://www.wemos.cc/en/latest/_static/files/sch_d32_v1.0.0.pdf |
||||
|
Caveats: GPIO35 (battery monitoring) can't be changed, it's built in |
||||
|
Status: |
||||
|
tested with 2x SPI: RC522 & SD (by biologist79) |
||||
|
*/ |
||||
|
|
||||
|
|
||||
//################## GPIO-configuration ############################## |
|
||||
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
|
||||
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
|
||||
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
|
||||
#ifdef SD_MMC_1BIT_MODE |
|
||||
// uSD-card-reader (via SD-MMC 1Bit) |
|
||||
// |
|
||||
// SD_MMC uses fixed pins |
|
||||
// MOSI 15 |
|
||||
// SCK 14 |
|
||||
// MISO 2 |
|
||||
#else |
|
||||
// uSD-card-reader (via SPI) |
|
||||
#define SPISD_CS 15 // GPIO for chip select (SD) |
|
||||
#ifndef SINGLE_SPI_ENABLE |
|
||||
#define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI |
|
||||
#define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
|
||||
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
|
||||
|
//################## GPIO-configuration ############################## |
||||
|
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
||||
|
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
||||
|
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
||||
|
#ifdef SD_MMC_1BIT_MODE |
||||
|
// uSD-card-reader (via SD-MMC 1Bit) |
||||
|
// |
||||
|
// SD_MMC uses fixed pins |
||||
|
// MOSI 15 |
||||
|
// SCK 14 |
||||
|
// MISO 2 |
||||
|
#else |
||||
|
// uSD-card-reader (via SPI) |
||||
|
#define SPISD_CS 15 // GPIO for chip select (SD) |
||||
|
#ifndef SINGLE_SPI_ENABLE |
||||
|
#define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI |
||||
|
#define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
||||
|
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI |
||||
|
#endif |
||||
#endif |
#endif |
||||
#endif |
|
||||
|
|
||||
// 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_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) |
|
||||
|
// 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_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) |
||||
|
|
||||
#ifdef RFID_READER_TYPE_PN5180 |
|
||||
#define RFID_BUSY 16 // PN5180 BUSY PIN |
|
||||
#define RFID_RST 22 // PN5180 RESET PIN |
|
||||
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
|
||||
#endif |
|
||||
// I2S (DAC) |
|
||||
#define I2S_DOUT 25 // Digital out (I2S) |
|
||||
#define I2S_BCLK 27 // BCLK (I2S) |
|
||||
#define I2S_LRC 26 // LRC (I2S) |
|
||||
|
#ifdef RFID_READER_TYPE_PN5180 |
||||
|
#define RFID_BUSY 16 // PN5180 BUSY PIN |
||||
|
#define RFID_RST 22 // PN5180 RESET PIN |
||||
|
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
||||
|
#endif |
||||
|
// I2S (DAC) |
||||
|
#define I2S_DOUT 25 // Digital out (I2S) |
||||
|
#define I2S_BCLK 27 // BCLK (I2S) |
||||
|
#define I2S_LRC 26 // LRC (I2S) |
||||
|
|
||||
// Rotary encoder |
|
||||
#ifdef USEROTARY_ENABLE |
|
||||
#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 33 // Info: Lolin D32 is using 35 for battery-voltage-monitoring! |
|
||||
#define DREHENCODER_BUTTON 32 // Button is used to switch ESPuino on and off |
|
||||
#endif |
|
||||
|
// Rotary encoder |
||||
|
#ifdef USEROTARY_ENABLE |
||||
|
#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 33 // Info: Lolin D32 is using 35 for battery-voltage-monitoring! |
||||
|
#define DREHENCODER_BUTTON 32 // Button is used to switch ESPuino on and off |
||||
|
#endif |
||||
|
|
||||
// Control-buttons (set to 99 to disable) |
|
||||
#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: unnamed optional button |
|
||||
#define BUTTON_5 99 // Button 5: unnamed optional button |
|
||||
|
// Control-buttons (set to 99 to disable) |
||||
|
#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: unnamed optional button |
||||
|
#define BUTTON_5 99 // Button 5: unnamed optional button |
||||
|
|
||||
// Wake-up button |
|
||||
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
|
||||
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
|
||||
|
// Wake-up button |
||||
|
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
||||
|
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
||||
|
|
||||
// (optional) Power-control |
|
||||
#define POWER 17 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
|
||||
|
// (optional) Power-control |
||||
|
#define POWER 17 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
||||
|
|
||||
// (optional) Neopixel |
|
||||
#define LED_PIN 12 // GPIO for Neopixel-signaling |
|
||||
|
// (optional) Neopixel |
||||
|
#define LED_PIN 12 // GPIO for Neopixel-signaling |
||||
|
|
||||
// (optinal) Headphone-detection |
|
||||
#ifdef HEADPHONE_ADJUST_ENABLE |
|
||||
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
|
||||
#endif |
|
||||
|
// (optinal) Headphone-detection |
||||
|
#ifdef HEADPHONE_ADJUST_ENABLE |
||||
|
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
||||
|
#endif |
||||
|
|
||||
// (optional) Monitoring of battery-voltage via ADC |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
#define VOLTAGE_READ_PIN 35 // Cannot be changed, it's built in |
|
||||
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
|
||||
float offsetVoltage = 0.2; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
|
||||
#endif |
|
||||
|
// (optional) Monitoring of battery-voltage via ADC |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
#define VOLTAGE_READ_PIN 35 // Cannot be changed, it's built in |
||||
|
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
||||
|
float offsetVoltage = 0.2; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
||||
|
#endif |
||||
|
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
uint8_t rdiv1 = 100; // Cannot be changed, it's built in |
|
||||
uint16_t rdiv2 = 100; // Cannot be changed, it's built in |
|
||||
#endif |
|
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
uint8_t rdiv1 = 100; // Cannot be changed, it's built in |
||||
|
uint16_t rdiv2 = 100; // Cannot be changed, it's built in |
||||
|
#endif |
||||
|
|
||||
// (Optional) remote control via infrared |
|
||||
#ifdef IR_CONTROL_ENABLE |
|
||||
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
|
||||
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
|
||||
|
// (Optional) remote control via infrared |
||||
|
#ifdef IR_CONTROL_ENABLE |
||||
|
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
||||
|
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
||||
|
|
||||
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
|
||||
#define RC_PLAY 0x68 // command for play |
|
||||
#define RC_PAUSE 0x67 // command for pause |
|
||||
#define RC_NEXT 0x6b // command for next track of playlist |
|
||||
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
|
||||
#define RC_FIRST 0x6c // command for first track of playlist |
|
||||
#define RC_LAST 0x6d // command for last track of playlist |
|
||||
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
|
||||
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
|
||||
#define RC_MUTE 0x1c // Command to mute ESPuino |
|
||||
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
|
||||
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
|
||||
#define RC_FTP 0x65 // Command to enable FTP-server |
|
||||
|
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
||||
|
#define RC_PLAY 0x68 // command for play |
||||
|
#define RC_PAUSE 0x67 // command for pause |
||||
|
#define RC_NEXT 0x6b // command for next track of playlist |
||||
|
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
||||
|
#define RC_FIRST 0x6c // command for first track of playlist |
||||
|
#define RC_LAST 0x6d // command for last track of playlist |
||||
|
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
||||
|
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
||||
|
#define RC_MUTE 0x1c // Command to mute ESPuino |
||||
|
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
||||
|
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
||||
|
#define RC_FTP 0x65 // Command to enable FTP-server |
||||
|
#endif |
||||
#endif |
#endif |
@ -1,108 +1,111 @@ |
|||||
#include "Arduino.h" |
|
||||
|
#ifndef __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__ |
||||
|
#define __ESPUINO_SETTINGS_LOLIN_D32_PRO_H__ |
||||
|
#include "Arduino.h" |
||||
|
|
||||
//######################### INFOS #################################### |
|
||||
/* This is a develboard-specific config-file for *Wemos Lolin32*. Specific doesn't mean it's only working with this board. |
|
||||
Lolin32 is the predecessor of Lolin D32. |
|
||||
PCB: None so far |
|
||||
Infos: https://www.wemos.cc/en/latest/d32/d32_pro.html |
|
||||
Schematics: https://www.wemos.cc/en/latest/_static/files/sch_d32_pro_v2.0.0.pdf |
|
||||
Caveats: GPIO35 (battery monitoring) + SD can't be changed, it's built in (and because of the SD-pinout used, it is not compatible with MMC-mode) |
|
||||
Status: |
|
||||
tested with 2xSPI: RC522 & SD (by biologist79) |
|
||||
*/ |
|
||||
|
//######################### INFOS #################################### |
||||
|
/* This is a develboard-specific config-file for *Wemos Lolin32*. Specific doesn't mean it's only working with this board. |
||||
|
Lolin32 is the predecessor of Lolin D32. |
||||
|
PCB: None so far |
||||
|
Infos: https://www.wemos.cc/en/latest/d32/d32_pro.html |
||||
|
Schematics: https://www.wemos.cc/en/latest/_static/files/sch_d32_pro_v2.0.0.pdf |
||||
|
Caveats: GPIO35 (battery monitoring) + SD can't be changed, it's built in (and because of the SD-pinout used, it is not compatible with MMC-mode) |
||||
|
Status: |
||||
|
tested with 2xSPI: RC522 & SD (by biologist79) |
||||
|
*/ |
||||
|
|
||||
//################## GPIO-configuration ############################## |
|
||||
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
|
||||
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
|
||||
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
|
||||
// GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM). |
|
||||
#ifdef SD_MMC_1BIT_MODE |
|
||||
// NOT SUPPORTED BY D32 pro as 15 / 14 / 2 doesn't match D32 pro's SD-pinout |
|
||||
#else |
|
||||
// uSD-card-reader (via SPI) => Cannot be changed, it's built in! |
|
||||
#define SPISD_CS 4 // GPIO for chip select (SD) |
|
||||
#ifndef SINGLE_SPI_ENABLE |
|
||||
#define SPISD_MOSI 23 // GPIO for master out slave in (SD) => not necessary for single-SPI |
|
||||
#define SPISD_MISO 19 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
|
||||
#define SPISD_SCK 18 // GPIO for clock-signal (SD) => not necessary for single-SPI |
|
||||
|
//################## GPIO-configuration ############################## |
||||
|
// Please note: GPIOs 34, 35, 36, 39 are input-only and don't have pullup-resistors. |
||||
|
// So if connecting a button to these, make sure to add a 10k-pullup-resistor for each button. |
||||
|
// Further infos: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ |
||||
|
// GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM). |
||||
|
#ifdef SD_MMC_1BIT_MODE |
||||
|
// NOT SUPPORTED BY D32 pro as 15 / 14 / 2 doesn't match D32 pro's SD-pinout |
||||
|
#else |
||||
|
// uSD-card-reader (via SPI) => Cannot be changed, it's built in! |
||||
|
#define SPISD_CS 4 // GPIO for chip select (SD) |
||||
|
#ifndef SINGLE_SPI_ENABLE |
||||
|
#define SPISD_MOSI 23 // GPIO for master out slave in (SD) => not necessary for single-SPI |
||||
|
#define SPISD_MISO 19 // GPIO for master in slave ou (SD) => not necessary for single-SPI |
||||
|
#define SPISD_SCK 18 // GPIO for clock-signal (SD) => not necessary for single-SPI |
||||
|
#endif |
||||
#endif |
#endif |
||||
#endif |
|
||||
|
|
||||
// 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_MOSI 13 // GPIO for master out slave in (RFID) |
|
||||
#define RFID_MISO 15 // GPIO for master in slave out (RFID) |
|
||||
#define RFID_SCK 14 // GPIO for clock-signal (RFID) |
|
||||
|
// 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_MOSI 13 // GPIO for master out slave in (RFID) |
||||
|
#define RFID_MISO 15 // GPIO for master in slave out (RFID) |
||||
|
#define RFID_SCK 14 // GPIO for clock-signal (RFID) |
||||
|
|
||||
#ifdef RFID_READER_TYPE_PN5180 |
|
||||
#define RFID_BUSY 33 // PN5180 BUSY PIN |
|
||||
#define RFID_RST 22 // PN5180 RESET PIN |
|
||||
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
|
||||
#endif |
|
||||
// I2S (DAC) |
|
||||
#define I2S_DOUT 25 // Digital out (I2S) |
|
||||
#define I2S_BCLK 27 // BCLK (I2S) |
|
||||
#define I2S_LRC 26 // LRC (I2S) |
|
||||
|
#ifdef RFID_READER_TYPE_PN5180 |
||||
|
#define RFID_BUSY 33 // PN5180 BUSY PIN |
||||
|
#define RFID_RST 22 // PN5180 RESET PIN |
||||
|
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection) |
||||
|
#endif |
||||
|
// I2S (DAC) |
||||
|
#define I2S_DOUT 25 // Digital out (I2S) |
||||
|
#define I2S_BCLK 27 // BCLK (I2S) |
||||
|
#define I2S_LRC 26 // LRC (I2S) |
||||
|
|
||||
// Rotary encoder |
|
||||
#ifdef USEROTARY_ENABLE |
|
||||
#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'; Info: Lolin D32 pro is using 35 for battery-voltage-monitoring! |
|
||||
#define DREHENCODER_BUTTON 36 // Button 3: is used to switch ESPuino on and off; 36 = 'VP' |
|
||||
#endif |
|
||||
|
// Rotary encoder |
||||
|
#ifdef USEROTARY_ENABLE |
||||
|
#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'; Info: Lolin D32 pro is using 35 for battery-voltage-monitoring! |
||||
|
#define DREHENCODER_BUTTON 36 // Button 3: is used to switch ESPuino on and off; 36 = 'VP' |
||||
|
#endif |
||||
|
|
||||
// Control-buttons (set to 99 to disable) |
|
||||
#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: unnamed optional button |
|
||||
#define BUTTON_5 99 // Button 5: unnamed optional button |
|
||||
|
// Control-buttons (set to 99 to disable) |
||||
|
#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: unnamed optional button |
||||
|
#define BUTTON_5 99 // Button 5: unnamed optional button |
||||
|
|
||||
// Wake-up button |
|
||||
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
|
||||
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
|
||||
|
// Wake-up button |
||||
|
// Please note: only RTC-GPIOs (0, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39, 99) can be used! Set to 99 to disable. |
||||
|
#define WAKEUP_BUTTON DREHENCODER_BUTTON // Defines the button that is used to wake up ESPuino from deepsleep. |
||||
|
|
||||
// (optional) Power-control |
|
||||
#define POWER 5 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
|
||||
|
// (optional) Power-control |
||||
|
#define POWER 5 // GPIO used to drive transistor-circuit, that switches off peripheral devices while ESP32-deepsleep |
||||
|
|
||||
// (optional) Neopixel |
|
||||
#define LED_PIN 12 // GPIO for Neopixel-signaling |
|
||||
|
// (optional) Neopixel |
||||
|
#define LED_PIN 12 // GPIO for Neopixel-signaling |
||||
|
|
||||
// (optinal) Headphone-detection |
|
||||
#ifdef HEADPHONE_ADJUST_ENABLE |
|
||||
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
|
||||
#endif |
|
||||
|
// (optinal) Headphone-detection |
||||
|
#ifdef HEADPHONE_ADJUST_ENABLE |
||||
|
#define HP_DETECT 22 // GPIO that detects, if there's a plug in the headphone jack or not |
||||
|
#endif |
||||
|
|
||||
// (optional) Monitoring of battery-voltage via ADC |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
#define VOLTAGE_READ_PIN 35 // GPIO used to monitor battery-voltage. Cannot be changed, it's built in |
|
||||
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
|
||||
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
|
||||
#endif |
|
||||
|
// (optional) Monitoring of battery-voltage via ADC |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
#define VOLTAGE_READ_PIN 35 // GPIO used to monitor battery-voltage. Cannot be changed, it's built in |
||||
|
float referenceVoltage = 3.30; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!) |
||||
|
float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here |
||||
|
#endif |
||||
|
|
||||
// (optional) For measuring battery-voltage a voltage-divider is already onboard. Connect a LiPo and use it! |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
uint8_t rdiv1 = 100; // Cannot be changed, it's built in |
|
||||
uint16_t rdiv2 = 100; // Cannot be changed, it's built in |
|
||||
#endif |
|
||||
|
// (optional) For measuring battery-voltage a voltage-divider is already onboard. Connect a LiPo and use it! |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
uint8_t rdiv1 = 100; // Cannot be changed, it's built in |
||||
|
uint16_t rdiv2 = 100; // Cannot be changed, it's built in |
||||
|
#endif |
||||
|
|
||||
// (Optional) remote control via infrared |
|
||||
#ifdef IR_CONTROL_ENABLE |
|
||||
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
|
||||
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
|
||||
|
// (Optional) remote control via infrared |
||||
|
#ifdef IR_CONTROL_ENABLE |
||||
|
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B) |
||||
|
#define IR_DEBOUNCE 200 // Interval in ms to wait at least for next signal (not used for actions volume up/down) |
||||
|
|
||||
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
|
||||
#define RC_PLAY 0x68 // command for play |
|
||||
#define RC_PAUSE 0x67 // command for pause |
|
||||
#define RC_NEXT 0x6b // command for next track of playlist |
|
||||
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
|
||||
#define RC_FIRST 0x6c // command for first track of playlist |
|
||||
#define RC_LAST 0x6d // command for last track of playlist |
|
||||
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
|
||||
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
|
||||
#define RC_MUTE 0x1c // Command to mute ESPuino |
|
||||
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
|
||||
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
|
||||
#define RC_FTP 0x65 // Command to enable FTP-server |
|
||||
|
// Actions available. Use your own remote control and have a look at the console for "Command=0x??". E.g. "Protocol=NEC Address=0x17F Command=0x68 Repeat gap=39750us" |
||||
|
#define RC_PLAY 0x68 // command for play |
||||
|
#define RC_PAUSE 0x67 // command for pause |
||||
|
#define RC_NEXT 0x6b // command for next track of playlist |
||||
|
#define RC_PREVIOUS 0x6a // command for previous track of playlist |
||||
|
#define RC_FIRST 0x6c // command for first track of playlist |
||||
|
#define RC_LAST 0x6d // command for last track of playlist |
||||
|
#define RC_VOL_UP 0x1a // Command for volume up (one step) |
||||
|
#define RC_VOL_DOWN 0x1b // Command for volume down (one step) |
||||
|
#define RC_MUTE 0x1c // Command to mute ESPuino |
||||
|
#define RC_SHUTDOWN 0x2a // Command for deepsleep |
||||
|
#define RC_BLUETOOTH 0x72 // Command to enable/disable bluetooth |
||||
|
#define RC_FTP 0x65 // Command to enable FTP-server |
||||
|
#endif |
||||
#endif |
#endif |
@ -1,203 +1,206 @@ |
|||||
#include "Arduino.h" |
|
||||
#include "values.h" |
|
||||
|
|
||||
//######################### INFOS #################################### |
|
||||
// This is the general configfile for ESPuino-configuration. |
|
||||
|
|
||||
//################## HARDWARE-PLATFORM ############################### |
|
||||
/* Make sure to also edit the configfile, that is specific for your platform. |
|
||||
If in doubts (your develboard is not listed) use HAL 1 |
|
||||
1: Wemos Lolin32 => settings-lolin32.h |
|
||||
2: ESP32-A1S Audiokit => settings-espa1s.h |
|
||||
3: Wemos Lolin D32 => settings-lolin_D32.h |
|
||||
4: Wemos Lolin D32 pro => settings-lolin_D32_pro.h |
|
||||
99: custom => settings-custom.h |
|
||||
more to come... |
|
||||
*/ |
|
||||
#define HAL 1 // HAL 1 = LoLin32, 2 = ESP32-A1S-AudioKit, 3 = Lolin D32, 4 = Lolin D32 pro; 99 = custom |
|
||||
|
|
||||
|
|
||||
//########################## MODULES ################################# |
|
||||
#define MDNS_ENABLE // When enabled, you don't have to handle with ESPuino's IP-address. If hostname is set to "ESPuino", you can reach it via ESPuino.local |
|
||||
#define MQTT_ENABLE // Make sure to configure mqtt-server and (optionally) username+pwd |
|
||||
#define FTP_ENABLE // Enables FTP-server; DON'T FORGET TO ACTIVATE AFTER BOOT BY PRESSING PAUSE + NEXT-BUTTONS (IN PARALLEL)! |
|
||||
#define NEOPIXEL_ENABLE // Don't forget configuration of NUM_LEDS if enabled |
|
||||
//#define NEOPIXEL_REVERSE_ROTATION // Some Neopixels are adressed/soldered counter-clockwise. This can be configured here. |
|
||||
#define LANGUAGE 1 // 1 = deutsch; 2 = english |
|
||||
//#define STATIC_IP_ENABLE // Enables static IP-configuration (change static ip-section accordingly) |
|
||||
//#define HEADPHONE_ADJUST_ENABLE // Used to adjust (lower) volume for optional headphone-pcb (refer maxVolumeSpeaker / maxVolumeHeadphone) |
|
||||
#define SHUTDOWN_IF_SD_BOOT_FAILS // Will put ESP to deepsleep if boot fails due to SD. Really recommend this if there's in battery-mode no other way to restart ESP! Interval adjustable via deepsleepTimeAfterBootFails. |
|
||||
#define MEASURE_BATTERY_VOLTAGE // Enables battery-measurement via GPIO (ADC) and voltage-divider |
|
||||
//#define PLAY_LAST_RFID_AFTER_REBOOT // When restarting ESPuino, the last RFID that was active before, is recalled and played |
|
||||
//#define USE_LAST_VOLUME_AFTER_REBOOT // Remembers the volume used at last shutdown after reboot |
|
||||
#define USEROTARY_ENABLE // If rotary-encoder is used (don't forget to review WAKEUP_BUTTON if you disable this feature!) |
|
||||
#define BLUETOOTH_ENABLE // If enabled and bluetooth-mode is active, you can stream to your ESPuino via bluetooth (a2dp-sink). |
|
||||
//#define IR_CONTROL_ENABLE // Enables remote control |
|
||||
|
|
||||
|
|
||||
//################## select SD card mode ############################# |
|
||||
//#define SD_MMC_1BIT_MODE // run SD card in SD-MMC 1Bit mode |
|
||||
//#define SINGLE_SPI_ENABLE // If only one SPI-instance should be used instead of two (not yet working!) (Works on ESP32-A1S with RFID via I2C) |
|
||||
|
|
||||
|
|
||||
//################## select RFID reader ############################## |
|
||||
#define RFID_READER_TYPE_MFRC522_SPI // use MFRC522 via SPI |
|
||||
//#define RFID_READER_TYPE_MFRC522_I2C // use MFRC522 via I2C |
|
||||
//#define RFID_READER_TYPE_PN5180 // use PN5180 |
|
||||
|
|
||||
#ifdef RFID_READER_TYPE_PN5180 |
|
||||
//#define PN5180_ENABLE_LPCD // enable PN5180 low power card detection. Wakes up ESPuino if RFID-tag was applied while deepsleep is active. |
|
||||
#endif |
|
||||
|
|
||||
#ifdef RFID_READER_TYPE_MFRC522_SPI |
|
||||
uint8_t rfidGain = 0x07 << 4; // Sensitivity of RC522. For possible values see reference: https://forum.espuino.de/uploads/default/original/1X/9de5f8d35cbc123c1378cad1beceb3f51035cec0.png |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
//################## BUTTON-Layout ################################## |
|
||||
/* German documentation: https://forum.espuino.de/t/das-dynamische-button-layout/224 |
|
||||
Please note the following numbers as you need to know them in order to define actions for buttons. |
|
||||
Even if you don't use all of them, their numbers won't change |
|
||||
0: NEXT_BUTTON |
|
||||
1: PREVIOUS_BUTTON |
|
||||
2: PAUSEPLAY_BUTTON |
|
||||
3: DREHENCODER_BUTTON |
|
||||
4: BUTTON_4 |
|
||||
5: BUTTON_5 |
|
||||
|
|
||||
Don't forget to enable/configure those buttons you want to use in your develboard-specific config (e.g. settings-custom.h) |
|
||||
|
|
||||
Single-buttons [can be long or short] (examples): |
|
||||
BUTTON_0_SHORT => Button 0 (NEXT_BUTTON) pressed shortly |
|
||||
BUTTON_3_SHORT => Button 3 (DREHENCODER_BUTTON) pressed shortly |
|
||||
BUTTON_4_LONG => Button 4 (BUTTON_4) pressed long |
|
||||
|
|
||||
Multi-buttons [short only] (examples): |
|
||||
BUTTON_MULTI_01 => Buttons 0+1 (NEXT_BUTTON + PREVIOUS_BUTTON) pressed in parallel |
|
||||
BUTTON_MULTI_23 => Buttons 0+2 (NEXT_BUTTON + PAUSEPLAY_BUTTON) pressed in parallel |
|
||||
|
|
||||
Actions: |
|
||||
To all of those buttons, an action can be assigned freely. |
|
||||
Please have a look at values.h to look up actions available (>=100 can be used) |
|
||||
If you don't want to assign an action or you don't use a given button: CMD_NOTHING has to be set |
|
||||
*/ |
|
||||
// *****BUTTON***** *****ACTION***** |
|
||||
#define BUTTON_0_SHORT CMD_NEXTTRACK |
|
||||
#define BUTTON_1_SHORT CMD_PREVTRACK |
|
||||
#define BUTTON_2_SHORT CMD_PLAYPAUSE |
|
||||
#define BUTTON_3_SHORT CMD_MEASUREBATTERY |
|
||||
#define BUTTON_4_SHORT CMD_NOTHING |
|
||||
#define BUTTON_5_SHORT CMD_NOTHING |
|
||||
|
|
||||
#define BUTTON_0_LONG CMD_LASTTRACK |
|
||||
#define BUTTON_1_LONG CMD_FIRSTTRACK |
|
||||
#define BUTTON_2_LONG CMD_PLAYPAUSE |
|
||||
#define BUTTON_3_LONG CMD_SLEEPMODE |
|
||||
#define BUTTON_4_LONG CMD_NOTHING |
|
||||
#define BUTTON_5_LONG CMD_NOTHING |
|
||||
|
|
||||
#define BUTTON_MULTI_01 TOGGLE_WIFI_STATUS |
|
||||
#define BUTTON_MULTI_02 ENABLE_FTP_SERVER |
|
||||
#define BUTTON_MULTI_03 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_04 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_05 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_12 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_13 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_14 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_15 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_23 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_24 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_25 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_34 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_35 CMD_NOTHING |
|
||||
#define BUTTON_MULTI_45 CMD_NOTHING |
|
||||
|
|
||||
//#################### Various settings ############################## |
|
||||
// Loglevels available (don't change!) |
|
||||
#define LOGLEVEL_ERROR 1 // only errors |
|
||||
#define LOGLEVEL_NOTICE 2 // errors + important messages |
|
||||
#define LOGLEVEL_INFO 3 // infos + errors + important messages |
|
||||
#define LOGLEVEL_DEBUG 4 // almost everything |
|
||||
|
|
||||
// Serial-logging-configuration |
|
||||
const uint8_t serialDebug = LOGLEVEL_DEBUG; // Current loglevel for serial console |
|
||||
|
|
||||
// Static ip-configuration |
|
||||
#ifdef STATIC_IP_ENABLE |
|
||||
IPAddress local_IP(192, 168, 2, 100); // ESPuino's IP |
|
||||
IPAddress gateway(192, 168, 2, 1); // IP of the gateway/router |
|
||||
IPAddress subnet(255, 255, 255, 0); // Netmask of your network (/24 => 255.255.255.0) |
|
||||
IPAddress primaryDNS(192, 168, 2, 1); // DNS-server of your network; in private networks it's usually the gatewy's IP |
|
||||
#endif |
|
||||
|
|
||||
// Buttons (better leave unchanged if in doubts :-)) |
|
||||
uint8_t buttonDebounceInterval = 50; // Interval in ms to software-debounce buttons |
|
||||
uint16_t intervalToLongPress = 700; // Interval in ms to distinguish between short and long press of previous/next-button |
|
||||
|
|
||||
// RFID |
|
||||
#define RFID_SCAN_INTERVAL 300 // Interval-time in ms (how often is RFID read?) |
|
||||
|
|
||||
// Automatic restart |
|
||||
#ifdef SHUTDOWN_IF_SD_BOOT_FAILS |
|
||||
uint32_t deepsleepTimeAfterBootFails = 20; // Automatic restart takes place if boot was not successful after this period (in seconds) |
|
||||
#endif |
|
||||
|
|
||||
// FTP |
|
||||
// Nothing to be configured here... |
|
||||
// Default user/password is esp32/esp32 but can be changed via webgui |
|
||||
|
|
||||
// ESPuino will create a WiFi if joing existing WiFi was not possible. Name can be configured here. |
|
||||
static const char accessPointNetworkSSID[] PROGMEM = "ESPuino"; // Access-point's SSID |
|
||||
static const char nameBluetoothDevice[] PROGMEM = "ESPuino"; // Name of your ESPuino as Bluetooth-device |
|
||||
|
|
||||
// Where to store the backup-file for NVS-records |
|
||||
static const char backupFile[] PROGMEM = "/backup.txt"; // File is written every time a (new) RFID-assignment via GUI is done |
|
||||
|
|
||||
|
|
||||
//#################### Settings for optional Modules############################## |
|
||||
// (optinal) Neopixel |
|
||||
#ifdef NEOPIXEL_ENABLE |
|
||||
#define NUM_LEDS 24 // number of LEDs |
|
||||
#define CHIPSET WS2812B // type of Neopixel |
|
||||
#define COLOR_ORDER GRB |
|
||||
#endif |
|
||||
|
|
||||
// (optional) Default-voltages for battery-monitoring via Neopixel |
|
||||
float warningLowVoltage = 3.4; // If battery-voltage is >= this value, a cyclic warning will be indicated by Neopixel (can be changed via GUI!) |
|
||||
uint8_t voltageCheckInterval = 10; // How of battery-voltage is measured (in minutes) (can be changed via GUI!) |
|
||||
float voltageIndicatorLow = 3.0; // Lower range for Neopixel-voltage-indication (0 leds) (can be changed via GUI!) |
|
||||
float voltageIndicatorHigh = 4.2; // Upper range for Neopixel-voltage-indication (all leds) (can be changed via GUI!) |
|
||||
|
|
||||
// (optinal) Headphone-detection (leave unchanged if in doubts...) |
|
||||
#ifdef HEADPHONE_ADJUST_ENABLE |
|
||||
uint16_t headphoneLastDetectionDebounce = 1000; // Debounce-interval in ms when plugging in headphone |
|
||||
#endif |
|
||||
|
|
||||
// (optional) Topics for MQTT |
|
||||
#ifdef MQTT_ENABLE |
|
||||
uint16_t mqttRetryInterval = 60; // Try to reconnect to MQTT-server every (n) seconds if connection is broken |
|
||||
uint8_t mqttMaxRetriesPerInterval = 1; // Number of retries per time-interval (mqttRetryInterval). mqttRetryInterval 60 / mqttMaxRetriesPerInterval 1 => once every 60s |
|
||||
#define DEVICE_HOSTNAME "ESP32-ESPuino" // Name that is used for MQTT |
|
||||
static const char topicSleepCmnd[] PROGMEM = "Cmnd/ESPuino/Sleep"; |
|
||||
static const char topicSleepState[] PROGMEM = "State/ESPuino/Sleep"; |
|
||||
static const char topicRfidCmnd[] PROGMEM = "Cmnd/ESPuino/Rfid"; |
|
||||
static const char topicRfidState[] PROGMEM = "State/ESPuino/Rfid"; |
|
||||
static const char topicTrackState[] PROGMEM = "State/ESPuino/Track"; |
|
||||
static const char topicTrackControlCmnd[] PROGMEM = "Cmnd/ESPuino/TrackControl"; |
|
||||
static const char topicLoudnessCmnd[] PROGMEM = "Cmnd/ESPuino/Loudness"; |
|
||||
static const char topicLoudnessState[] PROGMEM = "State/ESPuino/Loudness"; |
|
||||
static const char topicSleepTimerCmnd[] PROGMEM = "Cmnd/ESPuino/SleepTimer"; |
|
||||
static const char topicSleepTimerState[] PROGMEM = "State/ESPuino/SleepTimer"; |
|
||||
static const char topicState[] PROGMEM = "State/ESPuino/State"; |
|
||||
static const char topicCurrentIPv4IP[] PROGMEM = "State/ESPuino/IPv4"; |
|
||||
static const char topicLockControlsCmnd[] PROGMEM ="Cmnd/ESPuino/LockControls"; |
|
||||
static const char topicLockControlsState[] PROGMEM ="State/ESPuino/LockControls"; |
|
||||
static const char topicPlaymodeState[] PROGMEM = "State/ESPuino/Playmode"; |
|
||||
static const char topicRepeatModeCmnd[] PROGMEM = "Cmnd/ESPuino/RepeatMode"; |
|
||||
static const char topicRepeatModeState[] PROGMEM = "State/ESPuino/RepeatMode"; |
|
||||
static const char topicLedBrightnessCmnd[] PROGMEM = "Cmnd/ESPuino/LedBrightness"; |
|
||||
static const char topicLedBrightnessState[] PROGMEM = "State/ESPuino/LedBrightness"; |
|
||||
#ifdef MEASURE_BATTERY_VOLTAGE |
|
||||
static const char topicBatteryVoltage[] PROGMEM = "State/ESPuino/Voltage"; |
|
||||
|
#ifndef __ESPUINO_SETTINGS_H__ |
||||
|
#define __ESPUINO_SETTINGS_H__ |
||||
|
#include "Arduino.h" |
||||
|
#include "values.h" |
||||
|
|
||||
|
//######################### INFOS #################################### |
||||
|
// This is the general configfile for ESPuino-configuration. |
||||
|
|
||||
|
//################## HARDWARE-PLATFORM ############################### |
||||
|
/* Make sure to also edit the configfile, that is specific for your platform. |
||||
|
If in doubts (your develboard is not listed) use HAL 1 |
||||
|
1: Wemos Lolin32 => settings-lolin32.h |
||||
|
2: ESP32-A1S Audiokit => settings-espa1s.h |
||||
|
3: Wemos Lolin D32 => settings-lolin_D32.h |
||||
|
4: Wemos Lolin D32 pro => settings-lolin_D32_pro.h |
||||
|
99: custom => settings-custom.h |
||||
|
more to come... |
||||
|
*/ |
||||
|
#define HAL 1 // HAL 1 = LoLin32, 2 = ESP32-A1S-AudioKit, 3 = Lolin D32, 4 = Lolin D32 pro; 99 = custom |
||||
|
|
||||
|
|
||||
|
//########################## MODULES ################################# |
||||
|
#define MDNS_ENABLE // When enabled, you don't have to handle with ESPuino's IP-address. If hostname is set to "ESPuino", you can reach it via ESPuino.local |
||||
|
#define MQTT_ENABLE // Make sure to configure mqtt-server and (optionally) username+pwd |
||||
|
#define FTP_ENABLE // Enables FTP-server; DON'T FORGET TO ACTIVATE AFTER BOOT BY PRESSING PAUSE + NEXT-BUTTONS (IN PARALLEL)! |
||||
|
#define NEOPIXEL_ENABLE // Don't forget configuration of NUM_LEDS if enabled |
||||
|
//#define NEOPIXEL_REVERSE_ROTATION // Some Neopixels are adressed/soldered counter-clockwise. This can be configured here. |
||||
|
#define LANGUAGE 1 // 1 = deutsch; 2 = english |
||||
|
//#define STATIC_IP_ENABLE // Enables static IP-configuration (change static ip-section accordingly) |
||||
|
//#define HEADPHONE_ADJUST_ENABLE // Used to adjust (lower) volume for optional headphone-pcb (refer maxVolumeSpeaker / maxVolumeHeadphone) |
||||
|
#define SHUTDOWN_IF_SD_BOOT_FAILS // Will put ESP to deepsleep if boot fails due to SD. Really recommend this if there's in battery-mode no other way to restart ESP! Interval adjustable via deepsleepTimeAfterBootFails. |
||||
|
#define MEASURE_BATTERY_VOLTAGE // Enables battery-measurement via GPIO (ADC) and voltage-divider |
||||
|
//#define PLAY_LAST_RFID_AFTER_REBOOT // When restarting ESPuino, the last RFID that was active before, is recalled and played |
||||
|
//#define USE_LAST_VOLUME_AFTER_REBOOT // Remembers the volume used at last shutdown after reboot |
||||
|
#define USEROTARY_ENABLE // If rotary-encoder is used (don't forget to review WAKEUP_BUTTON if you disable this feature!) |
||||
|
#define BLUETOOTH_ENABLE // If enabled and bluetooth-mode is active, you can stream to your ESPuino via bluetooth (a2dp-sink). |
||||
|
//#define IR_CONTROL_ENABLE // Enables remote control |
||||
|
|
||||
|
|
||||
|
//################## select SD card mode ############################# |
||||
|
//#define SD_MMC_1BIT_MODE // run SD card in SD-MMC 1Bit mode |
||||
|
//#define SINGLE_SPI_ENABLE // If only one SPI-instance should be used instead of two (not yet working!) (Works on ESP32-A1S with RFID via I2C) |
||||
|
|
||||
|
|
||||
|
//################## select RFID reader ############################## |
||||
|
#define RFID_READER_TYPE_MFRC522_SPI // use MFRC522 via SPI |
||||
|
//#define RFID_READER_TYPE_MFRC522_I2C // use MFRC522 via I2C |
||||
|
//#define RFID_READER_TYPE_PN5180 // use PN5180 |
||||
|
|
||||
|
#ifdef RFID_READER_TYPE_PN5180 |
||||
|
//#define PN5180_ENABLE_LPCD // enable PN5180 low power card detection. Wakes up ESPuino if RFID-tag was applied while deepsleep is active. |
||||
#endif |
#endif |
||||
#endif |
|
||||
|
|
||||
|
#ifdef RFID_READER_TYPE_MFRC522_SPI |
||||
|
uint8_t rfidGain = 0x07 << 4; // Sensitivity of RC522. For possible values see reference: https://forum.espuino.de/uploads/default/original/1X/9de5f8d35cbc123c1378cad1beceb3f51035cec0.png |
||||
|
#endif |
||||
|
|
||||
|
|
||||
|
//################## BUTTON-Layout ################################## |
||||
|
/* German documentation: https://forum.espuino.de/t/das-dynamische-button-layout/224 |
||||
|
Please note the following numbers as you need to know them in order to define actions for buttons. |
||||
|
Even if you don't use all of them, their numbers won't change |
||||
|
0: NEXT_BUTTON |
||||
|
1: PREVIOUS_BUTTON |
||||
|
2: PAUSEPLAY_BUTTON |
||||
|
3: DREHENCODER_BUTTON |
||||
|
4: BUTTON_4 |
||||
|
5: BUTTON_5 |
||||
|
|
||||
|
Don't forget to enable/configure those buttons you want to use in your develboard-specific config (e.g. settings-custom.h) |
||||
|
|
||||
|
Single-buttons [can be long or short] (examples): |
||||
|
BUTTON_0_SHORT => Button 0 (NEXT_BUTTON) pressed shortly |
||||
|
BUTTON_3_SHORT => Button 3 (DREHENCODER_BUTTON) pressed shortly |
||||
|
BUTTON_4_LONG => Button 4 (BUTTON_4) pressed long |
||||
|
|
||||
|
Multi-buttons [short only] (examples): |
||||
|
BUTTON_MULTI_01 => Buttons 0+1 (NEXT_BUTTON + PREVIOUS_BUTTON) pressed in parallel |
||||
|
BUTTON_MULTI_23 => Buttons 0+2 (NEXT_BUTTON + PAUSEPLAY_BUTTON) pressed in parallel |
||||
|
|
||||
|
Actions: |
||||
|
To all of those buttons, an action can be assigned freely. |
||||
|
Please have a look at values.h to look up actions available (>=100 can be used) |
||||
|
If you don't want to assign an action or you don't use a given button: CMD_NOTHING has to be set |
||||
|
*/ |
||||
|
// *****BUTTON***** *****ACTION***** |
||||
|
#define BUTTON_0_SHORT CMD_NEXTTRACK |
||||
|
#define BUTTON_1_SHORT CMD_PREVTRACK |
||||
|
#define BUTTON_2_SHORT CMD_PLAYPAUSE |
||||
|
#define BUTTON_3_SHORT CMD_MEASUREBATTERY |
||||
|
#define BUTTON_4_SHORT CMD_NOTHING |
||||
|
#define BUTTON_5_SHORT CMD_NOTHING |
||||
|
|
||||
|
#define BUTTON_0_LONG CMD_LASTTRACK |
||||
|
#define BUTTON_1_LONG CMD_FIRSTTRACK |
||||
|
#define BUTTON_2_LONG CMD_PLAYPAUSE |
||||
|
#define BUTTON_3_LONG CMD_SLEEPMODE |
||||
|
#define BUTTON_4_LONG CMD_NOTHING |
||||
|
#define BUTTON_5_LONG CMD_NOTHING |
||||
|
|
||||
|
#define BUTTON_MULTI_01 TOGGLE_WIFI_STATUS |
||||
|
#define BUTTON_MULTI_02 ENABLE_FTP_SERVER |
||||
|
#define BUTTON_MULTI_03 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_04 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_05 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_12 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_13 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_14 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_15 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_23 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_24 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_25 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_34 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_35 CMD_NOTHING |
||||
|
#define BUTTON_MULTI_45 CMD_NOTHING |
||||
|
|
||||
|
//#################### Various settings ############################## |
||||
|
// Loglevels available (don't change!) |
||||
|
#define LOGLEVEL_ERROR 1 // only errors |
||||
|
#define LOGLEVEL_NOTICE 2 // errors + important messages |
||||
|
#define LOGLEVEL_INFO 3 // infos + errors + important messages |
||||
|
#define LOGLEVEL_DEBUG 4 // almost everything |
||||
|
|
||||
|
// Serial-logging-configuration |
||||
|
const uint8_t serialDebug = LOGLEVEL_DEBUG; // Current loglevel for serial console |
||||
|
|
||||
|
// Static ip-configuration |
||||
|
#ifdef STATIC_IP_ENABLE |
||||
|
IPAddress local_IP(192, 168, 2, 100); // ESPuino's IP |
||||
|
IPAddress gateway(192, 168, 2, 1); // IP of the gateway/router |
||||
|
IPAddress subnet(255, 255, 255, 0); // Netmask of your network (/24 => 255.255.255.0) |
||||
|
IPAddress primaryDNS(192, 168, 2, 1); // DNS-server of your network; in private networks it's usually the gatewy's IP |
||||
|
#endif |
||||
|
|
||||
|
// Buttons (better leave unchanged if in doubts :-)) |
||||
|
uint8_t buttonDebounceInterval = 50; // Interval in ms to software-debounce buttons |
||||
|
uint16_t intervalToLongPress = 700; // Interval in ms to distinguish between short and long press of previous/next-button |
||||
|
|
||||
|
// RFID |
||||
|
#define RFID_SCAN_INTERVAL 300 // Interval-time in ms (how often is RFID read?) |
||||
|
|
||||
|
// Automatic restart |
||||
|
#ifdef SHUTDOWN_IF_SD_BOOT_FAILS |
||||
|
uint32_t deepsleepTimeAfterBootFails = 20; // Automatic restart takes place if boot was not successful after this period (in seconds) |
||||
|
#endif |
||||
|
|
||||
|
// FTP |
||||
|
// Nothing to be configured here... |
||||
|
// Default user/password is esp32/esp32 but can be changed via webgui |
||||
|
|
||||
|
// ESPuino will create a WiFi if joing existing WiFi was not possible. Name can be configured here. |
||||
|
static const char accessPointNetworkSSID[] PROGMEM = "ESPuino"; // Access-point's SSID |
||||
|
static const char nameBluetoothDevice[] PROGMEM = "ESPuino"; // Name of your ESPuino as Bluetooth-device |
||||
|
|
||||
|
// Where to store the backup-file for NVS-records |
||||
|
static const char backupFile[] PROGMEM = "/backup.txt"; // File is written every time a (new) RFID-assignment via GUI is done |
||||
|
|
||||
|
|
||||
|
//#################### Settings for optional Modules############################## |
||||
|
// (optinal) Neopixel |
||||
|
#ifdef NEOPIXEL_ENABLE |
||||
|
#define NUM_LEDS 24 // number of LEDs |
||||
|
#define CHIPSET WS2812B // type of Neopixel |
||||
|
#define COLOR_ORDER GRB |
||||
|
#endif |
||||
|
|
||||
|
// (optional) Default-voltages for battery-monitoring via Neopixel |
||||
|
float warningLowVoltage = 3.4; // If battery-voltage is >= this value, a cyclic warning will be indicated by Neopixel (can be changed via GUI!) |
||||
|
uint8_t voltageCheckInterval = 10; // How of battery-voltage is measured (in minutes) (can be changed via GUI!) |
||||
|
float voltageIndicatorLow = 3.0; // Lower range for Neopixel-voltage-indication (0 leds) (can be changed via GUI!) |
||||
|
float voltageIndicatorHigh = 4.2; // Upper range for Neopixel-voltage-indication (all leds) (can be changed via GUI!) |
||||
|
|
||||
|
// (optinal) Headphone-detection (leave unchanged if in doubts...) |
||||
|
#ifdef HEADPHONE_ADJUST_ENABLE |
||||
|
uint16_t headphoneLastDetectionDebounce = 1000; // Debounce-interval in ms when plugging in headphone |
||||
|
#endif |
||||
|
|
||||
|
// (optional) Topics for MQTT |
||||
|
#ifdef MQTT_ENABLE |
||||
|
uint16_t mqttRetryInterval = 60; // Try to reconnect to MQTT-server every (n) seconds if connection is broken |
||||
|
uint8_t mqttMaxRetriesPerInterval = 1; // Number of retries per time-interval (mqttRetryInterval). mqttRetryInterval 60 / mqttMaxRetriesPerInterval 1 => once every 60s |
||||
|
#define DEVICE_HOSTNAME "ESP32-ESPuino" // Name that is used for MQTT |
||||
|
static const char topicSleepCmnd[] PROGMEM = "Cmnd/ESPuino/Sleep"; |
||||
|
static const char topicSleepState[] PROGMEM = "State/ESPuino/Sleep"; |
||||
|
static const char topicRfidCmnd[] PROGMEM = "Cmnd/ESPuino/Rfid"; |
||||
|
static const char topicRfidState[] PROGMEM = "State/ESPuino/Rfid"; |
||||
|
static const char topicTrackState[] PROGMEM = "State/ESPuino/Track"; |
||||
|
static const char topicTrackControlCmnd[] PROGMEM = "Cmnd/ESPuino/TrackControl"; |
||||
|
static const char topicLoudnessCmnd[] PROGMEM = "Cmnd/ESPuino/Loudness"; |
||||
|
static const char topicLoudnessState[] PROGMEM = "State/ESPuino/Loudness"; |
||||
|
static const char topicSleepTimerCmnd[] PROGMEM = "Cmnd/ESPuino/SleepTimer"; |
||||
|
static const char topicSleepTimerState[] PROGMEM = "State/ESPuino/SleepTimer"; |
||||
|
static const char topicState[] PROGMEM = "State/ESPuino/State"; |
||||
|
static const char topicCurrentIPv4IP[] PROGMEM = "State/ESPuino/IPv4"; |
||||
|
static const char topicLockControlsCmnd[] PROGMEM ="Cmnd/ESPuino/LockControls"; |
||||
|
static const char topicLockControlsState[] PROGMEM ="State/ESPuino/LockControls"; |
||||
|
static const char topicPlaymodeState[] PROGMEM = "State/ESPuino/Playmode"; |
||||
|
static const char topicRepeatModeCmnd[] PROGMEM = "Cmnd/ESPuino/RepeatMode"; |
||||
|
static const char topicRepeatModeState[] PROGMEM = "State/ESPuino/RepeatMode"; |
||||
|
static const char topicLedBrightnessCmnd[] PROGMEM = "Cmnd/ESPuino/LedBrightness"; |
||||
|
static const char topicLedBrightnessState[] PROGMEM = "State/ESPuino/LedBrightness"; |
||||
|
#ifdef MEASURE_BATTERY_VOLTAGE |
||||
|
static const char topicBatteryVoltage[] PROGMEM = "State/ESPuino/Voltage"; |
||||
|
#endif |
||||
|
#endif |
||||
|
#endif |
Write
Preview
Loading…
Cancel
Save
Reference in new issue