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": { "pidTuningYawRate": {
"message": "YAW rate" "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": { "pidTuningTPA": {
"message": "TPA" "message": "TPA"
}, },

View file

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

View file

@ -378,3 +378,8 @@
.tab-pid_tuning .topspacer { .tab-pid_tuning .topspacer {
margin-top:15px; 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 <input type="number" name="yaw" step="10" min="20" max="1800" /> degrees per second
</td> </td>
</tr> </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> </tbody>
</table> </table>
<table class="rate-tpa rate-tpa--no-dps cf"> <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() { 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() { function load_html() {
@ -137,8 +146,8 @@ TABS.pid_tuning.initialize = function (callback) {
}); });
$('#resetPIDs').on('click', function(){ $('#resetPIDs').on('click', function(){
MSP.send_message(MSP_codes.MSP_SET_RESET_CURR_PID, false, false, false); MSP.send_message(MSP_codes.MSP_SET_RESET_CURR_PID, false, false, false);
updateActivatedTab(); updateActivatedTab();
}); });
var i; var i;
@ -155,18 +164,27 @@ TABS.pid_tuning.initialize = function (callback) {
var form_e = $('#pid-tuning'); var form_e = $('#pid-tuning');
if (semver.lt(CONFIG.apiVersion, "1.7.0")) { if (FC.isRatesInDps()) {
$('.rate-tpa .tpa-breakpoint').hide();
$('.rate-tpa .roll').hide();
$('.rate-tpa .pitch').hide();
$('.rate-tpa--inav').hide();
} else if (FC.isRatesInDps()) {
$('.rate-tpa--no-dps').hide(); $('.rate-tpa--no-dps').hide();
} else { } else {
$('.rate-tpa .roll-pitch').hide(); $('.rate-tpa .roll-pitch').hide();
$('.rate-tpa--inav').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 // UI Hooks
$('a.refresh').click(function () { $('a.refresh').click(function () {
@ -185,7 +203,16 @@ TABS.pid_tuning.initialize = function (callback) {
} }
function send_rc_tuning_changes() { 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() { function save_to_eeprom() {