Skip to content

display new multi dynamic notch values properly in log header for 4.3 #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
40 changes: 17 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1229,32 +1229,26 @@ <h5 class="modal-title-craft"></h5>
</tr>

<tr class="dyn_filter_required">
<td name='dyn_notch_range'>
<label>Dyn Notch
<br>Range</label>
<select>
<!-- list generated here -->
</select>
</td>
<td name="dyn_notch_width_percent">
<label>Dyn Notch
<br>Width (percent)</label>
<input type="number" step="0.1" min="0" max="999.00" />
<thead>
<tr>
<th colspan="4">Dynamic notch filters</th>
</tr>
</thead>
<td name='dynNotchCount'>
<label>Count/Width</label>
<input type="number" step="1" min="0" max="10" />
</td>
<td name='dyn_notch_q'>
<label>Dyn Notch
<br>Q</label>
<input type="number" step="0.01" min="0" max="999.00" />
<td name="dynNotchBandwidthHz">
<label>Bandwidth/Q</label>
<input type="number" step="1" min="0" max="255" />
</td>
<td name="dyn_notch_min_hz">
<label>Dyn Notch
<br>Min (Hz)</label>
<input type="number" step="0.1" min="0" max="999.00" />
<td name="dynNotchMinHz">
<label>Min (Hz)</label>
<input type="number" step="1" min="0" max="999.00" />
</td>
<td name="dyn_notch_max_hz">
<label>Dyn Notch
<br>Max (Hz)</label>
<input type="number" step="0.1" min="0" max="999.00" />
<td name="dynNotchMaxHz">
<label>>Max (Hz)</label>
<input type="number" step="1" min="0" max="999.00" />
</td>
</tr>

Expand Down
7 changes: 0 additions & 7 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,6 @@ var
"SETPOINT",
]),

DYN_NOTCH_RANGE = makeReadOnly([
"HIGH",
"MEDIUM",
"LOW",
"AUTO",
]),

FLIGHT_LOG_DISARM_REASON = makeReadOnly([
"ARMING_DISABLED",
"FAILSAFE",
Expand Down
4 changes: 4 additions & 0 deletions js/flightlog_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ var FlightLogParser = function(logData) {
vbat_sag_compensation: null,
gyro_to_use: null,
dynamic_idle_min_rpm: null,
dyn_notch_count: null, // Number of dynamic notches 4.3
dyn_notch_bandwidth_hz: null, // Width of each notch filter in Hz 4.3
unknownHeaders : [] // Unknown Extra Headers
},

Expand Down Expand Up @@ -618,6 +620,8 @@ var FlightLogParser = function(logData) {
case "dyn_notch_range":
case "dyn_notch_width_percent":
case "dyn_notch_q":
case "dyn_notch_count":
case "dyn_notch_bandwidth_hz":
case "dyn_notch_min_hz":
case "dyn_notch_max_hz":
case "rates_type":
Expand Down
20 changes: 13 additions & 7 deletions js/header_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,17 @@ function HeaderDialog(dialog, onSave) {
{name:'iterm_relax_type' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'999.9.9'},
{name:'iterm_relax_cutoff' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'999.9.9'},
{name:'dyn_notch_range' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'4.1.7'},
{name:'dyn_notch_width_percent' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'999.9.9'},
{name:'dyn_notch_q' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'999.9.9'},
{name:'dyn_notch_width_percent' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'4.2.999'},
{name:'dyn_notch_q' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'4.2.999'},
{name:'dyn_notch_min_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.1.0', max:'999.9.9'},
{name:'dyn_notch_max_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.2.0', max:'999.9.9'},
{name:'rates_type' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.2.0', max:'999.9.9'},
{name:'fields_disabled_mask' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'vbat_sag_compensation' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'gyro_to_use' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'dynamic_idle_min_rpm' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'dyn_notch_count' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'dyn_notch_bandwidth_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
];

function isParameterValid(name) {
Expand Down Expand Up @@ -616,11 +618,15 @@ function HeaderDialog(dialog, onSave) {
setParameter('gyro_lowpass_hz' ,sysConfig.gyro_lowpass_hz,0);
setParameter('gyro_lowpass2_hz' ,sysConfig.gyro_lowpass2_hz,0);

renderSelect('dyn_notch_range' ,sysConfig.dyn_notch_range , DYN_NOTCH_RANGE);
setParameter('dyn_notch_width_percent' ,sysConfig.dyn_notch_width_percent, 0);
setParameter('dyn_notch_q' ,sysConfig.dyn_notch_q , 0);
setParameter('dyn_notch_min_hz' ,sysConfig.dyn_notch_min_hz , 0);
setParameter('dyn_notch_max_hz' ,sysConfig.dyn_notch_max_hz , 0);
if (activeSysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(activeSysConfig.firmwareVersion, '4.3.0')) {
setParameter('dynNotchCount' ,sysConfig.dyn_notch_count , 0);
setParameter('dynNotchBandwidthHz' ,sysConfig.dyn_notch_bandwidth_hz , 0);
} else {
setParameter('dynNotchCount' ,sysConfig.dyn_notch_width_percent, 0);
setParameter('dynNotchBandwidthHz' ,sysConfig.dyn_notch_q , 0);
}
setParameter('dynNotchMinHz' ,sysConfig.dyn_notch_min_hz , 0);
setParameter('dynNotchMaxHz' ,sysConfig.dyn_notch_max_hz , 0);

setParameter('gyro_rpm_notch_harmonics', sysConfig.gyro_rpm_notch_harmonics, 0);
setParameter('gyro_rpm_notch_q' , sysConfig.gyro_rpm_notch_q , 0);
Expand Down