Browse Source

Fixing CI-compile-error for battery-mgmt

master
Torsten Stauder 4 years ago
parent
commit
ee1b13bdb8
  1. 2
      platformio.ini
  2. 15
      src/Battery.cpp
  3. 9
      src/Cmd.cpp
  4. 19
      src/Led.cpp
  5. 9
      src/Web.cpp
  6. 2
      src/revision.h
  7. 10
      src/settings-azdelivery_sdmmc.h
  8. 46
      src/settings-complete.h
  9. 6
      src/settings-custom.h
  10. 6
      src/settings-lolin32.h
  11. 6
      src/settings-lolin_d32.h
  12. 4
      src/settings-lolin_d32_pro_sdmmc_pe.h
  13. 6
      src/settings-ttgo_t8.h
  14. 4
      src/values.h

2
platformio.ini

@ -143,6 +143,8 @@ build_flags = -DHAL=6
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-issue
-DLOG_BUFFER_SIZE=10240 -DLOG_BUFFER_SIZE=10240
board_upload.maximum_size = 16777216
board_upload.flash_size = 16MB
;;; Change upload/monitor-port of your board regarding your operating-system and develboard! ;;; Change upload/monitor-port of your board regarding your operating-system and develboard!
;MAC: /dev/cu.SLAB_USBtoUART / /dev/cu.wchusbserial1420 / /dev/cu.wchusbserial1410 ;MAC: /dev/cu.SLAB_USBtoUART / /dev/cu.wchusbserial1420 / /dev/cu.wchusbserial1410

15
src/Battery.cpp

