Skip to content

Commit 409ed1f

Browse files
committed
Extenting tool for configuring server with the desired chunk size and inter-chunk delay
1 parent d456c1d commit 409ed1f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

extras/tools/bin2json.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import json
55
import base64
66

7+
CHUNK_SIZE = 256 # This is the chunk size of how the binary is split on the server side for not overloading the embedded device receive buffers.
8+
INTER_CHUNK_DELAY_MS = 100 # This is delay between 2 consecutive chunks so as to not over load the embedded device.
9+
710
if len(sys.argv) != 3:
811
print ("Usage: bin2json.py sketch-ota.bin sketch-ota.json")
912
sys.exit()
@@ -21,5 +24,5 @@
2124

2225
# Write to outfile
2326
out_file = open(ofile, "w")
24-
json.dump({'binary' : base64_data.decode("ascii")}, out_file)
27+
json.dump({'binary' : base64_data.decode("ascii"), 'chunk_size' : CHUNK_SIZE, 'delay' : INTER_CHUNK_DELAY_MS}, out_file)
2528
out_file.close()

0 commit comments

Comments
 (0)