Skip to content

Commit

Permalink
Fixed GPS Instance Numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
SantamRC committed Apr 20, 2024
1 parent 7409edc commit 1b33ee5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions HardwareReport/HardwareReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -1194,13 +1194,16 @@ function load_gps(log) {
let messages = log.get("MSG").Message

let section = document.getElementById("GPS")
let gps_num = 0
let gps_num;
// This regular expression is used to get the word after "as" to get the GPS device name. (?<=as\s) will exclude the "as" and a whitespace from the regex and then (\S+) will match the next word.
let regex = /(?<=as\s)(\S+)/i;
let regex_gps_device = /(?<=as\s)(\S+)/i;
let regex_gps_number = /(?<=GPS\s)(\S)/
for (let i = 0; i < messages.length; i++) {
if (messages[i].startsWith("GPS")) {
let gps_device = messages[i].match(regex)[0];
gps_instances[gps_num++] = { gps: gps_device }
gps_num = parseInt(messages[i].match(regex_gps_number)[0]);
console.log(gps_num)
let gps_device = messages[i].match(regex_gps_device)[0];
gps_instances[gps_num] = { gps: gps_device }
}
}

Expand Down Expand Up @@ -1228,7 +1231,7 @@ function load_gps(log) {
have_section = true
let colum = document.createElement("td")

colum.appendChild(print_gps(i + 1, gps_instances[i]))
colum.appendChild(print_gps(i, gps_instances[i]))
table.appendChild(colum)
}
}
Expand Down

0 comments on commit 1b33ee5

Please sign in to comment.