diff --git a/HardwareReport/HardwareReport.js b/HardwareReport/HardwareReport.js index 2391b7e1..c1fe3db1 100644 --- a/HardwareReport/HardwareReport.js +++ b/HardwareReport/HardwareReport.js @@ -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 } } } @@ -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) } }