Skip to content

support firmware rpm filter name changes, minor cleanups #532

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
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
78 changes: 47 additions & 31 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1205,23 +1205,22 @@ <h5 class="modal-title-craft"></h5>
<tbody>
<tr>
<td name='gyro_soft_dyn_type' colspan="2">
<label>Lowpass Dyn Filter<br>Type 1</label>
<label>Lowpass Dyn Filter<br>Type</label>
<select>
<!-- list generated here -->
</select>
</td>
</tr>

<tr>
<td name="gyro_soft_dyn_min_hz">
<label>Lowpass Dyn Filter<br>Min Cutoff 1 (Hz)</label>
<label>Lowpass Dyn Filter<br>Min Cutoff (Hz)</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
<td name="gyro_soft_dyn_max_hz">
<label>Lowpass Dyn Filter<br>Max Cutoff 1 (Hz)</label>
<label>Lowpass Dyn Filter<br>Max Cutoff (Hz)</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
</tr>

<tr>
<td name='gyro_soft_type'>
<label>Lowpass Filter<br>Type 1</label>
<select>
Expand All @@ -1243,6 +1242,7 @@ <h5 class="modal-title-craft"></h5>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
</tr>

<tr>
<td name='gyro_notch_hz'>
<label>Notch 1
Expand Down Expand Up @@ -1271,7 +1271,7 @@ <h5 class="modal-title-craft"></h5>
<tr>
<th scope="row" colspan="4">Dynamic notch filters</th>
</tr>
</thead>
</thead>
<td name='dynNotchCount'>
<label>Count/Width</label>
<input type="number" step="1" min="0" max="10" />
Expand All @@ -1289,32 +1289,42 @@ <h5 class="modal-title-craft"></h5>
<input type="number" step="1" min="0" max="999.00" />
</td>
</tr>
</tbody>
</table>

<tr class='dshot_bidir_required'>
<table class="parameter cf">
<thead>
<tr>
<th colspan="5">RPM filters</th>
</tr>
</thead>
<tbody>
<tr class="dshot_bidir_required">
<thead>
<td name='gyro_rpm_notch_harmonics'>
<label>RPM Notch
<br>Harmonics</label>
<label>Harmonics</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
<td name="gyro_rpm_notch_q">
<label>RPM Notch
<br>Q</label>
<label>Q</label>
<input type="number" step="0.1" min="0" max="999.00" />
</td>
<td name='gyro_rpm_notch_min'>
<label>RPM Notch
<br>Min(Hz)</label>
<label>Min(Hz)</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
<td name='rpm_filter_fade_range_hz'>
<label>Fade Range</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
<td name='rpm_notch_lpf'>
<label>RPM Notch
<br>Lpf</label>
<label>Lowpass</label>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
</tr>

</tbody>
</table>

<table class="parameter cf">
<thead>
<tr>
Expand Down Expand Up @@ -1383,8 +1393,11 @@ <h5 class="modal-title-craft"></h5>
<input type="number" step="0.1" min="0" max="999.00" />
</td>
</tr>

<tr class='dshot_bidir_required'>
</tbody>
</table>
<table class="parameter cf">
<tbody>
<tr class="dshot_bidir_required">
<td name='dterm_rpm_notch_harmonics'>
<label>RPM Notch
<br>Harmonics</label>
Expand All @@ -1401,7 +1414,6 @@ <h5 class="modal-title-craft"></h5>
<input type="number" step="0.01" min="0" max="999.00" />
</td>
</tr>

</tbody>
</table>
<table class="parameter cf">
Expand Down Expand Up @@ -1828,7 +1840,20 @@ <h5 class="modal-title-craft"></h5>
<!-- list generated here -->
</select>
</td>

</tr>
</tbody>
</table>
<table class="parameter cf">
<tbody>
<tr>
<td name="motorOutputLow">
<label>D-Shot Motor Low</label>
<input type="number" step="10" min="0" max="2047" />
</td>
<td name="motorOutputHigh">
<label>D-Shot Motor High</label>
<input type="number" step="10" min="0" max="2047" />
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -1879,18 +1904,9 @@ <h5 class="modal-title-craft"></h5>
</tr>
</tbody>
</table>

<table class="parameter cf">
<tbody>
<tr>
<td name="motorOutputLow">
<label>D-Shot Motor Low</label>
<input type="number" step="10" min="0" max="2047" />
</td>
<td name="motorOutputHigh">
<label>D-Shot Motor High</label>
<input type="number" step="10" min="0" max="2047" />
</td>
</tr>
<tr>
<td name="digitalIdleOffset">
<label>D-Shot Offset (%)</label>
Expand Down
17 changes: 12 additions & 5 deletions js/flightlog_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ var FlightLogParser = function(logData) {
deviceUID: null
},

// These are now part of the blackbox log header, but they are in addition to the standard logger.
// each name should match a field in blackbox.c of the current firmware
// Blackbox log header parameter names.
// each name should exist in the blackbox log of the current firmware, or
// be an older name which is translated into a current name in the table below

