Skip to content

Commit

Permalink
Add missing fields for 3.1 and reorganise PID other
Browse files Browse the repository at this point in the history
  • Loading branch information
borisbstyle committed Mar 1, 2017
1 parent 36c045e commit 698345d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
Empty file added P-Term
Empty file.
46 changes: 21 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,24 @@ <h5 class="modal-title-craft"></h5>
<div class="gui_box_titlebar">
<div class="spacer_box_title">PID Other</div>
</div>
<div class="spacer_box">
<table class="parameter cf">
<tbody>
<tr>
<td name="ptermSRateWeight" class="bf-only"><label>P-Term<br>&nbsp;</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="setpointRelaxRatio" class="bf-only"><label>Setpoint Relax<br>Ratio</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="dtermSetpointWeight" class="bf-only"><label>D-Term Setpoint<br>Weight</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="rateAccelLimit" class="bf-only"><label>Roll/Pitch Rate<br>Acceleration Limit</label><input type="number" step="1" min="0" max="999" /></td>
<td name="yawRateAccelLimit" class="bf-only"><label>Yaw Rate<br>Acceleration Limit</label><input type="number" step="1" min="0" max="999" /></td>
</tr>
<tr>
<td name="antiGravityGain" class="bf-only"><label>AG Gain</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="antiGravityThreshold" class="bf-only"><label>AG Threshold</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="itermWindupPointPercent" class="bf-only"><label>Windup Threshold</label><input type="number" step="1" min="0" max="999" /></td>
</tr>
</tbody>
</table>
</div>
<div class="spacer_box">
<table class="no-inav parameter cf">
<tbody>
Expand All @@ -741,13 +759,13 @@ <h5 class="modal-title-craft"></h5>
</tbody>
</table>
<table class="parameter cf">
<thead>
<thead class="BFPIDController">
<tr>
<th colspan="2">P-Term</th>
<th class="bf-only" colspan="2">I-Term</th>
</tr>
</thead>
<tbody>
<tbody class="BFPIDController">
<tr>
<td name='dynamic_pterm' class="bf-only"><label>Dynamic P</label><select><!-- list generated here --></select></td>
<td name="yaw_p_limit"><label>Yaw Limit</label><input type="number" step="1" min="0" max="999" /></td>
Expand All @@ -757,36 +775,14 @@ <h5 class="modal-title-craft"></h5>
<td name="yawItermIgnoreRate" class="bf-only"><label>Yaw Ignore Rate</label><input type="number" step="1" min="0" max="999" /></td>
</tr>
</tbody>
<tbody>
<tbody class="BFPIDController">
<tr>
<td></td>
<td name="iterm_reset_offset" class="bf-only"><label>Reset Offset</label><input type="number" step="1" min="0" max="999" /></td>
</tr>
</tbody>
</table>
</div>
<div class="spacer_box">
<table class="parameter cf">
<thead class="BFPIDController">
<tr>
<th colspan="5">Betaflight PID Controller</th>
</tr>
</thead>
<tbody>
<tr>
<td name="ptermSRateWeight" class="bf-only"><label>P-Term<br>&nbsp;</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="setpointRelaxRatio" class="bf-only"><label>Setpoint Relax<br>Ratio</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="dtermSetpointWeight" class="bf-only"><label>D-Term Setpoint<br>Weight</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="rateAccelLimit" class="bf-only"><label>Roll/Pitch Rate<br>Acceleration Limit</label><input type="number" step="1" min="0" max="999" /></td>
<td name="yawRateAccelLimit" class="bf-only"><label>Yaw Rate<br>Acceleration Limit</label><input type="number" step="1" min="0" max="999" /></td>
</tr>
<tr>
<td name="itermThrottleGain" class="bf-only"><label>I-Term Throttle Gain</label><input type="number" step="0.01" min="0" max="999" /></td>
<td name="itermThrottleThreshold" class="bf-only"><label>I-Term Throttle Threshold</label><input type="number" step="0.01" min="0" max="999" /></td>
</tr>
</tbody>
</table>
</div>
<div class="spacer_box">
<table class="bf-only" cellpadding="0" cellspacing="0">
<tbody class="static-features noline">
Expand Down
5 changes: 3 additions & 2 deletions js/flightlog_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ var FlightLogParser = function(logData) {
case "acc_1G":
case "dterm_filter_type":
case "pidAtMinThrottle":
case "itermThrottleGain":
case "itermThrottleThreshold":
case "anti_gravity_threshold":
case "itermWindupPointPercent":
case "ptermSRateWeight":
case "setpointRelaxRatio":
case "dtermSetpointWeight":
Expand All @@ -477,6 +477,7 @@ var FlightLogParser = function(logData) {

case "yawRateAccelLimit":
case "rateAccelLimit":
case "anti_gravity_gain":
if(that.sysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(that.sysConfig.firmwareVersion, '3.1.0')) {
that.sysConfig[fieldName] = uint32ToFloat(fieldValue, 10);
} else {
Expand Down
14 changes: 8 additions & 6 deletions js/header_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function HeaderDialog(dialog, onSave) {
{name:'dynamic_pid' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'2.9.9'},
{name:'rcYawRate' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'999.9.9'},
{name:'airmode_activate_throttle' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'999.9.9'},
{name:'rollPitchItermIgnoreRate' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'999.9.9'},
{name:'yawItermIgnoreRate' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'999.9.9'},
{name:'rollPitchItermIgnoreRate' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'3.0.1'},
{name:'yawItermIgnoreRate' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'2.8.0', max:'3.0.1'},
{name:'gyro_notch_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.0.0', max:'999.9.9'},
{name:'gyro_notch_cutoff' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.0.0', max:'999.9.9'},
{name:'dterm_notch_hz' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.0.0', max:'999.9.9'},
Expand Down Expand Up @@ -56,8 +56,9 @@ function HeaderDialog(dialog, onSave) {
{name:'motorOutputHigh' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'},
{name:'digitalIdleOffset' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'},
{name:'setpointRelaxRatio' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'},
{name:'itermThrottleThreshold' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'}

{name:'antiGravityGain' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'},
{name:'antiGravityThreshold' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'},
{name:'itermWindupPointPercent' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'3.1.0', max:'999.9.9'}
];

function isParameterValid(name) {
Expand Down Expand Up @@ -461,6 +462,7 @@ function HeaderDialog(dialog, onSave) {
setParameter('yawItermResetRate' ,sysConfig.yawItermResetRate,0);
setParameter('rollPitchItermIgnoreRate' ,sysConfig.rollPitchItermIgnoreRate,0);
setParameter('yawItermIgnoreRate' ,sysConfig.yawItermIgnoreRate,0);
setParameter('itermWindupPointPercent' ,sysConfig.itermWindupPointPercent,0);
setParameter('dterm_cut_hz' ,sysConfig.dterm_cut_hz,2);
setParameter('iterm_reset_offset' ,sysConfig.iterm_reset_offset,0);
setParameter('deadband' ,sysConfig.deadband,0);
Expand Down Expand Up @@ -496,7 +498,6 @@ function HeaderDialog(dialog, onSave) {
renderSelect('fast_pwm_protocol' ,sysConfig.fast_pwm_protocol, FAST_PROTOCOL);
setParameter('motor_pwm_rate' ,sysConfig.motor_pwm_rate,0);
renderSelect('dterm_filter_type' ,sysConfig.dterm_filter_type, FILTER_TYPE);
setParameter('itermThrottleGain' ,sysConfig.itermThrottleGain,2);
setParameter('ptermSRateWeight' ,sysConfig.ptermSRateWeight,2);
setParameter('dtermSetpointWeight' ,sysConfig.dtermSetpointWeight,2);
if(activeSysConfig.firmwareType == FIRMWARE_TYPE_BETAFLIGHT && semver.gte(activeSysConfig.firmwareVersion, '3.1.0')) {
Expand All @@ -511,7 +512,8 @@ function HeaderDialog(dialog, onSave) {
setParameter('motorOutputLow' ,sysConfig.motorOutput[0],0);
setParameter('motorOutputHigh' ,sysConfig.motorOutput[1],0);
setParameter('digitalIdleOffset' ,sysConfig.digitalIdleOffset,2);
setParameter('itermThrottleThreshold' ,sysConfig.itermThrottleThreshold,0);
setParameter('antiGravityGain' ,sysConfig.anti_gravity_gain,0);
setParameter('antiGravityThreshold' ,sysConfig.anti_gravity_threshold,0);
setParameter('setpointRelaxRatio' ,sysConfig.setpointRelaxRatio,2);

/* Packed Flags */
Expand Down

0 comments on commit 698345d

Please sign in to comment.