From 19355e1984c684bb9b4354e42bd109fbf36ba707 Mon Sep 17 00:00:00 2001 From: Gary Keeble Date: Mon, 15 Aug 2016 10:14:55 +0100 Subject: [PATCH] Patch to fix incorrect notch width display Fix to stop notch center line width extending to frequency zero if user has not setup the notch filter. --- js/graph_spectrum.js | 16 ++++++---------- js/main.js | 2 +- manifest.json | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/js/graph_spectrum.js b/js/graph_spectrum.js index fcdd1fcf..17a703fd 100644 --- a/js/graph_spectrum.js +++ b/js/graph_spectrum.js @@ -239,16 +239,14 @@ try { if (mouseFrequency !=null) drawMarkerLine(mouseFrequency, PLOTTED_BLACKBOX_RATE, '', WIDTH, HEIGHT, (15*offset++) + MARGIN, "rgba(0,255,0,0.50)", 3); offset++; // make some space! if(flightLog.getSysConfig().gyro_lowpass_hz!=null) drawMarkerLine(flightLog.getSysConfig().gyro_lowpass_hz/100.0, PLOTTED_BLACKBOX_RATE, 'GYRO LPF cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN, "rgba(128,255,128,0.50)"); - if(flightLog.getSysConfig().gyro_notch_hz!=null) { - if(flightLog.getSysConfig().gyro_notch_hz > 0) { + if(flightLog.getSysConfig().gyro_notch_hz!=null && flightLog.getSysConfig().gyro_notch_cutoff!=null ) { + if(flightLog.getSysConfig().gyro_notch_hz > 0 && flightLog.getSysConfig().gyro_notch_cutoff > 0) { var gradient = canvasCtx.createLinearGradient(0,0,0,(HEIGHT)); gradient.addColorStop(1, 'rgba(128,255,128,0.10)'); gradient.addColorStop(0, 'rgba(128,255,128,0.35)'); drawMarkerLine(flightLog.getSysConfig().gyro_notch_hz/100.0, PLOTTED_BLACKBOX_RATE, null, WIDTH, HEIGHT, (15*offset) + MARGIN, gradient, (flightLog.getSysConfig().gyro_notch_hz - flightLog.getSysConfig().gyro_notch_cutoff)/100.0); drawMarkerLine(flightLog.getSysConfig().gyro_notch_hz/100.0, PLOTTED_BLACKBOX_RATE, 'GYRO notch center', WIDTH, HEIGHT, (15*offset++) + MARGIN, "rgba(128,255,128,0.50)"); // highlight the center - if(flightLog.getSysConfig().gyro_notch_cutoff!=null) { - drawMarkerLine(flightLog.getSysConfig().gyro_notch_cutoff/100.0, PLOTTED_BLACKBOX_RATE, 'GYRO notch cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN, "rgba(128,255,128,0.50)"); - } + drawMarkerLine(flightLog.getSysConfig().gyro_notch_cutoff/100.0, PLOTTED_BLACKBOX_RATE, 'GYRO notch cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN, "rgba(128,255,128,0.50)"); } } offset++; // make some space! @@ -256,16 +254,14 @@ try { if(flightLog.getSysConfig().yaw_lpf_hz!=null) drawMarkerLine(flightLog.getSysConfig().yaw_lpf_hz/100.0, PLOTTED_BLACKBOX_RATE, 'YAW LPF cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN); } else { if(flightLog.getSysConfig().dterm_lpf_hz!=null) drawMarkerLine(flightLog.getSysConfig().dterm_lpf_hz/100.0, PLOTTED_BLACKBOX_RATE, 'D-TERM LPF cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN); - if(flightLog.getSysConfig().dterm_notch_hz!=null) { - if(flightLog.getSysConfig().dterm_notch_hz > 0) { + if(flightLog.getSysConfig().dterm_notch_hz!=null && flightLog.getSysConfig().dterm_notch_cutoff!=null ) { + if(flightLog.getSysConfig().dterm_notch_hz > 0 && flightLog.getSysConfig().dterm_notch_cutoff > 0) { var gradient = canvasCtx.createLinearGradient(0,0,0,(HEIGHT)); gradient.addColorStop(1, 'rgba(128,128,255,0.10)'); gradient.addColorStop(0, 'rgba(128,128,255,0.35)'); drawMarkerLine(flightLog.getSysConfig().dterm_notch_hz/100.0, PLOTTED_BLACKBOX_RATE, null, WIDTH, HEIGHT, (15*offset) + MARGIN, gradient, (flightLog.getSysConfig().dterm_notch_hz - flightLog.getSysConfig().dterm_notch_cutoff)/100.0); drawMarkerLine(flightLog.getSysConfig().dterm_notch_hz/100.0, PLOTTED_BLACKBOX_RATE, 'D-TERM notch center', WIDTH, HEIGHT, (15*offset++) + MARGIN); // highlight the center - if(flightLog.getSysConfig().dterm_notch_cutoff!=null) { - drawMarkerLine(flightLog.getSysConfig().dterm_notch_cutoff/100.0, PLOTTED_BLACKBOX_RATE, 'D-TERM notch cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN); - } + drawMarkerLine(flightLog.getSysConfig().dterm_notch_cutoff/100.0, PLOTTED_BLACKBOX_RATE, 'D-TERM notch cutoff', WIDTH, HEIGHT, (15*offset++) + MARGIN); } } } diff --git a/js/main.js b/js/main.js index 9ab25068..c6cd64b7 100644 --- a/js/main.js +++ b/js/main.js @@ -3,7 +3,7 @@ // Global Level Variables var userSettings = {}; -var VIEWER_VERSION = '2.5.2'; // Current version +var VIEWER_VERSION = '2.5.3'; // Current version function BlackboxLogViewer() { function supportsRequiredAPIs() { diff --git a/manifest.json b/manifest.json index a4dcff84..34c372ab 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Betaflight - Blackbox Explorer", "description": "Interactive flight log viewer for Betaflight", - "version": "2.5.2", + "version": "2.5.3", "manifest_version": 2, "app": { "background": {