diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js index 9f0bdea5..015fbbcf 100644 --- a/FilterReview/FilterReview.js +++ b/FilterReview/FilterReview.js @@ -443,7 +443,7 @@ function reset() { } // Reset FFT plot notch selection - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num_notches; i++) { let check = document.getElementById("Notch" + (i+1) + "Show") check.disabled = true check.checked = false @@ -492,6 +492,8 @@ var fft_plot = {} var Bode = {} var flight_data = {} const max_num_harmonics = 16 +const num_notches = 4 +const notch_dash = ["solid", "dot", "dash", "dashdot"] function setup_plots() { const time_scale_label = "Time (s)" @@ -610,9 +612,9 @@ function setup_plots() { } // Add tracking lines - // Two harmonic notch filters each with upto 8 harmonics - for (let i=0;i<2;i++) { - let dash = (i == 0) ? "solid" : "dot" + // Harmonic notch filters each with upto 16 harmonics + for (let i=0;i" + name, - legendgroup: i+2, + legendgroup: i+num_notches, legendgrouptitle: { text: "" } }) } @@ -1581,7 +1583,7 @@ function redraw_Spectrogram() { for (let i=0;i document.getElementById(id).style.display != "none") + document.getElementById("ExtraNotches").style.display = any_shown ? "" : "none" +} + function load_filters() { filters = [] @@ -2031,6 +2046,14 @@ async function load_parameters(file) { } } + // Show the third and fourth notches if they are in the file + const HNotch_params = get_HNotch_param_names() + for (let i = 2; i < HNotch_params.length; i++) { + if (text.includes(HNotch_params[i].enable)) { + show_notch(i, true) + } + } + filter_param_read() re_calc() } @@ -2469,8 +2492,10 @@ async function load(log_file) { new RPMTarget(log, 2, 5)] // Load logged notch fequencies for comparison - logged_tracking = [ new LoggedNotch(log, 0), - new LoggedNotch(log, 1) ] + logged_tracking = [] + for (let i = 0; i < num_notches; i++) { + logged_tracking.push(new LoggedNotch(log, i)) + } // If log data is present allow user to show it let show_logged_notch = false @@ -2495,6 +2520,11 @@ async function load(log_file) { } } + // Only show the third and fourth notches if the firmware has them + for (let i = 2; i < HNotch_params.length; i++) { + show_notch(i, get_param(HNotch_params[i].enable) != null) + } + const other_params = ["INS_GYRO_FILTER", "SCHED_LOOP_RATE"] for (const param of other_params) { const value = get_param(param) @@ -2574,8 +2604,9 @@ async function load(log_file) { // Enable top level filter params parameter_set_disable("INS_GYRO_FILTER", false) parameter_set_disable("SCHED_LOOP_RATE", false) - parameter_set_disable("INS_HNTCH_ENABLE", false) - parameter_set_disable("INS_HNTC2_ENABLE", false) + for (const names of get_HNotch_param_names()) { + parameter_set_disable(names.enable, false) + } // Load filters from params filter_param_read() diff --git a/FilterReview/index.html b/FilterReview/index.html index caec117a..75fe7b66 100644 --- a/FilterReview/index.html +++ b/FilterReview/index.html @@ -380,7 +380,7 @@

IMU Spectrum -
+
Notch tracking IMU Spectrum + + + +
@@ -536,6 +546,81 @@

Filter Configuration + + + + + + +

IMU Spectrogram @@ -599,7 +684,7 @@

IMU Spectrogram

-
+
Notch tracking