Skip to content

Commit

Permalink
Merge pull request #1974 from error414/release_7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MrD-RC authored Feb 22, 2024
2 parents 7d139d8 + ae09caf commit 841b05c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,12 @@ var mspHelper = (function (gui) {

var index = 0;

if(data.byteLength == 0){
OSD_CUSTOM_ELEMENTS.settings.customElementsCount = 0;
OSD_CUSTOM_ELEMENTS.settings.customElementTextSize = 0;
return;
}

OSD_CUSTOM_ELEMENTS.settings.customElementsCount = data.getUint8(index++);
OSD_CUSTOM_ELEMENTS.settings.customElementTextSize = data.getUint8(index++);

Expand Down
11 changes: 9 additions & 2 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,10 @@ OSD.reload = function(callback) {
});
});

MSP.send_message(MSPCodes.MSP2_INAV_CUSTOM_OSD_ELEMENTS);
if(semver.gte(CONFIG.flightControllerVersion, '7.1.0'))
{
MSP.send_message(MSPCodes.MSP2_INAV_CUSTOM_OSD_ELEMENTS);
}
};

OSD.updateSelectedLayout = function(new_layout) {
Expand Down Expand Up @@ -3384,13 +3387,16 @@ TABS.osd.initialize = function (callback) {
GUI.content_ready(callback);
});

mspHelper.loadOsdCustomElements(createCustomElements);
if(semver.gte(CONFIG.flightControllerVersion, '7.1.0')) {
mspHelper.loadOsdCustomElements(createCustomElements);
}
}));
};

function createCustomElements(){
if(OSD_CUSTOM_ELEMENTS.settings.customElementsCount == 0){
$('.custom-element-container').remove();
return;
}

var customElementsContainer = $('#osdCustomElements');
Expand Down Expand Up @@ -3602,6 +3608,7 @@ function customElementGetDataForRow(row){
switch (parseInt(elementVisibilityType.val())){
case 1:
visibilityValue = parseInt(valueVisibilityCell.find('.gv').find(':selected').val());
break;
case 2:
visibilityValue = parseInt(valueVisibilityCell.find('.lc').find(':selected').val());
break;
Expand Down

0 comments on commit 841b05c

Please sign in to comment.