defaultSysConfigExtension = {
abs_control_gain:null, // Aboslute control gain
Expand Down Expand Up @@ -252,6 +253,7 @@ var FlightLogParser = function(logData) {
gyro_rpm_notch_q:null, // Value of Q in the gyro rpm filter
gyro_rpm_notch_min:null, // Min Hz for the gyro rpm filter
rpm_notch_lpf:null, // Cutoff for smoothing rpm filter data
rpm_filter_fade_range_hz:null, // RPM filter fade range in hz above the min hz
dterm_rpm_notch_harmonics:null, // Number of Harmonics in the dterm rpm filter
dterm_rpm_notch_q:null, // Value of Q in the dterm rpm filter
dterm_rpm_notch_min:null, // Min Hz for the dterm rpm filter
Expand Down Expand Up @@ -326,8 +328,8 @@ var FlightLogParser = function(logData) {
},

// Translation of the field values name to the sysConfig var where it must be stored
// on the left are field names from older versions of blackbox.c
// on the right are names from the list above
// on the left are field names from the latest versions of blackbox.c
// on the right are older field names that must exist in the list above

translationValues = {
acc_limit_yaw : "yawRateAccelLimit",
Expand Down Expand Up @@ -373,7 +375,11 @@ var FlightLogParser = function(logData) {
feedforward_transition : "ff_transition",
feedforward_weight : "ff_weight",
rc_smoothing_auto_factor : "rc_smoothing_auto_factor_setpoint",
rc_smoothing_type : "rc_smoothing_mode"
rc_smoothing_type : "rc_smoothing_mode",
rpm_filter_harmonics : "gyro_rpm_notch_harmonics",
rpm_filter_q : "gyro_rpm_notch_q",
rpm_filter_min_hz : "gyro_rpm_notch_min",
rpm_filter_lpf_hz : "rpm_notch_lpf"
},

frameTypes,
Expand Down Expand Up @@ -641,6 +647,7 @@ var FlightLogParser = function(logData) {
case "gyro_rpm_notch_q":
case "gyro_rpm_notch_min":
case "rpm_notch_lpf":
case "rpm_filter_fade_range_hz":
case "dterm_rpm_notch_harmonics":
case "dterm_rpm_notch_q":
case "dterm_rpm_notch_min":
Expand Down
33 changes: 19 additions & 14 deletions js/header_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function HeaderDialog(dialog, onSave) {
{name:'rc_smoothing_active_cutoffs_sp', type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
{name:'rc_smoothing_active_cutoffs_thr', 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:'rpm_filter_fade_range_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'}
];

function isParameterValid(name) {
Expand Down Expand Up @@ -626,22 +627,26 @@ function HeaderDialog(dialog, onSave) {
setParameter('gyro_lowpass2_hz' ,sysConfig.gyro_lowpass2_hz,0);

if (activeSysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(activeSysConfig.firmwareVersion, '4.3.0')) {
setParameter('dynNotchCount' ,sysConfig.dyn_notch_count , 0);
setParameter('dynNotchCount' ,sysConfig.dyn_notch_count,0);
} else {
setParameter('dynNotchCount' ,sysConfig.dyn_notch_width_percent, 0);
setParameter('dynNotchCount' ,sysConfig.dyn_notch_width_percent,0);
}
setParameter('dynNotchQ' ,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);
setParameter('gyro_rpm_notch_min' , sysConfig.gyro_rpm_notch_min , 0);
setParameter('rpm_notch_lpf' , sysConfig.rpm_notch_lpf , 0);

setParameter('dterm_rpm_notch_harmonics', sysConfig.dterm_rpm_notch_harmonics, 0);
setParameter('dterm_rpm_notch_q' , sysConfig.dterm_rpm_notch_q , 0);
setParameter('dterm_rpm_notch_min' , sysConfig.dterm_rpm_notch_min , 0);
setParameter('dynNotchQ' ,sysConfig.dyn_notch_q,0);
Copy link
Member

@haslinghuis haslinghuis Sep 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma space please (everywhere)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's 'hit and miss' throughout the document, most lines are ,0); and some are 0);.
I can make them consistent but it will change hundreds of lines :-)

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);
setParameter('gyro_rpm_notch_min' ,sysConfig.gyro_rpm_notch_min,0);
setParameter('rpm_notch_lpf' ,sysConfig.rpm_notch_lpf,0);
if(activeSysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(activeSysConfig.firmwareVersion, '4.3.0')) {
setParameter('rpm_filter_fade_range_hz' ,sysConfig.rpm_filter_fade_range_hz ,0);
} else {
setParameter('rpm_filter_fade_range_hz' ,"0",0);
}
setParameter('dterm_rpm_notch_harmonics',sysConfig.dterm_rpm_notch_harmonics,0);
setParameter('dterm_rpm_notch_q' ,sysConfig.dterm_rpm_notch_q,0);
setParameter('dterm_rpm_notch_min' ,sysConfig.dterm_rpm_notch_min,0);

$('.dshot_bidir_required').toggle(sysConfig.dshot_bidir == 1);

Expand Down