From b90e8bedf68c95fdf584eaddbd02e3e7e535efe3 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 17 Jul 2024 00:27:56 +1200 Subject: [PATCH] add ui to select product and model --- index.html | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d18c31b..de4927d 100644 --- a/index.html +++ b/index.html @@ -60,9 +60,25 @@
3. Provision EEPROM with device info, checksum and signature.
- +
+
Product
+ +
+
+
Model
+ +
+
+ +
@@ -111,6 +127,34 @@ return { isFlashing: false, flashingProgress: 0, + + selectedProduct: null, + selectedModel: null, + products: [ + { + name: "RAK4631", + id: ROM.PRODUCT_RAK4631, + models: [ + { + id: ROM.MODEL_11, + name: "433 MHz", + }, + { + id: ROM.MODEL_12, + name: "868 MHz", + }, + { + id: ROM.MODEL_12, + name: "915 MHz", + }, + { + id: ROM.MODEL_12, + name: "923 MHz", + }, + ], + }, + ], + }; }, mounted() { @@ -333,6 +377,7 @@ const isRNode = await rnode.detect(); if(!isRNode){ alert("Selected device is not an RNode!"); + await rnode.close(); return; } @@ -345,12 +390,26 @@ return; } + // ensure user has selected product + if(!this.selectedProduct){ + alert("Please select a product!"); + await rnode.close(); + return; + } + + // ensure user has selected model + if(!this.selectedModel){ + alert("Please select a model!"); + await rnode.close(); + return; + } + console.log("device is not provisioned yet, doing it now..."); // determine device info // todo implement ui to configure these values - const product = ROM.PRODUCT_RAK4631; - const model = ROM.MODEL_12; + const product = this.selectedProduct.id; + const model = this.selectedModel.id; const hardwareRevision = 0x1; const serialNumber = 1; const timestampInSeconds = Math.floor(Date.now() / 1000);