Kleine Verbesserungen.

This commit is contained in:
Fabian Schlenz 2022-08-18 16:38:07 +02:00
parent fa208858d9
commit dcca828197
4 changed files with 18 additions and 11 deletions

View File

@ -13,7 +13,7 @@ default_envs = esp32
[extra]
lib_deps =
63 ; MFRC522
63 @ 1.4.5 ; MFRC522
https://github.com/me-no-dev/ESPAsyncWebServer.git
ArduinoJSON
6691 ; TinyXML
@ -22,10 +22,10 @@ lib_deps =
platform = espressif32
board = esp-wrover-kit
framework = arduino
upload_speed = 512000
upload_speed = 115200
build_flags=!./build_version.sh
lib_deps = ${extra.lib_deps}
upload_port = /dev/cu.SLAB_USBtoUART
;upload_port = 10.10.2.108 ; /dev/cu.SLAB_USBtoUART
monitor_speed = 115200
board_build.embed_txtfiles = src/index.html
;board_build.partitions = partitions.csv

View File

@ -1,4 +1,5 @@
#include <Arduino.h>
#include <ArduinoOTA.h>
#include <SPI.h>
#include <SD.h>
#include <WiFi.h>
@ -55,7 +56,8 @@ void wifi_connect() {
#endif
if (wifi.run() == WL_CONNECTED) {
DEBUG("Connected to WiFi \"%s\".\n", WiFi.SSID().c_str());
INFO("Connected to WiFi \"%s\".\n", WiFi.SSID().c_str());
INFO("Local IP address: %s\n", WiFi.localIP().toString().c_str());
} else {
DEBUG("No WiFi connection!\n");
}
@ -77,13 +79,13 @@ void setup() {
prefs.begin("esmp3");
debug_enabled = prefs.getBool("debug_enabled", true);
trace_enabled = prefs.getBool("trace_enabled", false);
delay(1000);
PIN_SPEAKER_L_SETUP();delay(1000);
PIN_SPEAKER_R_SETUP();delay(1000);
PIN_SPEAKER_L(LOW);delay(1000);
PIN_SPEAKER_R(LOW);delay(1000);
PIN_SPEAKER_L_SETUP();
PIN_SPEAKER_R_SETUP();
PIN_SPEAKER_L(LOW);
PIN_SPEAKER_R(LOW);
DEBUG("Setting up SPI...\n");
DEBUG("Setting up SPI...\n");delay(1000);
SPI.begin();
SPI.setHwCs(false);
SPIMaster::init();
@ -92,7 +94,7 @@ void setup() {
DEBUG("Setting up SD card...\n");
spi->select_sd();
if (SD.begin(42, SPI, 25000000)) {
if (SD.begin(14, SPI, 25000000)) {
INFO("SD card initialized.\n");
} else {
ERROR("Could not initialize SD card.\n");
@ -108,6 +110,8 @@ void setup() {
INFO("Player and controller initialized.\n");
wifi_connect();
ArduinoOTA.begin();
MDNS.begin("esmp3");
@ -141,4 +145,5 @@ void loop() {
if (more_data_needed) return;
controller->loop();
ArduinoOTA.handle();
}

View File

@ -5,6 +5,7 @@
#include <algorithm>
#include <ArduinoJson.h>
#include <TinyXML.h>
#include "main.h"
Playlist::Playlist(String path) {
_path = path;

View File

@ -13,6 +13,7 @@ void PlaylistManager::scan_files() {
File root = SD.open("/");
File entry;
while (entry = root.openNextFile()) {
Serial.println(entry.name());
String foldername = entry.name();
if (foldername.startsWith("/.")) continue;
foldername.remove(foldername.length());