diff --git a/html/management.html b/html/management.html index ceda7c7..088350a 100644 --- a/html/management.html +++ b/html/management.html @@ -117,7 +117,6 @@ RFID - Dateien WLAN %SHOW_MQTT_TAB% %SHOW_FTP_TAB% @@ -127,21 +126,6 @@ - - - - - - - - - - - - - - - @@ -166,6 +150,22 @@ + + + Dateien + + + + + + + + + + + + + RFID-Zuweisungen @@ -175,21 +175,7 @@ Datei, Verzeichnis oder URL (^ und # als Zeichen nicht erlaubt) - - - - - - Dateiliste aktualisieren - - - - - Der Prozess kann mehrere Minuten dauern... - - - - + Abspielmodus Einzelner Titel @@ -837,93 +823,6 @@ } /* buildFileSystemTree */ /* File Explorer functions end */ - function renderFileTree() { - - var filesURI = "/files"; - if (DEBUG) { - filesURI = "http://" + host + "/files"; - } - $('#filetree').jstree({ - 'core': { - 'check_callback': true, - 'data': { - url: filesURI, - error: function (XMLHttpRequest, textStatus, errorThrown) { - $('#j1_loading').hide(); - $("#refreshAction").hide(); - $('#filetree').html(" Dateien suchen."); - $('#filetree').on("click", function () { - refreshFileList(); - }); - toastr.error("Die Verzeichnis-Liste konnte nicht geladen werden."); - } - }, - - }, - 'types': { - 'folder': { - 'icon': "fa fa-folder" - }, - 'file': { - 'icon': "fa fa-file" - }, - 'audio': { - 'icon': "fa fa-file-audio" - }, - 'default': { - 'icon': "fa fa-folder" - } - }, - 'plugins': ["themes", "types"] - }).bind('loaded.jstree', function (event, data) { - postRendering(event, data); - if ((data.instance._model.data['#']['children'].length == 0)) { - toastr.info("Der SD-Karten-Index muss erzeugt werden."); - } - }).bind('refresh.jstree', function (event, data) { - postRendering(event, data); - }); - } - - $('#filetree').on('select_node.jstree', function (e, data) { - $('input[name=fileOrUrl]').val(data.node.id); - - if (data.node.type == "folder") { - $('.option-folder').show(); - $('.option-file').hide(); - $('#playMode option').removeAttr('selected').filter('[value=3]').attr('selected', true); - } - - if (data.node.type == "audio") { - $('.option-file').show(); - $('.option-folder').hide(); - $('#playMode option').removeAttr('selected').filter('[value=1]').attr('selected', true); - } - }); - - $('#refreshAction').on("click", function () { - refreshFileList(); - $("#indexing-progress").show(); - $("#refreshAction").hide(); - }); - - $('#playMode').on("change", function () { - if (this.value == 8) { - $('#filebrowser').slideUp(); - } else { - $('#filebrowser').slideDown(); - } - }); - - function showFileIndexingState() { - $("#indexing-progress").show(); - $("#refreshAction").hide(); - } - - function hideFileIndexingState() { - $("#indexing-progress").hide(); - $("#refreshAction").show(); - } var socket = undefined; var tm; @@ -966,17 +865,6 @@ if (socketMsg.pong == 'pong') { pong(); } - } if ("refreshFileList" in socketMsg) { - hideFileIndexingState(); - toastr.info("Die Dateiliste wurde neu erzeugt!"); - $('#filetree').jstree(true).refresh(); - - } - if ("indexingState" in socketMsg) { - if(socketMsg.indexingState != null) { - $("#currentProcessedFile").text(socketMsg.indexingState); - console.log(socketMsg.indexingState); - } } }; } @@ -998,17 +886,6 @@ clearTimeout(tm); } - function refreshFileList(clickedId) { - lastIdclicked = clickedId; - var myObj = { - "refreshFileList": true - }; - var myJSON = JSON.stringify(myObj); - $("#refreshAction").hide(); - socket.send(myJSON); - showFileIndexingState(); - }; - function genSettings(clickedId) { lastIdclicked = clickedId; var myObj = { @@ -1108,7 +985,6 @@ $(document).ready(function () { connect(); - renderFileTree(); buildFileSystemTree("/"); console.log(parseInt(document.getElementById('warningLowVoltage').value)); diff --git a/src/HTMLmanagement.h b/src/HTMLmanagement.h index ee7f2c8..1d61bd5 100644 --- a/src/HTMLmanagement.h +++ b/src/HTMLmanagement.h @@ -117,7 +117,6 @@ static const char management_HTML[] PROGMEM = "\ \ \ RFID\ - Dateien\ WLAN\ %SHOW_MQTT_TAB%\ %SHOW_FTP_TAB%\ @@ -127,21 +126,6 @@ static const char management_HTML[] PROGMEM = "\ \ \ \ - \ - \ - \ - \ -\ - \ - \ - \ - \ - \ - \ -\ - \ - \ - \ \ \ \ @@ -166,6 +150,22 @@ static const char management_HTML[] PROGMEM = "\ \ \ \ + \ + \ + Dateien\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ \ \ RFID-Zuweisungen\ @@ -175,21 +175,7 @@ static const char management_HTML[] PROGMEM = "\ \ Datei, Verzeichnis oder URL (^ und # als Zeichen nicht erlaubt)\ - \ - \ - \ - \ - \ - Dateiliste aktualisieren\ - \ - \ - \ - \ - Der Prozess kann mehrere Minuten dauern...\ - \ - \ - \ - \ + \ Abspielmodus\ \ Einzelner Titel\ @@ -837,93 +823,6 @@ static const char management_HTML[] PROGMEM = "\ } /* buildFileSystemTree */\ \ /* File Explorer functions end */\ - function renderFileTree() {\ -\ - var filesURI = \"/files\";\ - if (DEBUG) {\ - filesURI = \"http://\" + host + \"/files\";\ - }\ - $('#filetree').jstree({\ - 'core': {\ - 'check_callback': true,\ - 'data': {\ - url: filesURI,\ - error: function (XMLHttpRequest, textStatus, errorThrown) {\ - $('#j1_loading').hide();\ - $(\"#refreshAction\").hide();\ - $('#filetree').html(\" Dateien suchen.\");\ - $('#filetree').on(\"click\", function () {\ - refreshFileList();\ - });\ - toastr.error(\"Die Verzeichnis-Liste konnte nicht geladen werden.\");\ - }\ - },\ -\ - },\ - 'types': {\ - 'folder': {\ - 'icon': \"fa fa-folder\"\ - },\ - 'file': {\ - 'icon': \"fa fa-file\"\ - },\ - 'audio': {\ - 'icon': \"fa fa-file-audio\"\ - },\ - 'default': {\ - 'icon': \"fa fa-folder\"\ - }\ - },\ - 'plugins': [\"themes\", \"types\"]\ - }).bind('loaded.jstree', function (event, data) {\ - postRendering(event, data);\ - if ((data.instance._model.data['#']['children'].length == 0)) {\ - toastr.info(\"Der SD-Karten-Index muss erzeugt werden.\");\ - }\ - }).bind('refresh.jstree', function (event, data) {\ - postRendering(event, data);\ - });\ - }\ -\ - $('#filetree').on('select_node.jstree', function (e, data) {\ - $('input[name=fileOrUrl]').val(data.node.id);\ -\ - if (data.node.type == \"folder\") {\ - $('.option-folder').show();\ - $('.option-file').hide();\ - $('#playMode option').removeAttr('selected').filter('[value=3]').attr('selected', true);\ - }\ -\ - if (data.node.type == \"audio\") {\ - $('.option-file').show();\ - $('.option-folder').hide();\ - $('#playMode option').removeAttr('selected').filter('[value=1]').attr('selected', true);\ - }\ - });\ -\ - $('#refreshAction').on(\"click\", function () {\ - refreshFileList();\ - $(\"#indexing-progress\").show();\ - $(\"#refreshAction\").hide();\ - });\ -\ - $('#playMode').on(\"change\", function () {\ - if (this.value == 8) {\ - $('#filebrowser').slideUp();\ - } else {\ - $('#filebrowser').slideDown();\ - }\ - });\ -\ - function showFileIndexingState() {\ - $(\"#indexing-progress\").show();\ - $(\"#refreshAction\").hide();\ - }\ -\ - function hideFileIndexingState() {\ - $(\"#indexing-progress\").hide();\ - $(\"#refreshAction\").show();\ - }\ \ var socket = undefined;\ var tm;\ @@ -966,17 +865,6 @@ static const char management_HTML[] PROGMEM = "\ if (socketMsg.pong == 'pong') {\ pong();\ }\ - } if (\"refreshFileList\" in socketMsg) {\ - hideFileIndexingState();\ - toastr.info(\"Die Dateiliste wurde neu erzeugt!\");\ - $('#filetree').jstree(true).refresh();\ -\ - }\ - if (\"indexingState\" in socketMsg) {\ - if(socketMsg.indexingState != null) {\ - $(\"#currentProcessedFile\").text(socketMsg.indexingState);\ - console.log(socketMsg.indexingState);\ - }\ }\ };\ }\ @@ -997,17 +885,6 @@ static const char management_HTML[] PROGMEM = "\ function pong() {\ clearTimeout(tm);\ }\ -\ - function refreshFileList(clickedId) {\ - lastIdclicked = clickedId;\ - var myObj = {\ - \"refreshFileList\": true\ - };\ - var myJSON = JSON.stringify(myObj);\ - $(\"#refreshAction\").hide();\ - socket.send(myJSON);\ - showFileIndexingState();\ - };\ \ function genSettings(clickedId) {\ lastIdclicked = clickedId;\ @@ -1108,7 +985,6 @@ static const char management_HTML[] PROGMEM = "\ \ $(document).ready(function () {\ connect();\ - renderFileTree();\ buildFileSystemTree(\"/\");\ \ console.log(parseInt(document.getElementById('warningLowVoltage').value));\ diff --git a/src/main.cpp b/src/main.cpp index fdc9c77..0d6dbe3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -467,7 +467,7 @@ void IRAM_ATTR onTimer() { } } #endif - + /** // Creates a new file on the SD-card. void createFile(fs::FS &fs, const char * path, const char * message) { snprintf(logBuf, serialLoglength, "%s: %s", (char *) FPSTR(writingFile), path); @@ -634,6 +634,7 @@ void fileHandlingTask(void *arguments) { esp_task_wdt_reset(); vTaskDelete( NULL ); } +**/ #ifdef MEASURE_BATTERY_VOLTAGE @@ -3507,19 +3508,20 @@ bool processJsonRequest(char *_serialJson) { } else if (doc.containsKey("ping")) { sendWebsocketData(0, 20); return false; - } else if (doc.containsKey("refreshFileList")) { + } + // } else if (doc.containsKey("refreshFileList")) { - //TODO: we need a semaphore or mutex here to prevent - // a call when the task is still running - xTaskCreate( - fileHandlingTask, /* Task function. */ - "TaskTwo", /* String with name of task. */ - 10000, /* Stack size in bytes. */ - NULL, /* Parameter passed as input of the task */ - 1, /* Priority of the task. */ - NULL); /* Task handle. */ + // //TODO: we need a semaphore or mutex here to prevent + // // a call when the task is still running + // xTaskCreate( + // fileHandlingTask, /* Task function. */ + // "TaskTwo", /* String with name of task. */ + // 10000, /* Stack size in bytes. */ + // NULL, /* Parameter passed as input of the task */ + // 1, /* Priority of the task. */ + // NULL); /* Task handle. */ - } + // } return true; } @@ -3539,11 +3541,12 @@ void sendWebsocketData(uint32_t client, uint8_t code) { object["rfidId"] = currentRfidTagId; } else if (code == 20) { object["pong"] = "pong"; - } else if (code == 30) { - object["refreshFileList"] = "ready"; - } else if (code == 31) { - object["indexingState"] = fileNameBuf; } + // } else if (code == 30) { + // object["refreshFileList"] = "ready"; + // } else if (code == 31) { + // object["indexingState"] = fileNameBuf; + // } //char jBuf[255]; @@ -3682,9 +3685,9 @@ void webserverStart(void) { }); // Filebrowser (json-precached) - wServer.on("/files", HTTP_GET, [](AsyncWebServerRequest *request) { - request->send(FSystem, DIRECTORY_INDEX_FILE, "application/json"); - }); + // wServer.on("/files", HTTP_GET, [](AsyncWebServerRequest *request) { + // request->send(FSystem, DIRECTORY_INDEX_FILE, "application/json"); + // }); // Fileexplorer (realtime) wServer.on("/explorer", HTTP_GET, explorerHandleListRequest); @@ -4624,10 +4627,10 @@ void setup() { lastTimeActiveTimestamp = millis(); // initial set after boot // Create empty index json-file when no file exists. - if (!fileExists(FSystem,DIRECTORY_INDEX_FILE)) { - createFile(FSystem,DIRECTORY_INDEX_FILE,"[]"); - esp_deep_sleep_start(); - } + // if (!fileExists(FSystem,DIRECTORY_INDEX_FILE)) { + // createFile(FSystem,DIRECTORY_INDEX_FILE,"[]"); + // esp_deep_sleep_start(); + // } bootComplete = true; snprintf(logBuf, serialLoglength, "%s: %u", (char *) FPSTR(freeHeapAfterSetup), ESP.getFreeHeap()); diff --git a/src/settings.h b/src/settings.h index 7306d32..d467e4f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -85,8 +85,8 @@ static const char accessPointNetworkSSID[] PROGMEM = "Tonuino"; // Access-po static const char backupFile[] PROGMEM = "/backup.txt"; // File is written every time a (new) RFID-assignment via GUI is done // (webgui) File Browser -uint8_t FS_DEPTH = 5; // Max. recursion-depth of file tree -const char *DIRECTORY_INDEX_FILE = "/files.json"; // Filename of files.json index file +//uint8_t FS_DEPTH = 5; // Max. recursion-depth of file tree +//const char *DIRECTORY_INDEX_FILE = "/files.json"; // Filename of files.json index file //#################### Settings for optional Modules##############################