Skip to content

Commit

Permalink
Added GPS Sections
Browse files Browse the repository at this point in the history
  • Loading branch information
SantamRC committed Apr 5, 2024
1 parent 4cf52a3 commit 9fabc76
Showing 1 changed file with 40 additions and 16 deletions.
56 changes: 40 additions & 16 deletions HardwareReport/HardwareReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,10 +1166,10 @@ function load_airspeed(log) {
}

// Load GPS
let gps
const max_num_gps = 2
let num_gps = 0
function load_gps(log) {
let gps = []

// for (let i = 0; i < max_num_gps; i++) {
// let index = String(i+1)
Expand All @@ -1192,37 +1192,61 @@ function load_gps(log) {

let section = document.getElementById("GPS")
let gps_num = 0
let regex = /as (\w+)/i;
let regex = /(?<=as\s)(\S+)/i;
for (let i = 0; i < messages.length; i++) {
if (messages[i].startsWith("GPS")) {
let gps_device = messages[i].match(regex);
let gps_device = messages[i].match(regex)[0];
gps[gps_num++] = { gps: gps_device }
}
}

console.log(gps)

function print_gps(inst, params) {
let fieldset = document.createElement("fieldset")

let heading = document.createElement("legend")
heading.innerHTML = "GPS " + inst
fieldset.appendChild(heading)

// const id = decode_devid(params.id, DEVICE_TYPE_BARO)
// print_device(fieldset, id)

fieldset.appendChild(document.createTextNode(params.gps))
fieldset.appendChild(document.createElement("br"))

// fieldset.appendChild(document.createElement("br"))
// fieldset.appendChild(document.createTextNode("Wind compensation: " + (params.wind_cmp ? "\u2705" : "\u274C")))

// if ("all_healthy" in params) {
// fieldset.appendChild(document.createElement("br"))
// fieldset.appendChild(document.createTextNode("Health: " + (params.all_healthy ? "\u2705" : "\u274C")))
// }

return fieldset
}

// let primary = params["BARO_PRIMARY"]
// section.appendChild(document.createTextNode("Primary: " + (primary+1)))
// section.appendChild(document.createElement("br"))
// section.appendChild(document.createElement("br"))

// let table = document.createElement("table")
// section.appendChild(table)
let table = document.createElement("table")
section.appendChild(table)

// let have_section = false
// for (let i = 0; i < baro.length; i++) {
// if (baro[i] != null) {
// have_section = true
// let colum = document.createElement("td")
let have_section = false
for (let i = 0; i < gps.length; i++) {
if (gps[i] != null) {
have_section = true
let colum = document.createElement("td")

// colum.appendChild(print_baro(i+1, baro[i]))
// table.appendChild(colum)
// }
// }
colum.appendChild(print_gps(i + 1, gps[i]))
table.appendChild(colum)
}
}

section.previousElementSibling.hidden = false
section.hidden = false
section.previousElementSibling.hidden = !have_section
section.hidden = !have_section

}

Expand Down

0 comments on commit 9fabc76

Please sign in to comment.