add button to reboot board
This commit is contained in:
29
index.html
29
index.html
@@ -89,7 +89,10 @@
|
|||||||
<div class="border bg-gray-50 p-3 rounded">
|
<div class="border bg-gray-50 p-3 rounded">
|
||||||
<div>Extra Tools</div>
|
<div>Extra Tools</div>
|
||||||
<div class="space-x-1">
|
<div class="space-x-1">
|
||||||
<button @click="dumpEeprom" class="border border-gray-500 px-2 bg-red-100 hover:bg-red-200 rounded">
|
<button @click="reboot" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||||
|
Reboot
|
||||||
|
</button>
|
||||||
|
<button @click="dumpEeprom" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||||
Dump EEPROM
|
Dump EEPROM
|
||||||
</button>
|
</button>
|
||||||
<button @click="wipeEeprom" class="border border-gray-500 px-2 bg-red-100 hover:bg-red-200 rounded">
|
<button @click="wipeEeprom" class="border border-gray-500 px-2 bg-red-100 hover:bg-red-200 rounded">
|
||||||
@@ -229,6 +232,30 @@
|
|||||||
const view = new DataView(buffer);
|
const view = new DataView(buffer);
|
||||||
return view.getUint32(0, false); // false for big-endian
|
return view.getUint32(0, false); // false for big-endian
|
||||||
},
|
},
|
||||||
|
async reboot() {
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reboot
|
||||||
|
await rnode.reset();
|
||||||
|
await rnode.close();
|
||||||
|
|
||||||
|
// done
|
||||||
|
alert("Board is rebooting!");
|
||||||
|
|
||||||
|
},
|
||||||
async dumpEeprom() {
|
async dumpEeprom() {
|
||||||
|
|
||||||
// ask for serial port
|
// ask for serial port
|
||||||
|
|||||||
Reference in New Issue
Block a user