Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions HardwareReport/HardwareReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,20 @@ function show_param_changes(param_changes) {
para.previousElementSibling.hidden = false
}

// Return the params from the list that match the minimal param names, a name ending in "*" matches any param with that prefix
function match_minimal_params(names, param_names) {
let ret = []
for (const name of names) {
if (name.endsWith("*")) {
const prefix = name.slice(0, -1)
ret.push(...param_names.filter((param) => param.startsWith(prefix)))
} else if (param_names.includes(name)) {
ret.push(name)
}
}
return ret
}

function update_minimal_config() {

if (Object.keys(params).length == 0) {
Expand All @@ -1651,9 +1665,8 @@ function update_minimal_config() {
const input_params = input.getAttribute("data-params").split(',')

let present_params = []
for (const param of input_params) {
if ((param in params) &&
!(changed && (param in defaults) && (params[param] == defaults[param]))) {
for (const param of match_minimal_params(input_params, Object.keys(params))) {
if (!(changed && (param in defaults) && (params[param] == defaults[param]))) {
present_params.push(param)
}
}
Expand Down Expand Up @@ -3347,6 +3360,15 @@ function reset() {
setup_minimal_param("param_stream_" + i, SR_names.concat(MAV_names))
}

// OSD, there are many params so match by prefix
setup_minimal_param("param_osd_general", ["OSD_*"])
for (let i = 1; i <= 4; i++) {
setup_minimal_param("param_osd_screen_" + i, ["OSD" + i + "_*"])
}
for (let i = 1; i <= 2; i++) {
setup_minimal_param("param_osd_param_screen_" + i, ["OSD" + (i + 4) + "_*"])
}


// Pos offsets plot setup
Sensor_Offset.data = []
Expand Down Expand Up @@ -3747,7 +3769,7 @@ function save_minimal_parameters() {
let inputs = document.forms["params"].getElementsByTagName("input");
for (let input of inputs) {
if (input.checked == false) {
skip_params.push(...input.getAttribute("data-params").split(','))
skip_params.push(...match_minimal_params(input.getAttribute("data-params").split(','), Object.keys(params)))
}
}

Expand Down
24 changes: 24 additions & 0 deletions HardwareReport/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,30 @@ <h4>Minimal Configuration</h4>
<input type="checkbox" id="param_stream_6">
<label for="param_stream_6">MAV 7</label>
</fieldset>

<fieldset style="width:600px">
<legend>OSD</legend>
<input type="checkbox" id="param_osd_general">
<label for="param_osd_general">General,</label>

<input type="checkbox" id="param_osd_screen_1">
<label for="param_osd_screen_1">Screen 1,</label>

<input type="checkbox" id="param_osd_screen_2">
<label for="param_osd_screen_2">Screen 2,</label>

<input type="checkbox" id="param_osd_screen_3">
<label for="param_osd_screen_3">Screen 3,</label>

<input type="checkbox" id="param_osd_screen_4">
<label for="param_osd_screen_4">Screen 4,</label>

<input type="checkbox" id="param_osd_param_screen_1">
<label for="param_osd_param_screen_1">Param 1,</label>

<input type="checkbox" id="param_osd_param_screen_2">
<label for="param_osd_param_screen_2">Param 2</label>
</fieldset>
</form>

<br>
Expand Down
Loading