configure firmware hash
This commit is contained in:
45
index.html
45
index.html
@@ -67,6 +67,13 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>5. Configure firmware hash (todo: TNC mode: frequency, bandwidth, tx power, spreading factor, coding rate)</div>
|
||||
<button @click="configure" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||
Configure
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>0. Extra Tools</div>
|
||||
<button @click="wipe" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||
@@ -336,6 +343,44 @@
|
||||
console.log("done");
|
||||
|
||||
},
|
||||
async configure() {
|
||||
|
||||
// ask for serial port
|
||||
const serialPort = await this.askForSerialPort();
|
||||
if(!serialPort){
|
||||
return;
|
||||
}
|
||||
|
||||
// check if device is an rnode
|
||||
const rnode = await RNode.fromSerialPort(serialPort);
|
||||
const isRNode = await rnode.detect();
|
||||
if(!isRNode){
|
||||
alert("Selected device is not an RNode!");
|
||||
return;
|
||||
}
|
||||
|
||||
// check if device has been provisioned
|
||||
const rom = await rnode.getRomAsObject();
|
||||
const details = rom.parse();
|
||||
if(!details || !details.is_provisioned){
|
||||
alert("Eeprom is not provisioned. You must do this first!");
|
||||
await rnode.close();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log({
|
||||
firmware_hash: await rnode.getFirmwareHash(),
|
||||
target_firmware_hash: await rnode.getTargetFirmwareHash(),
|
||||
});
|
||||
|
||||
// todo: this works, but we should be calculating the firmware hash from the file, and not giving the board what it already knows
|
||||
await rnode.setFirmwareHash(await rnode.getFirmwareHash());
|
||||
await Utils.sleepMillis(5000);
|
||||
|
||||
await rnode.reset();
|
||||
await rnode.close();
|
||||
|
||||
},
|
||||
},
|
||||
}).mount('#app');
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user