From 9b02f5790fb4823d9e315d70dea31e54df5fb08a Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Tue, 13 Oct 2026 22:23:22 +0200 Subject: [PATCH 1/5] FilterReview: support up to four harmonic notches ArduPilot now supports a third harmonic notch, and a fourth on some boards (ArduPilot/ardupilot#30246). Add INS_HNTC3_* and INS_HNTC4_* to the notch parameters, their filters and plot tracking lines, and the logged notch frequencies for notches 3 and 4. The third and fourth notch inputs and show options are only shown if the log, or a loaded parameter file, has those parameters. Fixes #252 --- FilterReview/FilterReview.js | 69 ++++++++++++++++++------- FilterReview/index.html | 99 +++++++++++++++++++++++++++++++++++- 2 files changed, 147 insertions(+), 21 deletions(-) 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 Date: Sun, 8 Nov 2026 23:24:47 -0500 Subject: [PATCH 3/5] FilterReview: warn that notch 3 and 4 are not passed to Filter Tool Filter Tool only has two harmonic notches. --- FilterReview/FilterReview.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js index 2065156f..d390b995 100644 --- a/FilterReview/FilterReview.js +++ b/FilterReview/FilterReview.js @@ -1946,6 +1946,13 @@ function time_range_changed() { // build url and query string for current params and open filter tool in new window function open_in_filter_tool() { + // Filter Tool only has two harmonic notches + const extra_notches = [3, 4].filter((num) => (document.getElementById("Notch" + num + "Params").style.display != "none") && + (parseFloat(document.getElementById("INS_HNTC" + num + "_ENABLE").value) > 0)) + if (extra_notches.length > 0) { + alert("Filter Tool supports two harmonic notches, notch " + extra_notches.join(" and ") + " will not be included") + } + // Assume same base let url = new URL(window.location.href) url.pathname = url.pathname.replace('FilterReview','FilterTool') From c27ac689d1a47613bb0b30daa4ea016ac8918afe Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:19:40 -0500 Subject: [PATCH 4/5] FilterReview: open Filter Tool before warning about notch 3 and 4 A popup blocker can stop the window opening if the alert is left open. --- FilterReview/FilterReview.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js index d390b995..62ab5851 100644 --- a/FilterReview/FilterReview.js +++ b/FilterReview/FilterReview.js @@ -1949,9 +1949,6 @@ function open_in_filter_tool() { // Filter Tool only has two harmonic notches const extra_notches = [3, 4].filter((num) => (document.getElementById("Notch" + num + "Params").style.display != "none") && (parseFloat(document.getElementById("INS_HNTC" + num + "_ENABLE").value) > 0)) - if (extra_notches.length > 0) { - alert("Filter Tool supports two harmonic notches, notch " + extra_notches.join(" and ") + " will not be included") - } // Assume same base let url = new URL(window.location.href) @@ -2015,6 +2012,11 @@ function open_in_filter_tool() { window.open(url.toString()) + // Warn after opening, a popup blocker can stop the window opening if the alert is left open + if (extra_notches.length > 0) { + alert("Filter Tool supports two harmonic notches, notch " + extra_notches.join(" and ") + " will not be included") + } + } function save_parameters() { From c77f32f5bc2d660b325667894aaf14958aa6ff13 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Mon, 9 Nov 2026 07:27:00 -0500 Subject: [PATCH 5/5] FilterReview: only alert for an unsupported notch mode if the notch is enabled Notches 3 and 4 are reset to MODE 1 when the firmware lacks them, and logs with no throttle source alerted for each on every calculate. --- FilterReview/FilterReview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js index 62ab5851..4fc910ba 100644 --- a/FilterReview/FilterReview.js +++ b/FilterReview/FilterReview.js @@ -181,7 +181,7 @@ function HarmonicNotchFilter(params) { } } - if (this.tracking == null) { + if ((this.tracking == null) && (this.params.enable > 0)) { alert("Unsupported notch mode " + this.params.mode) }