Skip to content

Commit

Permalink
Patch to fix incorrect notch width display
Browse files Browse the repository at this point in the history
Fix to stop notch center line width extending to frequency zero if user
has not setup the notch filter.
  • Loading branch information
Gary Keeble authored and Gary Keeble committed Aug 15, 2016
1 parent 8621618 commit 19355e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions js/graph_spectrum.js
Expand Up @@ -239,33 +239,29 @@ 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!
if(isYawField) {
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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion 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": {
Expand Down

0 comments on commit 19355e1

Please sign in to comment.