CIM71 - Add related users to assest, CIM72 Add related users to accounts

This commit is contained in:
“VeLiTi”
2024-05-06 12:32:47 +02:00
parent 143fb60be5
commit b2601ff32b
14 changed files with 267 additions and 64 deletions

View File

@@ -8,9 +8,9 @@ const VPP1 = []; //for VPP1 values
const VPP2 = []; //for VPP2 values
const VBAT = []; //for VBAT values
const PWM = []; //for PWM values
const STATE = []; //for STATE values
const xChart = []; //x-axis chart values
function progressBar(percentage, message, color){
var readbar = document.getElementById("readBar");
readBar.style.background = color;
@@ -238,14 +238,13 @@ const serialResultsDiv = document.getElementById("serialResults");
async function appendToTerminal(newStuff) {
serialResultsDiv.innerHTML += newStuff;
serialOutput +=newStuff
}
function renderChart(){
var test = serialResultsDiv.innerHTML.split(";");
console.log(test)
test.forEach(getData);
const xValues = xChart;
new Chart("chart_VCP", {
@@ -263,6 +262,26 @@ function renderChart(){
data: VBAT,
borderColor: "black",
fill: false
},{
label: "VPP1",
data: VPP1,
borderColor: "green",
fill: false
},{
label: "VPP2",
data: VPP2,
borderColor: "blue",
fill: false
},{
label: "PWM",
data: PWM,
backgroundColor: "yellow",
fill: false
},{
label: "STATE",
data: STATE,
backgroundColor: "purple",
fill: false
}
]
},
@@ -270,75 +289,57 @@ function renderChart(){
legend: {display: true}
}
});
new Chart("chart_VPP", {
type: "line",
data: {
labels: xValues,
datasets: [{
label: "VPP1",
data: VPP1,
borderColor: "green",
fill: false
}, {
label: "VPP2",
data: VPP2,
borderColor: "blue",
fill: false
},
]
},
options: {
legend: {display: true}
}
});
new Chart("chart_PWM", {
type: "bar",
data: {
labels: xValues,
datasets: [{
label: "PWM",
data: PWM,
backgroundColor: "yellow",
fill: false
}
]
},
options: {
legend: {display: true}
}
});
}
//Get the RAW data and turn into object
function getData(item) {
let item_array = item.split("=");
let xaxis = xChart.length + 1;
if (item_array[0] == "VCP"){
VCP.push(item_array[1])
let vcp = item_array[1] / 1000000;
VCP.push(vcp)
xChart.push(xaxis);
}
if (item_array[0] == "VPP1"){
VPP1.push(item_array[1])
let vpp1 = item_array[1] / 1000000;
VPP1.push(vpp1)
}
if (item_array[0] == "VPP2"){
VPP2.push(item_array[1])
let vpp2 = item_array[1] / 1000000;
VPP2.push(vpp2)
}
if (item_array[0] == "VBAT"){
VBAT.push(item_array[1])
let vbat = item_array[1] / 1000000;
VBAT.push(vbat)
}
if (item_array[0] == "STATE"){
let state
switch (item_array[1]) {
case 'FULL_CONNECT':
state = 5;
break;
case 'REACTIVATE':
state = 3;
break;
case 'WAIT_CONNECT':
state = -5;
break;
case 'DISCONNECTED':
state = 0;
break;
}
STATE.push(state)
}
if (item_array[0] == "PWM")
{
var check_return = item_array[1].match(/[^\r\n]+/g);
console.log(check_return, check_return[0])
var check_return = item_array[1].match(/[^\r\n]+/g);
if (check_return.length == 2){
PWM.push(check_return[0])
let pwm = check_return[0] / 10;
PWM.push(pwm)
}
}
}
}
async function closePort(){