Skip to content

Commit

Permalink
Merge pull request #2297 from breadoven/abo_fw_alt_cont_adj
Browse files Browse the repository at this point in the history
Fixed wing altitude control response setting support
  • Loading branch information
breadoven authored Jan 12, 2025
2 parents 95268b1 + 3627dc9 commit 103c924
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 29 deletions.
11 changes: 10 additions & 1 deletion locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"language_ja": {
"message": "日本語",
"_comment": "Don't translate!"
},
},
"language_zh_CN": {
"message": "简体中文",
"_comment": "Don't translate!"
Expand Down Expand Up @@ -2068,6 +2068,9 @@
"adjustmentsFunction59": {
"message": "Multi Mission Index Adjustment"
},
"adjustmentsFunction60": {
"message": "Fixed Wing Alt Control Response Adjustment"
},
"adjustmentsSave": {
"message": "Save"
},
Expand Down Expand Up @@ -3505,6 +3508,12 @@
"soarPitchDeadbandHelp": {
"message": "Pitch Angle deadband when soaring mode enabled (deg). Angle mode inactive within deadband allowing pitch to free float whilst soaring."
},
"altControlResponse": {
"message": "Altitude Control Response Factor"
},
"altControlResponseHelp": {
"message": "Adjusts the response of fixed wing altitude control as the target altitude is approached. Higher values will sharpen altitude control response but may also cause excessive overshoot or pitch instability if set too high."
},
"waypointRadiusHelp": {
"message": "This sets the distance away from a waypoint that triggers the waypoint as reached."
},
Expand Down
1 change: 1 addition & 0 deletions tabs/adjustments.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<option value="49" i18n="adjustmentsFunction49"></option> <!-- VEL Z P -->
<option value="50" i18n="adjustmentsFunction50"></option> <!-- VEL Z I -->
<option value="51" i18n="adjustmentsFunction51"></option> <!-- VEL Z D -->
<option value="60" i18n="adjustmentsFunction60"></option> <!-- FW Alt Cont Response -->
</optgroup>

<optgroup i18n_label="adjustmentsGroupMisc">
Expand Down
10 changes: 8 additions & 2 deletions tabs/advanced_tuning.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@
<div for="soarPitchDeadband" class="helpicon cf_tip" data-i18n_title="soarPitchDeadbandHelp"></div>
</div>

<div class="number">
<input type="number" id="altControlResponse" data-unit="deg" data-setting="nav_fw_alt_control_response" data-setting-multiplier="1" step="1" min="5" max="100" />
<label for="altControlResponse"><span data-i18n="altControlResponse"></span></label>
<div for="altControlResponse" class="helpicon cf_tip" data-i18n_title="altControlResponseHelp"></div>
</div>

</div>
</div>
</div>
Expand Down Expand Up @@ -509,7 +515,7 @@
<label for="fsMissionDelay"><span data-i18n="fsMissionDelay"></span></label>
<div for="fsMissionDelay" class="helpicon cf_tip" data-i18n_title="fsMissionDelayHelp"></div>
</div>
<!--
<!--
<div class="checkbox">
<input type="checkbox" class="toggle update_preview" id="drNavigation" data-setting="inav_allow_dead_reckoning" data-live="true" />
<label for="drNavigation"><span data-i18n="drNavigation"></span></label>
Expand Down Expand Up @@ -557,7 +563,7 @@
<select id="geozoneNoWayHomeAction" data-setting="geozone_no_way_home_action"></select>
<label for="geozoneNoWayHomeAction"><span data-i18n="geozoneNoWayHomeAction"></span></label>
<div for="geozoneNoWayHomeAction" class="helpicon cf_tip" data-i18n_title="geozoneNoWayHomeActionHelp"></div>
</div>
</div>
</div>
</div>

Expand Down
57 changes: 31 additions & 26 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ FONT.parseMCMFontFile = function (data) {
FONT.openFontFile = function ($preview) {
return new Promise(function (resolve) {
var options = {
filters: [
filters: [
{ name: 'Font file', extensions: ['mcm'] }
],
};
Expand All @@ -271,7 +271,7 @@ FONT.openFontFile = function ($preview) {
console.log('No file selected');
return;
}

if (result.filePaths.length == 1) {
const fontData = fs.readFileSync(result.filePaths[0], {flag: "r"});
FONT.parseMCMFontFile(fontData.toString());
Expand Down Expand Up @@ -2227,6 +2227,11 @@ OSD.constants = {
id: 139,
preview: 'WP NO 7'
},
{
name: 'FW_ALT_CONTROL_RESPONSE',
id: 166,
preview: 'ACR 40'
},
]
},
{
Expand Down Expand Up @@ -3447,7 +3452,7 @@ HARDWARE.update = function(callback) {
callback();
}
});
});
});
});
};

