Browse Source

Slight changes

master
Torsten Stauder 5 years ago
parent
commit
4fd662bd80
  1. 14
      platformio.ini
  2. 29
      src/main.cpp

14
platformio.ini

@ -8,16 +8,18 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:az-delivery-devkit-v4]
;[env:nodemcu-32s]
[env:lolin32]
platform = espressif32
board = az-delivery-devkit-v4
;board = nodemcu-32s
board = lolin32
framework = arduino
monitor_speed = 115200
board_build.partitions = no_ota.csv
;board_build.partitions = min_spiffs.csv
upload_port = /dev/cu.SLAB_USBtoUART
monitor_port = /dev/cu.SLAB_USBtoUART
build_flags = -O2
build_unflags = -Os
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S.git
@ -33,5 +35,5 @@ lib_deps =
; https://github.com/pschatzmann/ESP32-A2DP.git
; Don't forget to run this script if you changed the html-files provided in any way
;extra_scripts =
; pre:processHtml.py
extra_scripts =
pre:processHtml.py

29
src/main.cpp

@ -1,13 +1,13 @@
// Define modules to compile:
//#define MQTT_ENABLE // Make sure to configure mqtt-server and (optionally) username+pwd
#define MQTT_ENABLE // Make sure to configure mqtt-server and (optionally) username+pwd
#define FTP_ENABLE // Enables FTP-server
#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 HEADPHONE_ADJUST_ENABLE // Used to adjust (lower) volume for optional headphone-pcb (refer maxVolumeSpeaker / maxVolumeHeadphone)
#define HEADPHONE_ADJUST_ENABLE // Used to adjust (lower) volume for optional headphone-pcb (refer maxVolumeSpeaker / maxVolumeHeadphone)
//#define SINGLE_SPI_ENABLE // If only one SPI-instance should be used instead of two (not yet working!)
#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 MEASURE_BATTERY_VOLTAGE // Enables battery-measurement via GPIO (ADC) and voltage-divider
//#define PLAY_LAST_RFID_AFTER_REBOOT // When restarting Tonuino, the last RFID that was active before, is recalled and played
@ -135,8 +135,8 @@ float voltageIndicatorHigh = 4.2; // Upper range for Neopixel-
#ifdef MEASURE_BATTERY_VOLTAGE
#define VOLTAGE_READ_PIN 33 // Pin to monitor battery-voltage. Change to 35 if you're using Lolin D32 or Lolin D32 pro
uint16_t r1 = 391; // First resistor of voltage-divider (kOhms) (measure exact value with multimeter!)
uint8_t r2 = 128; // Second resistor of voltage-divider (kOhms) (measure exact value with multimeter!)
uint16_t r1 = 389; // First resistor of voltage-divider (kOhms) (measure exact value with multimeter!)
uint8_t r2 = 129; // Second resistor of voltage-divider (kOhms) (measure exact value with multimeter!)
// Internal values
float refVoltage = 3.3; // Operation-voltage of ESP32; don't change!
@ -553,12 +553,9 @@ void createFile(fs::FS &fs, const char * path, const char * message){
file.close();
}
bool fileExists(fs::FS &fs, const char *file) {
if (fs.exists(file)) {
return true;
} else {
return false;
}
return fs.exists(file);
}
/**
@ -567,6 +564,8 @@ bool fileExists(fs::FS &fs, const char *file){
* @param path
* @param text
*/
void appendToFile(fs::FS &fs, const char *path, const char *text) {
File file = fs.open(path, FILE_APPEND);
esp_task_wdt_reset();
@ -607,15 +606,15 @@ void appendNodeToJSONFile(fs::FS &fs, const char * path, const char *filename, c
//TODO: write a minified json, without all those whitespaces
// it is just easier to debug when json is in a nice format
// anyway ugly but works and is stable
file.print( " {\n \"id\" : \"");
file.print(F(( " {\n \"id\" : \"")));
file.print(filename);
file.print("\",\n \"parent\" : \"");
file.print(F("\",\n \"parent\" : \""));
file.print(parent);
file.print("\",\n \"type\": \"");
file.print(F("\",\n \"type\": \""));
file.print(type);
file.print("\",\n \"text\" : \"");
file.print(F("\",\n \"text\" : \""));
file.print(filename);
file.print("\"\n }");
file.print(F("\"\n }"));
// i/o is timing critical keep all stuff running
esp_task_wdt_reset();
yield();

Loading…
Cancel
Save