mirror of
https://github.com/Quad4-Software/MeshChatX.git
synced 2026-08-18 09:49:09 -04:00
fix: improve firmware file reading method in RNodeFlasherActivity for better performance and reliability
This commit is contained in:
parent
8e1cd80fa9
commit
85aa7eb43f
2 changed files with 8 additions and 1 deletions
|
|
@ -26,6 +26,7 @@ import androidx.core.content.ContextCompat;
|
|||
import com.meshchatx.AppSettingsLauncher;
|
||||
import com.meshchatx.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -340,7 +341,13 @@ public final class RNodeFlasherActivity extends AppCompatActivity implements Usb
|
|||
if (in == null) {
|
||||
throw new IllegalStateException("Could not open firmware file");
|
||||
}
|
||||
bytes = in.readAllBytes();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buf = new byte[8192];
|
||||
int n;
|
||||
while ((n = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, n);
|
||||
}
|
||||
bytes = out.toByteArray();
|
||||
}
|
||||
String rawName = uri.getLastPathSegment();
|
||||
final String name = (rawName == null || rawName.isEmpty()) ? "firmware.zip" : rawName;
|
||||
|
|
|
|||
BIN
meshchatx.rsm
BIN
meshchatx.rsm
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue