1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-25 17:25:14 +03:00

MagHold Yaw rate limit UI

This commit is contained in:
Pawel Spychalski (DzikuVx) 2016-11-19 14:18:49 +01:00
parent 49e9416346
commit 4f3037e7cd
5 changed files with 58 additions and 13 deletions

View file

@ -793,6 +793,12 @@
"pidTuningYawRate": {
"message": "YAW rate"
},
"magHoldYawRate": {
"message": "MagHold rate"
},
"pidTuningMagHoldYawRateHelp": {
"message": "Maximum YAW rotation rate that MagHold controller can request from UAV. Used only when MagHold mode is enabled, during RTH and WAYPOINT navigation. Values below 30dps gives nice \"cinematic\" turns"
},
"pidTuningTPA": {
"message": "TPA"
},

View file

@ -1100,11 +1100,11 @@ var MSP = {
case MSP_codes.MSP_INAV_PID:
INAV_PID_CONFIG.asynchronousMode = data.getUint8(0);
INAV_PID_CONFIG.accelerometerTaskFrequency = data.getUint16(1);
INAV_PID_CONFIG.attitudeTaskFrequency = data.getUint16(3);
INAV_PID_CONFIG.accelerometerTaskFrequency = data.getUint16(1, true);
INAV_PID_CONFIG.attitudeTaskFrequency = data.getUint16(3, true);
INAV_PID_CONFIG.magHoldRateLimit = data.getUint8(5);
INAV_PID_CONFIG.magHoldErrorLpfFrequency = data.getUint8(6);
INAV_PID_CONFIG.yawJumpPreventionLimit = data.getUint16(7);
INAV_PID_CONFIG.yawJumpPreventionLimit = data.getUint16(7, true);
INAV_PID_CONFIG.gyroscopeLpf = data.getUint8(9);
INAV_PID_CONFIG.accSoftLpfHz = data.getUint8(10);
break;

View file

@ -378,3 +378,8 @@
.tab-pid_tuning .topspacer {
margin-top:15px;
}
.rate-tpa .helpicon {
top: 10px;
position: relative;
}

View file

@ -168,6 +168,13 @@
<input type="number" name="yaw" step="10" min="20" max="1800" /> degrees per second
</td>
</tr>
<tr class="requires-v1_4">
<th i18n="magHoldYawRate"></th>
<td >
<input type="number" id="magHoldYawRate" step="5" min="10" max="250" /> degrees per second
<div class="helpicon cf_tip" i18n_title="pidTuningMagHoldYawRateHelp"></div>
</td>
</tr>
</tbody>
</table>
<table class="rate-tpa rate-tpa--no-dps cf">

View file

@ -21,7 +21,16 @@ TABS.pid_tuning.initialize = function (callback) {
}
function get_rc_tuning_data() {
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, load_html);
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, loadINAVPidConfig);
}
function loadINAVPidConfig() {
var next_callback = load_html;
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
MSP.send_message(MSP_codes.MSP_INAV_PID, false, false, next_callback);
} else {
next_callback();
}
}
function load_html() {
@ -137,8 +146,8 @@ TABS.pid_tuning.initialize = function (callback) {
});
$('#resetPIDs').on('click', function(){
MSP.send_message(MSP_codes.MSP_SET_RESET_CURR_PID, false, false, false);
updateActivatedTab();
MSP.send_message(MSP_codes.MSP_SET_RESET_CURR_PID, false, false, false);
updateActivatedTab();
});
var i;
@ -155,18 +164,27 @@ TABS.pid_tuning.initialize = function (callback) {
var form_e = $('#pid-tuning');
if (semver.lt(CONFIG.apiVersion, "1.7.0")) {
$('.rate-tpa .tpa-breakpoint').hide();
$('.rate-tpa .roll').hide();
$('.rate-tpa .pitch').hide();
$('.rate-tpa--inav').hide();
} else if (FC.isRatesInDps()) {
if (FC.isRatesInDps()) {
$('.rate-tpa--no-dps').hide();
} else {
$('.rate-tpa .roll-pitch').hide();
$('.rate-tpa--inav').hide();
}
if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
var $magHoldYawRate = $("#magHoldYawRate");
$magHoldYawRate.val(INAV_PID_CONFIG.magHoldRateLimit);
$magHoldYawRate.change(function () {
INAV_PID_CONFIG.magHoldRateLimit = parseInt($magHoldYawRate.val(), 10);
});
$('.requires-v1_4').show();
} else {
$('.requires-v1_4').hide();
}
// UI Hooks
$('a.refresh').click(function () {
@ -185,7 +203,16 @@ TABS.pid_tuning.initialize = function (callback) {
}
function send_rc_tuning_changes() {
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom);
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, saveINAVPidConfig);
}
function saveINAVPidConfig() {
var next_callback = save_to_eeprom;
if(semver.gte(CONFIG.flightControllerVersion, "1.4.0")) {
MSP.send_message(MSP_codes.MSP_SET_INAV_PID, MSP.crunch(MSP_codes.MSP_SET_INAV_PID), false, next_callback);
} else {
next_callback();
}
}
function save_to_eeprom() {