diff --git a/README.md b/README.md index bc903d7..d2999cd 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Sourcecode will be released in the future.. ## Changelog * 2.4.2: - * [x] UiFlow2 v2.2.0 compatibility https://github.com/bmorcelli/M5Stick-Launcher/issues/92 + * [x] UiFlow2 v2.2.0 compatibility https://github.com/bmorcelli/M5Stick-Launcher/issues/92 for Cardputer, Removed from StickCPlus2 due to lack of storage * [x] Fix for https://github.com/bmorcelli/M5Stick-Launcher/issues/93 https://github.com/bmorcelli/M5Stick-Launcher/issues/97 https://github.com/bmorcelli/M5Stick-Launcher/issues/95 * [x] Possibility to connect to Hidden Networks https://github.com/bmorcelli/M5Stick-Launcher/issues/89 by typing the SSID and Pwd * [x] Changed porting system, reading inputs on a background task (same as Bruce) diff --git a/boards/m5stack-cplus2/platformio.ini b/boards/m5stack-cplus2/platformio.ini index 4c74cbd..86f3a00 100644 --- a/boards/m5stack-cplus2/platformio.ini +++ b/boards/m5stack-cplus2/platformio.ini @@ -16,7 +16,10 @@ build_src_filter =${env.build_src_filter} +<../boards/m5stack-cplus2> build_flags = ${env.build_flags} -Iboards/m5stack-cplus2 - ;-DCORE_DEBUG_LEVEL=5 + -Wl,--gc-sections + -Os + -DCORE_DEBUG_LEVEL=0 + -DCONFIG_ESP32_JTAG_SUPPORT_DISABLE=1 -DSTICK_C_PLUS2=1 @@ -65,6 +68,8 @@ build_flags = -DSDCARD_SCK=0 -DSDCARD_MISO=36 -DSDCARD_MOSI=26 +build_unflags = + -DBOARD_HAS_PSRAM lib_deps = ${env.lib_deps} diff --git a/src/partitioner.cpp b/src/partitioner.cpp index 158c72b..6cc351e 100644 --- a/src/partitioner.cpp +++ b/src/partitioner.cpp @@ -179,7 +179,7 @@ void partitioner() { // Opções de partição options = { {"Default", [&](){ partition = 0; }}, - #if defined(PART_08MB) + #if defined(PART_08MB) && defined(CARDPUTER) {"Doom", [&](){ partition = 1; }}, {"UiFlow2", [&](){ partition = 2; }}, #elif defined(PART_04MB) diff --git a/src/webInterface.h b/src/webInterface.h index 58e0abd..4d0f7db 100644 --- a/src/webInterface.h +++ b/src/webInterface.h @@ -391,16 +391,12 @@ formdata4.append("fileName", fileName); ajax4.open("POST", "/UPDATE", false); ajax4.send(formdata4); } - - function callOTA() { -// Preparar e enviar a requisição inicial const ajax3 = new XMLHttpRequest(); const formdata = new FormData(); formdata.append("update", 1); ajax3.open("POST", "/OTA", false); ajax3.send(formdata); - document.getElementById("detailsheader").innerHTML = "
Updating...
" + "" + "" + ""; document.getElementById("updetails").innerHTML = uploadForm; - ajax2.send(formdata2); } }; - ajax.onerror = function() { console.error("Erro na requisição inicial GET."); }; - -// Preparar e enviar a requisição inicial const formdata = new FormData(); formdata.append("command", comm); formdata.append("size", c_size); ajax.open("POST", "/OTA", true); ajax.send(formdata); } - - function logoutButton() { var xhr = new XMLHttpRequest(); xhr.open("GET", "/logout", true); xhr.send(); setTimeout(function(){ window.open("/logged-out","_self"); }, 500); } - function rebootButton() { if(confirm("Confirm Restart?!")) { xmlhttp=new XMLHttpRequest(); @@ -676,9 +648,7 @@ document.getElementById("status").innerHTML = ""; window.open(urltocall,"_blank"); } } - function showCreateFolder(folders) { -//document.getElementById("updetailsheader").innerHTML = "Creating folder at: " + folders + ""+ @@ -697,7 +667,6 @@ downloadDeleteButton(folderName, 'create'); } function showUploadButtonFancy(folders) { -//document.getElementById("updetailsheader").innerHTML = "
Send file to " + folders + "
"+ @@ -714,139 +683,124 @@ function _(el) { return document.getElementById(el); } function uploadFile(folder) { - var folder = _("folder").value; - var files = _("file1").files; // Extract files from input element - - var formdata = new FormData(); - for (var i = 0; i < files.length; i++) { - formdata.append("files[]", files[i]); // Append each file to form data - } - formdata.append("folder", folder); - - var ajax = new XMLHttpRequest(); - ajax.upload.addEventListener("progress", progressHandler, false); - ajax.addEventListener("load", completeHandler, false); - ajax.addEventListener("error", errorHandler, false); - ajax.addEventListener("abort", abortHandler, false); - ajax.open("POST", "/"); - ajax.send(formdata); +var folder = _("folder").value; +var files = _("file1").files; +var formdata = new FormData(); +for (var i = 0; i < files.length; i++) { +formdata.append("files[]", files[i]); +} +formdata.append("folder", folder); +var ajax = new XMLHttpRequest(); +ajax.upload.addEventListener("progress", progressHandler, false); +ajax.addEventListener("load", completeHandler, false); +ajax.addEventListener("error", errorHandler, false); +ajax.addEventListener("abort", abortHandler, false); +ajax.open("POST", "/"); +ajax.send(formdata); } - -// Drag and drop event listeners window.addEventListener("load", function() { - var dropArea = _("drop-area"); - dropArea.addEventListener("dragenter", dragEnter, false); - dropArea.addEventListener("dragover", dragOver, false); - dropArea.addEventListener("dragleave", dragLeave, false); - dropArea.addEventListener("drop", drop, false); +var dropArea = _("drop-area"); +dropArea.addEventListener("dragenter", dragEnter, false); +dropArea.addEventListener("dragover", dragOver, false); +dropArea.addEventListener("dragleave", dragLeave, false); +dropArea.addEventListener("drop", drop, false); }); - function dragEnter(event) { - event.stopPropagation(); - event.preventDefault(); - this.classList.add("highlight"); +event.stopPropagation(); +event.preventDefault(); +this.classList.add("highlight"); } - function dragOver(event) { - event.stopPropagation(); - event.preventDefault(); - this.classList.add("highlight"); +event.stopPropagation(); +event.preventDefault(); +this.classList.add("highlight"); } - function dragLeave(event) { - event.stopPropagation(); - event.preventDefault(); - this.classList.remove("highlight"); +event.stopPropagation(); +event.preventDefault(); +this.classList.remove("highlight"); } var fileQueue = []; var currentFileIndex = 0; - - function drop(event, folder) { - event.stopPropagation(); - event.preventDefault(); - _("drop-area").classList.remove("highlight"); - - fileQueue = event.dataTransfer.files; - currentFileIndex = 0; - - var uploadform = - "Send file to " + folder + "
"+ - ""; - document.getElementById("updetails").innerHTML = uploadform; - - if (fileQueue.length > 0) { - uploadNextFile(folder); - } - } - - function uploadNextFile(folder) { - if (currentFileIndex >= fileQueue.length) { - console.log("Todos os arquivos foram enviados."); - listFilesButton(folder); - return; - } - - var file = fileQueue[currentFileIndex]; - var formdata = new FormData(); - formdata.append("file", file); - formdata.append("folder", folder); - - var ajax = new XMLHttpRequest(); - ajax.upload.addEventListener("progress", progressHandler, false); - ajax.addEventListener("load", completeHandler, false); - ajax.addEventListener("error", errorHandler, false); - ajax.addEventListener("abort", abortHandler, false); - ajax.open("POST", "/"); - ajax.send(formdata); - } - +function drop(event, folder) { +event.stopPropagation(); +event.preventDefault(); +_("drop-area").classList.remove("highlight"); +fileQueue = event.dataTransfer.files; +currentFileIndex = 0; +var uploadform = +"Send file to " + folder + "
"+ +""; +document.getElementById("updetails").innerHTML = uploadform; +if (fileQueue.length > 0) { +uploadNextFile(folder); +} +} +function uploadNextFile(folder) { +if (currentFileIndex >= fileQueue.length) { +console.log("Todos os arquivos foram enviados."); +listFilesButton(folder); +return; +} +var file = fileQueue[currentFileIndex]; +var formdata = new FormData(); +formdata.append("file", file); +formdata.append("folder", folder); +var ajax = new XMLHttpRequest(); +ajax.upload.addEventListener("progress", progressHandler, false); +ajax.addEventListener("load", completeHandler, false); +ajax.addEventListener("error", errorHandler, false); +ajax.addEventListener("abort", abortHandler, false); +ajax.open("POST", "/"); +ajax.send(formdata); +} function progressHandler(event) { - _("loaded_n_total").innerHTML = "Uploaded " + event.loaded + " bytes"; - var percent = (event.loaded / event.total) * 100; - _("progressBar").value = Math.round(percent); - if (percent >= 100) { - _("status").innerHTML = "Please wait, writing file to filesystem"; - } +_("loaded_n_total").innerHTML = "Uploaded " + event.loaded + " bytes"; +var percent = (event.loaded / event.total) * 100; +_("progressBar").value = Math.round(percent); +if (percent >= 100) { +_("status").innerHTML = "Please wait, writing file to filesystem"; +} } function completeHandler(event) { - _("progressBar").value = 0; - if (fileQueue.length > 0) { - currentFileIndex++; - if (currentFileIndex <= fileQueue.length) { - document.getElementById("status").innerHTML = "Uploaded " + currentFileIndex + " of " + fileQueue.length + " files."; - } - uploadNextFile(document.getElementById("actualFolder").value); - } - else { - _("status").innerHTML = "Upload Complete"; - var actualFolder = document.getElementById("actualFolder").value - document.getElementById("status").innerHTML = "File Uploaded"; - listFilesButton(actualFolder); - } +_("progressBar").value = 0; +if (fileQueue.length > 0) { +currentFileIndex++; +if (currentFileIndex <= fileQueue.length) { +document.getElementById("status").innerHTML = "Uploaded " + currentFileIndex + " of " + fileQueue.length + " files."; +} +uploadNextFile(document.getElementById("actualFolder").value); +} +else { +_("status").innerHTML = "Upload Complete"; +var actualFolder = document.getElementById("actualFolder").value +document.getElementById("status").innerHTML = "File Uploaded"; +listFilesButton(actualFolder); +} } function errorHandler(event) { - _("status").innerHTML = "Upload Failed"; - if (fileQueue.length > 0) { - currentFileIndex++; - document.getElementById("status").innerHTML = "Uploaded " + i + " of " + files.length + " files, please wait."; - uploadNextFile(document.getElementById("actualFolder").value); - } +_("status").innerHTML = "Upload Failed"; +if (fileQueue.length > 0) { +currentFileIndex++; +document.getElementById("status").innerHTML = "Uploaded " + i + " of " + files.length + " files, please wait."; +uploadNextFile(document.getElementById("actualFolder").value); +} } function abortHandler(event) { - _("status").innerHTML = "inUpload Aborted"; - if (fileQueue.length > 0) { - currentFileIndex++; - document.getElementById("status").innerHTML = "Uploaded " + i + " of " + files.length + " files, please wait."; - uploadNextFile(document.getElementById("actualFolder").value); - } +_("status").innerHTML = "inUpload Aborted"; +if (fileQueue.length > 0) { +currentFileIndex++; +document.getElementById("status").innerHTML = "Uploaded " + i + " of " + files.length + " files, please wait."; +uploadNextFile(document.getElementById("actualFolder").value); +} } window.addEventListener("load", function() { - listFilesButton("/"); +listFilesButton("/"); }); @@ -854,7 +808,7 @@ window.addEventListener("load", function() {