@ -13,8 +13,15 @@ uint8_t voltageCheckInterval = s_voltageCheckInterval;
float voltageIndicatorLow = s_voltageIndicatorLow; float voltageIndicatorLow = s_voltageIndicatorLow;
float voltageIndicatorHigh = s_voltageIndicatorHigh; float voltageIndicatorHigh = s_voltageIndicatorHigh;
// Only enable measurements if valid GPIO is used
#ifdef MEASURE_BATTERY_VOLTAGE
#if (VOLTAGE_READ_PIN >= 0 && VOLTAGE_READ_PIN <= 39)
#define ENABLE_BATTERY_MEASUREMENTS
#endif
#endif
void Battery_Init() { void Battery_Init() {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
// Get voltages from NVS for Neopixel // Get voltages from NVS for Neopixel
float vLowIndicator = gPrefsSettings.getFloat("vIndicatorLow", 999.99); float vLowIndicator = gPrefsSettings.getFloat("vIndicatorLow", 999.99);
if (vLowIndicator <= 999) { if (vLowIndicator <= 999) {
@ -56,7 +63,7 @@ void Battery_Init() {
// The average of several analog reads will be taken to reduce the noise (Note: One analog read takes ~10µs) // The average of several analog reads will be taken to reduce the noise (Note: One analog read takes ~10µs)
float Battery_GetVoltage(void) { float Battery_GetVoltage(void) {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
float factor = 1 / ((float) rdiv2 / (rdiv2 + rdiv1)); float factor = 1 / ((float) rdiv2 / (rdiv2 + rdiv1));
float averagedAnalogValue = 0; float averagedAnalogValue = 0;
uint8_t i; uint8_t i;
@ -65,12 +72,14 @@ float Battery_GetVoltage(void) {
} }
averagedAnalogValue /= 20.0; averagedAnalogValue /= 20.0;
return (averagedAnalogValue / maxAnalogValue) * referenceVoltage * factor + offsetVoltage; return (averagedAnalogValue / maxAnalogValue) * referenceVoltage * factor + offsetVoltage;
#else
return 3.3; // Dummy-value
#endif #endif
} }
// Measures voltage of a battery as per interval or after bootup (after allowing a few seconds to settle down) // Measures voltage of a battery as per interval or after bootup (after allowing a few seconds to settle down)
void Battery_Cyclic(void) { void Battery_Cyclic(void) {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
static uint32_t lastVoltageCheckTimestamp = 0; static uint32_t lastVoltageCheckTimestamp = 0;
if ((millis() - lastVoltageCheckTimestamp >= voltageCheckInterval * 60000) || (!lastVoltageCheckTimestamp && millis() >= 10000)) { if ((millis() - lastVoltageCheckTimestamp >= voltageCheckInterval * 60000) || (!lastVoltageCheckTimestamp && millis() >= 10000)) {

9
src/Cmd.cpp

@ -11,6 +11,13 @@
#include "System.h" #include "System.h"
#include "Wlan.h" #include "Wlan.h"
// Only enable measurements if valid GPIO is used
#ifdef MEASURE_BATTERY_VOLTAGE
#if (VOLTAGE_READ_PIN >= 0 && VOLTAGE_READ_PIN <= 39)
#define ENABLE_BATTERY_MEASUREMENTS
#endif
#endif
void Cmd_Action(const uint16_t mod) { void Cmd_Action(const uint16_t mod) {
switch (mod) { switch (mod) {
case CMD_LOCK_BUTTONS_MOD: { // Locks/unlocks all buttons case CMD_LOCK_BUTTONS_MOD: { // Locks/unlocks all buttons
@ -320,7 +327,7 @@ void Cmd_Action(const uint16_t mod) {
} }
case CMD_MEASUREBATTERY: { case CMD_MEASUREBATTERY: {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
float voltage = Battery_GetVoltage(); float voltage = Battery_GetVoltage();
snprintf(Log_Buffer, Log_BufferLength, "%s: %.2f V", (char *) FPSTR(currentVoltageMsg), voltage); snprintf(Log_Buffer, Log_BufferLength, "%s: %.2f V", (char *) FPSTR(currentVoltageMsg), voltage);
Log_Println(Log_Buffer, LOGLEVEL_INFO); Log_Println(Log_Buffer, LOGLEVEL_INFO);

19
src/Led.cpp

@ -33,6 +33,13 @@
static void Led_Task(void *parameter); static void Led_Task(void *parameter);
static uint8_t Led_Address(uint8_t number); static uint8_t Led_Address(uint8_t number);
// Only enable measurements if valid GPIO is used
#ifdef MEASURE_BATTERY_VOLTAGE
#if (VOLTAGE_READ_PIN >= 0 && VOLTAGE_READ_PIN <= 39)
#define ENABLE_BATTERY_MEASUREMENTS
#endif
#endif
#endif #endif
void Led_Init(void) { void Led_Init(void) {
@ -301,7 +308,7 @@ static void Led_Task(void *parameter) {
} }
} }
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
// Single + Multiple LEDs: flashes red three times if battery-voltage is low // Single + Multiple LEDs: flashes red three times if battery-voltage is low
if (LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning)) { if (LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning)) {
LED_INDICATOR_CLEAR(LedIndicatorType::VoltageWarning); LED_INDICATOR_CLEAR(LedIndicatorType::VoltageWarning);
@ -432,7 +439,7 @@ static void Led_Task(void *parameter) {
for (uint8_t i = 0; i < numLedsToLight; i++) { for (uint8_t i = 0; i < numLedsToLight; i++) {
leds[Led_Address(i)] = CRGB::Blue; leds[Led_Address(i)] = CRGB::Blue;
FastLED.show(); FastLED.show();
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
#else #else
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
@ -444,7 +451,7 @@ static void Led_Task(void *parameter) {
} }
for (uint8_t i = 0; i <= 100; i++) { for (uint8_t i = 0; i <= 100; i++) {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
#else #else
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
@ -458,7 +465,7 @@ static void Led_Task(void *parameter) {
for (uint8_t i = numLedsToLight; i > 0; i--) { for (uint8_t i = numLedsToLight; i > 0; i--) {
leds[Led_Address(i) - 1] = CRGB::Black; leds[Led_Address(i) - 1] = CRGB::Black;
FastLED.show(); FastLED.show();
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
#else #else
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
@ -506,7 +513,7 @@ static void Led_Task(void *parameter) {
} }
FastLED.show(); FastLED.show();
for (uint8_t i = 0; i <= 50; i++) { for (uint8_t i = 0; i <= 50; i++) {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || gPlayProperties.playMode != NO_PLAYLIST || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || gPlayProperties.playMode != NO_PLAYLIST || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
#else #else
if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || gPlayProperties.playMode != NO_PLAYLIST || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (hlastVolume != AudioPlayer_GetCurrentVolume() || lastLedBrightness != Led_Brightness || LED_INDICATOR_IS_SET(LedIndicatorType::Error) || LED_INDICATOR_IS_SET(LedIndicatorType::Ok) || gPlayProperties.playMode != NO_PLAYLIST || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
@ -557,7 +564,7 @@ static void Led_Task(void *parameter) {
default: // If playlist is active (doesn't matter which type) default: // If playlist is active (doesn't matter which type)
if (!gPlayProperties.playlistFinished) { if (!gPlayProperties.playlistFinished) {
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
if (gPlayProperties.pausePlay != lastPlayState || System_AreControlsLocked() != lastLockState || notificationShown || ledBusyShown || volumeChangeShown || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (gPlayProperties.pausePlay != lastPlayState || System_AreControlsLocked() != lastLockState || notificationShown || ledBusyShown || volumeChangeShown || LED_INDICATOR_IS_SET(LedIndicatorType::VoltageWarning) || LED_INDICATOR_IS_SET(LedIndicatorType::Voltage) || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {
#else #else
if (gPlayProperties.pausePlay != lastPlayState || System_AreControlsLocked() != lastLockState || notificationShown || ledBusyShown || volumeChangeShown || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) { if (gPlayProperties.pausePlay != lastPlayState || System_AreControlsLocked() != lastLockState || notificationShown || ledBusyShown || volumeChangeShown || !gButtons[gShutdownButton].currentState || System_IsSleepRequested()) {

9
src/Web.cpp

@ -23,6 +23,13 @@
#include "Wlan.h" #include "Wlan.h"
#include "revision.h" #include "revision.h"
// Only enable measurements if valid GPIO is used
#ifdef MEASURE_BATTERY_VOLTAGE
#if (VOLTAGE_READ_PIN >= 0 && VOLTAGE_READ_PIN <= 39)
#define ENABLE_BATTERY_MEASUREMENTS
#endif
#endif
#if (LANGUAGE == DE) #if (LANGUAGE == DE)
#include "HTMLaccesspoint_DE.h" #include "HTMLaccesspoint_DE.h"
#include "HTMLmanagement_DE.h" #include "HTMLmanagement_DE.h"
@ -179,7 +186,7 @@ void webserverStart(void) {
info += "\nESP-IDF minor: "; info += "\nESP-IDF minor: ";
info += ESP_IDF_VERSION_MINOR; info += ESP_IDF_VERSION_MINOR;
#endif #endif
#ifdef MEASURE_BATTERY_VOLTAGE
#ifdef ENABLE_BATTERY_MEASUREMENTS
snprintf(Log_Buffer, Log_BufferLength, "\n%s: %.2f V", (char *) FPSTR(currentVoltageMsg), Battery_GetVoltage()); snprintf(Log_Buffer, Log_BufferLength, "\n%s: %.2f V", (char *) FPSTR(currentVoltageMsg), Battery_GetVoltage());
info += (String) Log_Buffer; info += (String) Log_Buffer;
#endif #endif

2
src/revision.h

@ -1,4 +1,4 @@
#ifndef __REVISION_H__ #ifndef __REVISION_H__
#define __REVISION_H__ #define __REVISION_H__
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211108-1";
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211110-1";
#endif #endif

10
src/settings-azdelivery_sdmmc.h

@ -21,9 +21,9 @@
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) is not supported by this board! // uSD-card-reader (via SPI) is not supported by this board!
#endif #endif
@ -92,7 +92,9 @@
// (optional) Monitoring of battery-voltage via ADC // (optional) Monitoring of battery-voltage via ADC
#ifdef MEASURE_BATTERY_VOLTAGE #ifdef MEASURE_BATTERY_VOLTAGE
// not supported by DevkitC
#define VOLTAGE_READ_PIN 99 // GPIO used to monitor battery-voltage.
constexpr float referenceVoltage = 3.3; // Voltage between 3.3V and GND-pin in battery-mode (disconnect USB!)
constexpr float offsetVoltage = 0.0; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here
#endif #endif
// (Optional) remote control via infrared // (Optional) remote control via infrared

46
src/settings-complete.h

@ -1,45 +1,37 @@
#include "Arduino.h" #include "Arduino.h"
//######################### INFOS #################################### //######################### INFOS ####################################
/* This is a develboard-specific config-file for ESPuino complete with port-expander PCA9555.
/* This is a config-file for ESPuino complete with port-expander PCA9555.
PCB: tba PCB: tba
Infos: tba Infos: tba
Caveats: None Caveats: None
Status: untested / unfinished
Status: Test in progress...
*/ */
//################## GPIO-configuration ############################## //################## 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 #ifdef SD_MMC_1BIT_MODE
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) // 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
// Not supported
#endif #endif
// RFID (via SPI) // RFID (via SPI)
#define RST_PIN 22 // Not necessary but has to be set anyway; so let's use a dummy-number
#define RST_PIN 99 // Not necessary for RC522 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 21 // GPIO for chip select (RFID)
#define RFID_MOSI 23 // GPIO for master out slave in (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_MISO 19 // GPIO for master in slave out (RFID)
#define RFID_SCK 18 // GPIO for clock-signal (RFID) #define RFID_SCK 18 // GPIO for clock-signal (RFID)
#ifdef RFID_READER_TYPE_PN5180 #ifdef RFID_READER_TYPE_PN5180
#define RFID_BUSY 16 // PN5180 BUSY PIN
#define RFID_BUSY 32 // PN5180 BUSY PIN
#define RFID_RST 22 // PN5180 RESET PIN #define RFID_RST 22 // PN5180 RESET PIN
#define RFID_IRQ 39 // PN5180 IRQ PIN (only needed for low power card detection)
#define RFID_IRQ 99 // PN5180 IRQ PIN (only needed for low power card detection)
#endif #endif
// I2S (DAC) // I2S (DAC)
#define I2S_DOUT 25 // Digital out (I2S) #define I2S_DOUT 25 // Digital out (I2S)
@ -49,8 +41,8 @@
// Rotary encoder // Rotary encoder
#ifdef USEROTARY_ENABLE #ifdef USEROTARY_ENABLE
#define ROTARYENCODER_CLK 35 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware) #define ROTARYENCODER_CLK 35 // If you want to reverse encoder's direction, just switch GPIOs of CLK with DT (in software or hardware)
#define ROTARYENCODER_DT 34 // Info: Lolin D32 / Lolin D32 pro 35 are using 35 for battery-voltage-monitoring!
#define ROTARYENCODER_BUTTON 105 // (set to 99 to disable; 0->39 for GPIO; 100->115 for port-expander)
#define ROTARYENCODER_DT 34
#define ROTARYENCODER_BUTTON 105
#endif #endif
// Amp enable (optional) // Amp enable (optional)
@ -61,8 +53,8 @@
#define NEXT_BUTTON 102 // Button 0: GPIO to detect next #define NEXT_BUTTON 102 // Button 0: GPIO to detect next
#define PREVIOUS_BUTTON 103 // Button 1: GPIO to detect previous #define PREVIOUS_BUTTON 103 // Button 1: GPIO to detect previous
#define PAUSEPLAY_BUTTON 100 // Button 2: GPIO to detect pause/play #define PAUSEPLAY_BUTTON 100 // Button 2: GPIO to detect pause/play
#define BUTTON_4 101 // Button 4: unnamed optional button
#define BUTTON_5 104 // Button 5: unnamed optional button
#define BUTTON_4 104 // Button 4: unnamed optional button
#define BUTTON_5 101 // Button 5: unnamed optional button
// Channels of port-expander can be read cyclic or interrupt-driven. It's strongly recommended to use the interrupt-way! // Channels of port-expander can be read cyclic or interrupt-driven. It's strongly recommended to use the interrupt-way!
// Infos: https://forum.espuino.de/t/einsatz-des-port-expanders-pca9555/306 // Infos: https://forum.espuino.de/t/einsatz-des-port-expanders-pca9555/306
@ -95,20 +87,20 @@
// (optional) Monitoring of battery-voltage via ADC // (optional) Monitoring of battery-voltage via ADC
#ifdef MEASURE_BATTERY_VOLTAGE #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!
constexpr float referenceVoltage = 3.35; // Voltage between 3.3V and GND-pin at the develboard in battery-mode (disconnect USB!)
constexpr float offsetVoltage = 0.1; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here
#define VOLTAGE_READ_PIN 39 // GPIO used to monitor battery-voltage.
constexpr float referenceVoltage = 3.3; // Voltage between 3.3V and GND-pin in battery-mode (disconnect USB!)
constexpr float offsetVoltage = 0.0; // If voltage measured by ESP isn't 100% accurate, you can add an correction-value here
#endif #endif
// (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here. // (optional) For measuring battery-voltage a voltage-divider is necessary. Their values need to be configured here.
#ifdef MEASURE_BATTERY_VOLTAGE #ifdef MEASURE_BATTERY_VOLTAGE
constexpr uint16_t rdiv1 = 100; // Rdiv1 of voltage-divider (kOhms) (measure exact value with multimeter!)
constexpr uint16_t rdiv2 = 33; // Rdiv2 of voltage-divider (kOhms) (measure exact value with multimeter!) => used to measure voltage via ADC!
constexpr uint16_t rdiv1 = 100; // Rdiv1 of voltage-divider (kOhms)
constexpr uint16_t rdiv2 = 100; // Rdiv2 of voltage-divider (kOhms) => used to measure voltage via ADC!
#endif #endif
// (Optional) remote control via infrared // (Optional) remote control via infrared
#ifdef IR_CONTROL_ENABLE #ifdef IR_CONTROL_ENABLE
#define IRLED_PIN 22 // GPIO where IR-receiver is connected (only tested with VS1838B)
#define IRLED_PIN 0 // 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) #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" // 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"

6
src/settings-custom.h

@ -15,9 +15,9 @@
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) // uSD-card-reader (via SPI)
#define SPISD_CS 15 // GPIO for chip select (SD) #define SPISD_CS 15 // GPIO for chip select (SD)

6
src/settings-lolin32.h

@ -22,9 +22,9 @@
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) // uSD-card-reader (via SPI)
#define SPISD_CS 15 // GPIO for chip select (SD) #define SPISD_CS 15 // GPIO for chip select (SD)

6
src/settings-lolin_d32.h

@ -22,9 +22,9 @@
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) // uSD-card-reader (via SPI)
#define SPISD_CS 15 // GPIO for chip select (SD) #define SPISD_CS 15 // GPIO for chip select (SD)

4
src/settings-lolin_d32_pro_sdmmc_pe.h

@ -21,7 +21,9 @@
// GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM). // GPIOs 16+17 are not available for D32 pro as they're used to internal purposes (PSRAM).
// All GPIOs >=100 and <= 115 are connected to a port-expander // All GPIOs >=100 and <= 115 are connected to a port-expander
#ifdef SD_MMC_1BIT_MODE #ifdef SD_MMC_1BIT_MODE
// 15 / 14 / 2 (fixed for SD_MMC)
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// SPI-SD IS NOT SUPPORTED BY THIS PCB - DON'T USE INTERNAL SD-READER! // SPI-SD IS NOT SUPPORTED BY THIS PCB - DON'T USE INTERNAL SD-READER!
#endif #endif

6
src/settings-ttgo_t8.h

@ -17,9 +17,9 @@
// uSD-card-reader (via SD-MMC 1Bit) // uSD-card-reader (via SD-MMC 1Bit)
// //
// SD_MMC uses fixed pins // SD_MMC uses fixed pins
// MOSI 15
// SCK 14
// MISO 2
// (MOSI) 15 CMD
// (SCK) 14 SCK
// (MISO) 2 D0
#else #else
// uSD-card-reader (via SPI) => don't use... won't work! // uSD-card-reader (via SPI) => don't use... won't work!
#define SPISD_CS 15 // GPIO for chip select (SD) #define SPISD_CS 15 // GPIO for chip select (SD)

4
src/values.h

@ -56,8 +56,8 @@
#define CMD_VOLUMEDOWN 177 // Command: lower volume by 1 #define CMD_VOLUMEDOWN 177 // Command: lower volume by 1
#define CMD_MEASUREBATTERY 178 // Command: Measure battery-voltage #define CMD_MEASUREBATTERY 178 // Command: Measure battery-voltage
#define CMD_SLEEPMODE 179 // Command: Go to deepsleep #define CMD_SLEEPMODE 179 // Command: Go to deepsleep
#define CMD_SEEK_FORWARDS 180 // Command: fast forward => don't use, has no effect currently!
#define CMD_SEEK_BACKWARDS 181 // Command: wind back => don't use, has no effect currently!
#define CMD_SEEK_FORWARDS 180 // Command: fast forward
#define CMD_SEEK_BACKWARDS 181 // Command: wind back
// Repeat-Modes // Repeat-Modes
#define NO_REPEAT 0 // No repeat #define NO_REPEAT 0 // No repeat

Loading…
Cancel
Save