[GUI] Added more types to store.js, fixed odrive config import/export

This commit is contained in:
PAJohnson
2021-01-19 00:35:22 -05:00
parent 4b48a355b4
commit d5ba0946d2
5 changed files with 31 additions and 7 deletions
+5 -4
View File
@@ -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",
});
+1 -1
View File
@@ -36,7 +36,7 @@
"value": 1
},
{
"text": "Starup Sequence",
"text": "Startup Sequence",
"value": 2
},
{
+1 -1
View File
@@ -36,7 +36,7 @@
"value": 1
},
{
"text": "Starup Sequence",
"text": "Startup Sequence",
"value": 2
},
{
+8 -1
View File
@@ -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":
+16
View File
@@ -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