logging
This commit is contained in:
parent
1e304979c5
commit
c81ca008cf
@ -12,10 +12,10 @@ AsyncWebSocket ws("/ws");
|
||||
|
||||
void onWebSocketEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, const AwsEventType type, void *arg, const uint8_t *data, const size_t len) {
|
||||
if (type == WS_EVT_CONNECT) {
|
||||
Serial.printf("[%-8s] Connected: %s\n", "WEBSOCKET", client->remoteIP().toString().c_str());
|
||||
Serial.printf("[%-9s] Connected: %s\n", "WEBSOCKET", client->remoteIP().toString().c_str());
|
||||
client->text(stateBuffer);
|
||||
} else if (type == WS_EVT_DISCONNECT) {
|
||||
Serial.printf("[%-8s] Disconnected: %s\n", "WEBSOCKET", client->remoteIP().toString().c_str());
|
||||
Serial.printf("[%-9s] Disconnected: %s\n", "WEBSOCKET", client->remoteIP().toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ size_t playlistIndex = 0;
|
||||
std::vector<Entry> playlistEntries;
|
||||
|
||||
void playlistClear() {
|
||||
Serial.println("[PLAYLIST] clear");
|
||||
Serial.println("[PLAYLIST ] clear");
|
||||
playlistTitle = "";
|
||||
playlistIndex = 0;
|
||||
playlistEntries.clear();
|
||||
@ -29,17 +29,17 @@ void playlistClear() {
|
||||
|
||||
void playlistAdd(String entry) {
|
||||
entry.trim();
|
||||
Serial.println("[PLAYLIST] [ADD] " + entry);
|
||||
Serial.println("[PLAYLIST ] [ADD] " + entry);
|
||||
|
||||
const auto index_type_url = entry.indexOf('|');
|
||||
if (index_type_url < 0) {
|
||||
Serial.println("[PLAYLIST] type/url-delimiter not found: " + entry);
|
||||
Serial.println("[PLAYLIST ] type/url-delimiter not found: " + entry);
|
||||
return;
|
||||
}
|
||||
auto type = entry.substring(0, index_type_url);
|
||||
type.trim();
|
||||
if (type != "TITLE" && type != "ICY" && type != "SD" && type != "SNAP") {
|
||||
Serial.println("[PLAYLIST] Unknown type: " + type);
|
||||
Serial.println("[PLAYLIST ] Unknown type: " + type);
|
||||
}
|
||||
|
||||
entry = entry.substring(index_type_url + 1);
|
||||
@ -52,13 +52,13 @@ void playlistAdd(String entry) {
|
||||
|
||||
const auto index_url_title = entry.indexOf('|');
|
||||
if (index_url_title < 0) {
|
||||
Serial.println("[PLAYLIST] url/title-delimiter not found: " + entry);
|
||||
Serial.println("[PLAYLIST ] url/title-delimiter not found: " + entry);
|
||||
return;
|
||||
}
|
||||
auto url = entry.substring(0, index_url_title);
|
||||
url.trim();
|
||||
if (url.isEmpty()) {
|
||||
Serial.println("[PLAYLIST] url is empty.");
|
||||
Serial.println("[PLAYLIST ] url is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -70,18 +70,18 @@ void playlistAdd(String entry) {
|
||||
|
||||
void playlistLoad(const String &path) {
|
||||
playlistClear();
|
||||
Serial.println("[PLAYLIST] Loading playlist: " + path);
|
||||
Serial.println("[PLAYLIST ] Loading playlist: " + path);
|
||||
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)) {
|
||||
Serial.println("[PLAYLIST] Failed to initialize SD card.");
|
||||
Serial.println("[PLAYLIST ] Failed to initialize SD card.");
|
||||
return;
|
||||
}
|
||||
if (!SD.exists(path)) {
|
||||
Serial.println("[PLAYLIST] File not found.");
|
||||
Serial.println("[PLAYLIST ] File not found.");
|
||||
return;
|
||||
}
|
||||
auto file = SD.open(path, FILE_READ);
|
||||
if (!file) {
|
||||
Serial.println("[PLAYLIST] Failed to open file.");
|
||||
Serial.println("[PLAYLIST ] Failed to open file.");
|
||||
}
|
||||
|
||||
while (file.available() > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user