From 859cf4de13b961df955584d79dd56554654ac6f5 Mon Sep 17 00:00:00 2001 From: serg3295 Date: Sun, 30 Jun 2024 14:45:20 +0300 Subject: [PATCH 1/4] fix file uploading newer esp32 firmware requires uart.start/stop --- src/main/java/ESPlorer/ESPlorer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/ESPlorer/ESPlorer.java b/src/main/java/ESPlorer/ESPlorer.java index f91e84f..b2424d8 100644 --- a/src/main/java/ESPlorer/ESPlorer.java +++ b/src/main/java/ESPlorer/ESPlorer.java @@ -12702,6 +12702,9 @@ private void UploadFilesStart() { } log("sendPackets=" + Integer.toString(sendPackets.size())); String cmd = "_up=function(n,l,ll)\n" + + " if node.chipmodel then\n" + + " uart.start(0)\n" + + " end\n" + " local cs = 0\n" + " local i = 0\n" + " local open = file.open or io.open\n" @@ -12724,6 +12727,9 @@ private void UploadFilesStart() { + " end\n" + " end,0)\n" + "end\n" + + "if node.chipmodel then\n" + + " uart.stop(0)\n" + + "end\n" + "file.remove(\"" + UploadFileName + "\")\n"; sendBuf = cmdPrep(cmd); int startPackets; From d46c5af1450dbab4429c6774ae58431755cb22d5 Mon Sep 17 00:00:00 2001 From: serg3295 Date: Sun, 30 Jun 2024 14:10:01 +0300 Subject: [PATCH 2/4] fixes file_list parsing line ending in newer esp32 firmware is '\n' instead of '\r\n' --- src/main/java/ESPlorer/ESPlorer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ESPlorer/ESPlorer.java b/src/main/java/ESPlorer/ESPlorer.java index b2424d8..aa8d3cc 100644 --- a/src/main/java/ESPlorer/ESPlorer.java +++ b/src/main/java/ESPlorer/ESPlorer.java @@ -7705,8 +7705,9 @@ public void serialEvent(SerialPortEvent event) { log("FileManager: File list found! Do parsing..."); try { // parsing answer + rx_data = rx_data.replaceAll("\r?\n", "\n"); int start = rx_data.indexOf("~~~File list START~~~"); - rx_data = rx_data.substring(start + 23, rx_data.indexOf("~~~File list END~~~")); + rx_data = rx_data.substring(start + 22, rx_data.indexOf("~~~File list END~~~")); //log(rx_data.replaceAll("\r?\n", "\r\n")); s = rx_data.split("\r?\n"); Arrays.sort(s); From 885aed34baec1023e870c378d26c5a431453118a Mon Sep 17 00:00:00 2001 From: serg3295 Date: Sun, 30 Jun 2024 15:57:05 +0300 Subject: [PATCH 3/4] Prohibit the uploading of zero-size files --- src/main/java/ESPlorer/ESPlorer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/ESPlorer/ESPlorer.java b/src/main/java/ESPlorer/ESPlorer.java index aa8d3cc..7329504 100644 --- a/src/main/java/ESPlorer/ESPlorer.java +++ b/src/main/java/ESPlorer/ESPlorer.java @@ -12696,6 +12696,10 @@ private void UploadFilesStart() { log("Uploader: loaded fail!"); return; } + if (mFile.get(mFileIndex).length() == 0) { + TerminalAdd("\r\nUploader: ERROR! " + UploadFileName + " has zero size.\r\n"); + return; + } int lastPacketSize = SplitDataToPackets(); if (lastPacketSize < 0) { log("Uploader: SplitDataToPackets fail!"); From f11b2c13d8f61eb2c7417386a89a406a5d1c82cd Mon Sep 17 00:00:00 2001 From: serg3295 Date: Sun, 30 Jun 2024 16:01:41 +0300 Subject: [PATCH 4/4] Change size of RightFilesSplitPane --- src/main/java/ESPlorer/ESPlorer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ESPlorer/ESPlorer.java b/src/main/java/ESPlorer/ESPlorer.java index 7329504..79a3d41 100644 --- a/src/main/java/ESPlorer/ESPlorer.java +++ b/src/main/java/ESPlorer/ESPlorer.java @@ -6045,7 +6045,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { RightBigPaneLayout.setVerticalGroup( RightBigPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(RightBigPaneLayout.createSequentialGroup() - .addComponent(RightFilesSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE) + .addComponent(RightFilesSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 813, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(RightSnippetsPane, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)) );