From 05b3402765c82f01d79c296cdc597dc528085cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 16 Oct 2017 23:31:22 +0200 Subject: [PATCH] Send bootloader timeout to the bootloader via USB. --- packages/usb/jump-to-bootloader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/usb/jump-to-bootloader.js b/packages/usb/jump-to-bootloader.js index 7ffe2d8d..5b624584 100755 --- a/packages/usb/jump-to-bootloader.js +++ b/packages/usb/jump-to-bootloader.js @@ -3,6 +3,7 @@ let uhk = require('./uhk'); let timeoutMs = 10000; let pollingIntervalMs = 100; +let bootloaderTimeoutMs = 5000; let jumped = false; console.log('Trying to jump to the bootloader...'); @@ -24,7 +25,8 @@ setInterval(() => { device = uhk.getUhkDevice(); if (device && !jumped) { console.log('UHK found, jumping to bootloader'); - device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.jumpToBootloader]))); + let t = bootloaderTimeoutMs; + device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.jumpToBootloader, 0, t&0xff, (t&0xff<<8)>>8, (t&0xff<<16)>>16, (t&0xff<<24)>>24]))); jumped = true; }