Send bootloader timeout to the bootloader via USB.
This commit is contained in:
@@ -3,6 +3,7 @@ let uhk = require('./uhk');
|
|||||||
|
|
||||||
let timeoutMs = 10000;
|
let timeoutMs = 10000;
|
||||||
let pollingIntervalMs = 100;
|
let pollingIntervalMs = 100;
|
||||||
|
let bootloaderTimeoutMs = 5000;
|
||||||
let jumped = false;
|
let jumped = false;
|
||||||
|
|
||||||
console.log('Trying to jump to the bootloader...');
|
console.log('Trying to jump to the bootloader...');
|
||||||
@@ -24,7 +25,8 @@ setInterval(() => {
|
|||||||
device = uhk.getUhkDevice();
|
device = uhk.getUhkDevice();
|
||||||
if (device && !jumped) {
|
if (device && !jumped) {
|
||||||
console.log('UHK found, jumping to bootloader');
|
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;
|
jumped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user