Kleine Verbesserungen.
This commit is contained in:
21
src/main.cpp
21
src/main.cpp
@ -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();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <algorithm>
|
||||
#include <ArduinoJson.h>
|
||||
#include <TinyXML.h>
|
||||
#include "main.h"
|
||||
|
||||
Playlist::Playlist(String path) {
|
||||
_path = path;
|
||||
|
@ -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());
|
||||
|
Reference in New Issue
Block a user