Expand All @@ -3472,10 +3477,10 @@ TABS.osd.initialize = function (callback) {
GUI.load(path.join(__dirname, "osd.html"), Settings.processHtml(function () {
// translate to user-selected language
i18n.localize();

// Open modal window
OSD.GUI.jbox = new jBox('Modal', {
width: 750,
width: 750,
height: 300,
position: {y:'bottom'},
offset: {y:-50},
Expand All @@ -3485,13 +3490,13 @@ TABS.osd.initialize = function (callback) {
title: 'OSD Font Manager',
content: $('#fontmanagercontent')
});

$('a.save').on('click', function () {
Settings.saveInputs(save_to_eeprom);
});

// Initialise guides checkbox
isGuidesChecked = store.get('showOSDGuides', false);
isGuidesChecked = store.get('showOSDGuides', false);

// Setup switch indicators
$(".osdSwitchInd_channel option").each(function() {
Expand All @@ -3517,18 +3522,18 @@ TABS.osd.initialize = function (callback) {
$("#switchIndicators_alignLeft").on('change', function() {
refreshOSDSwitchIndicators();
});

// Functions for when pan servo settings change
$('#osdPanServoIndicatorShowDegrees').on('change', function() {
// Update the OSD preview
updatePanServoPreview();
});

$('#panServoOutput').on('change', function() {
// Update the OSD preview
updatePanServoPreview();
});

// Function for when text for craft name changes
$('#craft_name').on('keyup', function() {
// Make sure that the craft name only contains A to Z, 0-9, spaces, and basic ASCII symbols
Expand All @@ -3539,11 +3544,11 @@ TABS.osd.initialize = function (callback) {
} else {
$(this).val(testText.slice(0, -1));
}

// Update the OSD preview
updatePilotAndCraftNames();
});

$('#pilot_name').on('keyup', function() {
// Make sure that the pilot name only contains A to Z, 0-9, spaces, and basic ASCII symbols
let testExp = new RegExp('^[A-Za-z0-9 !_,:;=@#\\%\\&\\-\\*\\^\\(\\)\\.\\+\\<\\>\\[\\]]');
Expand All @@ -3553,17 +3558,17 @@ TABS.osd.initialize = function (callback) {
} else {
$(this).val(testText.slice(0, -1));
}

// Update the OSD preview
updatePilotAndCraftNames();
});

// font preview window
var $preview = $('.font-preview');

// init structs once, also clears current font
FONT.initData();

var $fontPicker = $('.fontbuttons button');
$fontPicker.on('click', function () {
if (!$(this).data('font-file')) {
Expand All @@ -3578,30 +3583,30 @@ TABS.osd.initialize = function (callback) {
});
store.set('osd_font', $(this).data('font-file'));
});

// load the last selected font when we change tabs
var osd_font = store.get('osd_font', false);
var previous_font_button;
if (osd_font) {
previous_font_button = $('.fontbuttons button[data-font-file="' + osd_font + '"]');
if (previous_font_button.attr('data-font-file') == undefined) previous_font_button = undefined;
}

if (typeof previous_font_button == "undefined") {
$fontPicker.first().trigger( "click" );
} else {
previous_font_button.trigger( "click" );
}


$('button.load_font_file').on('click', function () {
$fontPicker.removeClass('active');
FONT.openFontFile().then(function () {
FONT.preview($preview);
OSD.GUI.update();
});
});

// font upload
$('a.flash_font').on('click', function () {
if (!GUI.connect_lock) { // button disabled while flashing is in progress
Expand All @@ -3620,7 +3625,7 @@ TABS.osd.initialize = function (callback) {
FONT.upload(progressCallback);
}
});

$('.update_preview').on('change', function () {
if (OSD.data) {
// Force an OSD redraw by saving any element
Expand All @@ -3633,11 +3638,11 @@ TABS.osd.initialize = function (callback) {
}, 100);
}
});

$('#useCraftnameForMessages').on('change', function() {
OSD.GUI.updateDjiMessageElements(this.checked);
});

if(semver.gte(FC.CONFIG.flightControllerVersion, '7.1.0')) {
mspHelper.loadOsdCustomElements(createCustomElements);
}
Expand All @@ -3664,7 +3669,7 @@ function createCustomElements(){
var customElementTable = $('<table>').addClass('osdCustomElement_main_table');
var customElementRowType = $('<tr>').data('row', i);
var customElementRowValue = $('<tr>').data('row', i);

var customElementLabel = $('<tr>');
customElementLabel.append($('<td>').attr('colspan', 2).append($('<span>').html(i18n.getMessage("custom_element") + ' ' + (i + 1))));

Expand Down

0 comments on commit 103c924

Please sign in to comment.