refactor(usb-deployer): name timing constants for sync window tuning

This commit is contained in:
a2nr 2026-07-17 10:35:23 +07:00
parent 4ec5d4cb92
commit 3d941191e3
1 changed files with 6 additions and 2 deletions

View File

@ -91,12 +91,16 @@ const ATMEGA328P_SIG_2 = 0x0f;
const ATMEGA328P_FLASH_SIZE = 32768; const ATMEGA328P_FLASH_SIZE = 32768;
const ATMEGA328P_PAGE_SIZE = 128; const ATMEGA328P_PAGE_SIZE = 128;
const STK_SYNC_RETRIES = 10; const STK_SYNC_RETRIES = 6;
const STK_SYNC_TIMEOUT_MS = 500; /* Longer timeout for initial sync (optiboot may be slow) */ const STK_SYNC_TIMEOUT_MS = 300; /* Per-attempt read timeout during initial sync */
const STK_CMD_TIMEOUT_MS = 200; const STK_CMD_TIMEOUT_MS = 200;
const STK_PAGE_TIMEOUT_MS = 500; const STK_PAGE_TIMEOUT_MS = 500;
const STK_LEAVE_TIMEOUT_MS = 100; const STK_LEAVE_TIMEOUT_MS = 100;
const BOOTLOADER_SETTLE_MS = 100; /* Wait after DTR release for optiboot to start */
const DRAIN_BYTE_TIMEOUT_MS = 10; /* How long to wait for the next stray byte */
const DRAIN_TOTAL_MS = 50; /* Max total time to spend draining */
/* ── Arduino VID/PID pairs for port filter ─────────────────────────── */ /* ── Arduino VID/PID pairs for port filter ─────────────────────────── */
const ARDUINO_VID_PIDS: SerialPortFilter[] = [ const ARDUINO_VID_PIDS: SerialPortFilter[] = [
{ usbVendorId: 0x2341, usbProductId: 0x0043 }, { usbVendorId: 0x2341, usbProductId: 0x0043 },