add MTU setting field

This commit is contained in:
Shuanglei Tao
2025-04-10 10:39:47 +08:00
parent c2897a97a0
commit f44072fc47
2 changed files with 4 additions and 7 deletions

View File

@@ -82,6 +82,8 @@
<div class="flex-group">
<label for="threshold">阈值</label>
<input type="number" max="255" min="0" value="125" id="threshold" onchange="update_image()">
<label for="mtusize">MTU</label>
<input type="number" id="mtusize" value="20" min="0" max="255">
<label for="interleavedcount">确认间隔</label>
<input type="number" id="interleavedcount" value="50" min="0" max="500">
</div>

View File

@@ -7,7 +7,6 @@ let reconnectTrys = 0;
let canvas;
let startTime;
const MAX_PACKET_SIZE = 20;
const EpdCmd = {
SET_PINS: 0x00,
INIT: 0x01,
@@ -58,10 +57,6 @@ async function write(cmd, data, withResponse=true) {
if (data instanceof Uint8Array) data = Array.from(data);
payload.push(...data)
}
if (payload.length > MAX_PACKET_SIZE) {
addLog("BLE packet too large!");
return false;
}
addLog(`<span class="action">⇑</span> ${bytes2hex(payload)}`);
try {
if (withResponse)
@@ -77,9 +72,9 @@ async function write(cmd, data, withResponse=true) {
}
async function epdWrite(cmd, data) {
const chunkSize = MAX_PACKET_SIZE - 1;
const count = Math.round(data.length / chunkSize);
const chunkSize = document.getElementById('mtusize').value - 1;
const interleavedCount = document.getElementById('interleavedcount').value;
const count = Math.round(data.length / chunkSize);
let chunkIdx = 0;
let noReplyCount = interleavedCount;