Skip to content

Commit 3b846e8

Browse files
committedMar 19, 2025
allow upload defaults to be changed
1 parent 66be4bd commit 3b846e8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎js/comms.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,10 @@ const Comms = {
270270
console.log(`<COMMS> Upload ${f.name} => ${JSON.stringify(f.content.length>50 ? f.content.substr(0,50)+"..." : f.content)} (${f.content.length}b${uploadPacket?", binary":""})`);
271271
if (uploadPacket) {
272272
Comms.getConnection().espruinoSendFile(f.name, f.content, {
273-
fs:Const.FILES_IN_FS,
274-
progress:(chunkNo,chunkCount)=>{Progress.show({percent: chunkNo*100/chunkCount});}
273+
fs: Const.FILES_IN_FS,
274+
chunkSize: Const.PACKET_UPLOAD_CHUNKSIZE,
275+
noACK: Const.PACKET_UPLOAD_NOACK,
276+
progress: (chunkNo,chunkCount)=>{Progress.show({percent: chunkNo*100/chunkCount});}
275277
}).then(doUploadFiles); // progress?
276278
} else {
277279
Comms.uploadCommandList(f.cmd, currentBytes, maxBytes).then(doUploadFiles);

‎js/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ const Const = {
3838
/* How many bytes of code to we attempt to upload in one go? */
3939
UPLOAD_CHUNKSIZE: 1024,
4040

41+
/* How many bytes of code to we attempt to upload when uploading via packets? */
42+
PACKET_UPLOAD_CHUNKSIZE: 2048, // 1024 is the default for UART.js
43+
44+
/* when uploading by packets should we wait for an ack before sending the next packet? Only works if you're fully confident in flow control. */
45+
PACKET_UPLOAD_NOACK: false,
46+
4147
/* Don't try and reset the device when we're connecting/sending apps */
4248
NO_RESET : false,
4349

0 commit comments

Comments
 (0)