From d5ba0946d21c6211ff47b0fd3950618a1877a259 Mon Sep 17 00:00:00 2001 From: PAJohnson Date: Tue, 19 Jan 2021 00:35:22 -0500 Subject: [PATCH] [GUI] Added more types to store.js, fixed odrive config import/export --- GUI/src/App.vue | 9 +++++---- GUI/src/assets/dashboards/Tuning_0_4_12.json | 2 +- GUI/src/assets/dashboards/Tuning_0_5_1.json | 2 +- GUI/src/store.js | 9 ++++++++- GUI/src/views/Dashboard.vue | 16 ++++++++++++++++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/GUI/src/App.vue b/GUI/src/App.vue index 1867e71f..2d600525 100644 --- a/GUI/src/App.vue +++ b/GUI/src/App.vue @@ -222,8 +222,8 @@ export default { }; reader.addEventListener("load", function (e) { let importString = e.target.result; - importString = importString.replaceAll(" Infinity", '" Infinity"'); - importString = importString.replaceAll(" -Infinity", '" -Infinity"'); + importString = importString.replace(/ Infinity/g, '" Infinity"'); + importString = importString.replace(/ -Infinity/g, '" -Infinity"'); importConfig(JSON.parse(importString)); }); reader.readAsText(file); @@ -268,8 +268,9 @@ export default { if (exportString.includes('"Infinity"')) { console.log("found infinity!"); } - exportString = exportString.replaceAll('"Infinity"', 'Infinity'); - exportString = exportString.replaceAll('"-Infinity"', '-Infinity'); + console.log(typeof exportString); + exportString = exportString.replace(/"Infinity"/g, 'Infinity'); + exportString = exportString.replace(/"-Infinity"/g, '-Infinity'); const blob = new Blob([exportString], { type: "application/json", }); diff --git a/GUI/src/assets/dashboards/Tuning_0_4_12.json b/GUI/src/assets/dashboards/Tuning_0_4_12.json index 52b9d1e4..c1a4ae78 100644 --- a/GUI/src/assets/dashboards/Tuning_0_4_12.json +++ b/GUI/src/assets/dashboards/Tuning_0_4_12.json @@ -36,7 +36,7 @@ "value": 1 }, { - "text": "Starup Sequence", + "text": "Startup Sequence", "value": 2 }, { diff --git a/GUI/src/assets/dashboards/Tuning_0_5_1.json b/GUI/src/assets/dashboards/Tuning_0_5_1.json index 465030cb..8e18af98 100644 --- a/GUI/src/assets/dashboards/Tuning_0_5_1.json +++ b/GUI/src/assets/dashboards/Tuning_0_5_1.json @@ -36,7 +36,7 @@ "value": 1 }, { - "text": "Starup Sequence", + "text": "Startup Sequence", "value": 2 }, { diff --git a/GUI/src/store.js b/GUI/src/store.js index 7ce08928..158d25b4 100644 --- a/GUI/src/store.js +++ b/GUI/src/store.js @@ -267,7 +267,14 @@ export default new Vuex.Store({ case "float": retObj[key] = parseFloat(parseFloat(odriveObj[key]["val"]).toFixed(3)); break; - case "int": + case "int8": + case "int16": + case "int32": + case "int64": + case "uint8": + case "uint16": + case "uint32": + case "uint64": retObj[key] = parseInt(odriveObj[key]["val"]); break; case "bool": diff --git a/GUI/src/views/Dashboard.vue b/GUI/src/views/Dashboard.vue index 3c44a81d..2964d79d 100644 --- a/GUI/src/views/Dashboard.vue +++ b/GUI/src/views/Dashboard.vue @@ -143,6 +143,14 @@ let odriveEnums = { { text: "Homing", value: 11, + }, + { + text: "Encoder Hall Polarity Calibration", + value: 12, + }, + { + text: "Encoder Hall Phase Calibration", + value: 13, } ], current_state: [ @@ -193,6 +201,14 @@ let odriveEnums = { { text: "Homing", value: 11, + }, + { + text: "Encoder Hall Polarity Calibration", + value: 12, + }, + { + text: "Encoder Hall Phase Calibration", + value: 13, } ], // encoder mode