From 83238c2b0fedde95a79d2ef810e3df0cb9ce7c91 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:54:27 +0200 Subject: [PATCH 1/4] SysID: declare variables that were implicitly global Each was assigned without let/var, creating a global, but is only used within the function (or loop) that assigns it, and is not used by any other script on the page, so let does not change behaviour. --- SysID/SysID.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SysID/SysID.js b/SysID/SysID.js index 0e819e1b..545d7ec9 100644 --- a/SysID/SysID.js +++ b/SysID/SysID.js @@ -416,7 +416,7 @@ async function run_transfer_function_ID(parser) { const ind2_i = nearestIndex(timeData_arr, t_end*1000000) console.log("ind1: ",ind1_i," ind2: ",ind2_i) - timeData = Array.from(timeData_arr) + let timeData = Array.from(timeData_arr) console.log("time field pre slicing size: ", timeData.length) timeData = timeData.slice(ind1_i, ind2_i) @@ -453,7 +453,7 @@ async function run_transfer_function_ID(parser) { mult = parseFloat(outputValues.multipliers[0]) } let ang_data = parser.get("ATT", outputValues.compensations[0]) - ang_data_arr = Array.from(ang_data) + let ang_data_arr = Array.from(ang_data) ang_data_arr.slice(att_ind1, att_ind2) console.log("data field ", outputValues.compensations[0], " pre slicing size: ", outputData.length) const G = 9.81 @@ -677,7 +677,7 @@ async function run_SS_ID(parser) { const ind2_i = nearestIndex(timeData_arr, t_end_ss*1000000) console.log("ind1: ",ind1_i," ind2: ",ind2_i) - timeData = Array.from(timeData_arr) + let timeData = Array.from(timeData_arr) console.log("time field pre slicing size: ",timeData.length) timeData = timeData.slice(ind1_i, ind2_i) @@ -718,19 +718,19 @@ async function run_SS_ID(parser) { mult = parseFloat(outputValues.multipliers[i]) } let ang_data = parser.get("ATT", outputValues.compensations[i]) - ang_data_arr = Array.from(ang_data) + let ang_data_arr = Array.from(ang_data) ang_data_arr.slice(att_ind1, att_ind2) console.log("data field ", outputValues.compensations[i], " pre slicing size: ", data_arr.length) const G = 9.81 if (outputValues.compensations[i] == "Roll") { for (let j = 0; j < data_arr.length; j++) { - temp_data = data_arr[j] + let temp_data = data_arr[j] data_arr[j] = data_arr[j] + (Math.PI/180) * mult * G * ang_data_arr[att_ind1 + j] } } if (outputValues.compensations[i] == "Pitch") { for (let j = 0; j < data_arr.length; j++) { - temp_data = data_arr[j] + let temp_data = data_arr[j] data_arr[j] = data_arr[j] - (Math.PI/180) * mult * G * ang_data_arr[att_ind1 + j] } } From 08d27484df125620d17dd6a751c5fcfee15e6833 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:54:27 +0200 Subject: [PATCH 2/4] SysID: declare the matrix-filling variables in each function rows, cols, cellSelector and inputElement were implicit globals shared by setMatrixA, setMatrixB, setH0 and setH1. Each function assigns them before reading them and none calls another, so declaring them locally does not change behaviour. --- SysID/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SysID/index.html b/SysID/index.html index 9e00eb61..8340279e 100644 --- a/SysID/index.html +++ b/SysID/index.html @@ -593,6 +593,7 @@