diff --git a/flasher/commands.js b/flasher/commands.js index 204834cd59..83e015a6a2 100644 --- a/flasher/commands.js +++ b/flasher/commands.js @@ -5,6 +5,7 @@ const { Echo, Exec, IdentifyKeyboard } = require('./util'); async function Upload (keymap, path, right = false) { await Build(keymap, path, right); + // Find a keyboard to flash let board; while (board == null) { board = IdentifyKeyboard(undefined, path); @@ -40,22 +41,9 @@ async function Build (keymap, path, right = false) { } module.exports.Build = Build; -function Flash (keymap, path, right = false) { - return new Promise(async resolve => { - Echo(`Flashing ${right ? 'right' : 'left'}`); - // make infinity--.build/ergodox_infinity_.bin - // await Exec(`make ergodox_infinity-${keymap}-dfu-util ${right ? 'MASTER=right' : ''}`); - await Exec(`dfu-util --path ${path} -D .build/ergodox_infinity_default.bin`); - Echo(`Flashed ${right ? 'right' : 'left'}`, ''); - - // while (IdentifyKeyboard(board.path)) { - // Echo(`Unplug your keyboard!`); - // } - // TODO: Check to see if the script is done. If it is, then don't require an unplug - // TODO: Make this actually look for the keyboard to be unplugged - // Echo(`Unplug your keyboard! (you have 15 seconds to do so)`); - // setTimeout(() => resolve(), 15000); - resolve(); - }); +async function Flash (keymap, path, right = false) { + Echo(`Flashing ${right ? 'right' : 'left'}`); + await Exec(`dfu-util --path ${path} -D .build/ergodox_infinity_default.bin`); + Echo(`Flashed ${right ? 'right' : 'left'}`, ''); } module.exports.Flash = Flash; diff --git a/flasher/index.js b/flasher/index.js index 9eadf40204..8b643edbf6 100755 --- a/flasher/index.js +++ b/flasher/index.js @@ -1,14 +1,10 @@ #!/usr/bin/env node -const { execSync, exec } = require('child_process'); const Commander = require('commander'); -const { Echo, Exec, IdentifyKeyboard } = require('./util'); +const { Echo } = require('./util'); const { Upload } = require('./commands'); -const LEFT_TARGET = process.env.LEFT; -const RIGHT_TARGET = process.env.RIGHT; - if (!process.cwd().endsWith('/qmk_firmware')) { process.chdir(`${__dirname}/../`) console.log(process.cwd()); @@ -27,8 +23,8 @@ Commander await Upload(Commander.keymap, Commander.path, Commander.half === 'right'); } else { // Build both halves - await Upload(Commander.keymap); + await Upload(Commander.keymap); await Upload(Commander.keymap, undefined, true); } })();