🎨 Cleaning up

pull/1932/head
Louis Orleans 7 years ago
parent 2c2f38deb6
commit 8b0461ae98

@ -5,6 +5,7 @@ const { Echo, Exec, IdentifyKeyboard } = require('./util');
async function Upload (keymap, path, right = false) { async function Upload (keymap, path, right = false) {
await Build(keymap, path, right); await Build(keymap, path, right);
// Find a keyboard to flash
let board; let board;
while (board == null) { while (board == null) {
board = IdentifyKeyboard(undefined, path); board = IdentifyKeyboard(undefined, path);
@ -40,22 +41,9 @@ async function Build (keymap, path, right = false) {
} }
module.exports.Build = Build; module.exports.Build = Build;
function Flash (keymap, path, right = false) { async function Flash (keymap, path, right = false) {
return new Promise(async resolve => { Echo(`Flashing ${right ? 'right' : 'left'}`);
Echo(`Flashing ${right ? 'right' : 'left'}`); await Exec(`dfu-util --path ${path} -D .build/ergodox_infinity_default.bin`);
// make infinity-<keymap>-.build/ergodox_infinity_<keymap>.bin Echo(`Flashed ${right ? 'right' : 'left'}`, '');
// 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();
});
} }
module.exports.Flash = Flash; module.exports.Flash = Flash;

@ -1,14 +1,10 @@
#!/usr/bin/env node #!/usr/bin/env node
const { execSync, exec } = require('child_process');
const Commander = require('commander'); const Commander = require('commander');
const { Echo, Exec, IdentifyKeyboard } = require('./util'); const { Echo } = require('./util');
const { Upload } = require('./commands'); const { Upload } = require('./commands');
const LEFT_TARGET = process.env.LEFT;
const RIGHT_TARGET = process.env.RIGHT;
if (!process.cwd().endsWith('/qmk_firmware')) { if (!process.cwd().endsWith('/qmk_firmware')) {
process.chdir(`${__dirname}/../`) process.chdir(`${__dirname}/../`)
console.log(process.cwd()); console.log(process.cwd());
@ -27,8 +23,8 @@ Commander
await Upload(Commander.keymap, Commander.path, Commander.half === 'right'); await Upload(Commander.keymap, Commander.path, Commander.half === 'right');
} else { } else {
// Build both halves // Build both halves
await Upload(Commander.keymap);
await Upload(Commander.keymap);
await Upload(Commander.keymap, undefined, true); await Upload(Commander.keymap, undefined, true);
} }
})(); })();

Loading…
Cancel
Save