|
|
@ -45,7 +45,8 @@ export async function setup(configs: ConfigPreset[], deviceModelName: string, fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export async function nextBatch(devices: Device[], flashStates: FlashState[], deviceCallback: (flashState: FlashOperation) => void) { |
|
|
export async function nextBatch(devices: Device[], flashStates: FlashState[], deviceCallback: (flashState: FlashOperation) => void) { |
|
|
callback("busy"); |
|
|
callback("busy"); |
|
|
|
|
|
debugger; |
|
|
devices = devices.filter((d, i) => flashStates[i].state == "doFlash"); |
|
|
devices = devices.filter((d, i) => flashStates[i].state == "doFlash"); |
|
|
flashStates = flashStates.filter(f => f.state == "doFlash"); |
|
|
flashStates = flashStates.filter(f => f.state == "doFlash"); |
|
|
if(devices.length > configQueue.length) { |
|
|
if(devices.length > configQueue.length) { |
|
|
@ -285,33 +286,38 @@ export class FlashOperation { |
|
|
await this.loader!.disconnect(); |
|
|
await this.loader!.disconnect(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.setState("config"); |
|
|
try { |
|
|
await port!.setSignals({requestToSend: true}); |
|
|
this.setState("config"); |
|
|
await new Promise(r => setTimeout(r, 100)); |
|
|
await port!.setSignals({requestToSend: true}); |
|
|
await port!.setSignals({requestToSend: false}); |
|
|
await new Promise(r => setTimeout(r, 100)); |
|
|
await port!.close(); |
|
|
await port!.setSignals({requestToSend: false}); |
|
|
const connection = (this.device.connection! as ISerialConnection); |
|
|
await port!.close(); |
|
|
await connection.connect({ |
|
|
const connection = (this.device.connection! as ISerialConnection); |
|
|
port, |
|
|
await connection.connect({ |
|
|
baudRate: undefined, |
|
|
port, |
|
|
concurrentLogOutput: true |
|
|
baudRate: undefined, |
|
|
}); |
|
|
concurrentLogOutput: true |
|
|
|
|
|
}); |
|
|
const newConfig = new Protobuf.Config({ |
|
|
|
|
|
payloadVariant: { |
|
|
const newConfig = new Protobuf.Config({ |
|
|
case: "device", |
|
|
payloadVariant: { |
|
|
value: this.config.device! |
|
|
case: "device", |
|
|
} |
|
|
value: this.config.device! |
|
|
}); |
|
|
} |
|
|
const promise = connection.setConfig(newConfig).then(() => |
|
|
}); |
|
|
connection.commitEditSettings().then(() => console.log("FLASHER: Config saved")) |
|
|
const promise = connection.setConfig(newConfig).then(() => |
|
|
); |
|
|
connection.commitEditSettings().then(() => console.log("FLASHER: Config saved")) |
|
|
|
|
|
).catch(e => console.error(e)); |
|
|
// We won't get an answer if serial output has been disabled in the new config
|
|
|
|
|
|
if(this.config.device!.serialEnabled) |
|
|
// We won't get an answer if serial output has been disabled in the new config
|
|
|
await promise; |
|
|
if(this.config.device!.serialEnabled) |
|
|
|
|
|
await promise; |
|
|
|
|
|
|
|
|
this.setState("done"); |
|
|
this.setState("done"); |
|
|
|
|
|
} |
|
|
|
|
|
catch(e) { |
|
|
|
|
|
this.setState("failed"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async cancel() { |
|
|
public async cancel() { |
|
|
|