Extract code to uhk.writeUca()

This commit is contained in:
László Monda
2018-04-02 17:31:27 +02:00
parent 148dd8d361
commit 1b15911783
2 changed files with 11 additions and 7 deletions

View File

@@ -21,13 +21,7 @@ require('shelljs/global');
await uhk.updateFirmwares(firmwarePath); await uhk.updateFirmwares(firmwarePath);
const device = uhk.getUhkDevice(); const device = uhk.getUhkDevice();
const configBuffer = fs.readFileSync(`${firmwarePath}/devices/uhk60-right/config.bin`); const configBuffer = fs.readFileSync(`${firmwarePath}/devices/uhk60-right/config.bin`);
console.log('write config'); await uhk.writeUca(device, configBuffer);
await uhk.writeConfig(device, configBuffer, false);
console.log('apply config');
await uhk.applyConfig(device);
console.log('lanuch eeprom transfer');
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.eepromTransfer.writeUserConfig);
await uhk.writeHca(device, false); await uhk.writeHca(device, false);
config.verbose = false; config.verbose = false;
})(); })();

View File

@@ -330,6 +330,15 @@ async function launchEepromTransfer(device, operation, configBuffer) {
} while (isBusy); } while (isBusy);
}; };
async function writeUca(device, configBuffer) {
console.log('write config');
await uhk.writeConfig(device, configBuffer, false);
console.log('apply config');
await uhk.applyConfig(device);
console.log('lanuch eeprom transfer');
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.eepromTransfer.writeUserConfig);
}
async function writeHca(device, isIso) { async function writeHca(device, isIso) {
const hardwareConfig = new HardwareConfiguration(); const hardwareConfig = new HardwareConfiguration();
@@ -378,6 +387,7 @@ uhk = exports = module.exports = moduleExports = {
writeConfig, writeConfig,
applyConfig, applyConfig,
launchEepromTransfer, launchEepromTransfer,
writeUca,
writeHca, writeHca,
usbCommands: { usbCommands: {
getDeviceProperty : 0x00, getDeviceProperty : 0x00,