Skip to content

Commit

Permalink
Disable video modes that are not in the firmware (#3767)
Browse files Browse the repository at this point in the history
* Hide unused OSD video mode

* Fixes per review

* Only apply to API 1.45 and up. Thanks nerdCopter

* Disallow cursor

* try colors
  • Loading branch information
haslinghuis authored Feb 4, 2024
1 parent da3a732 commit 5feb4ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/css/tabs/osd.less
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@
border: 1px solid var(--subtleAccent);
border-radius: 3px;
}
input[type="radio"]:disabled {
cursor: not-allowed;
}
select {
background: var(--boxBackground);
color: var(--defaultText);
Expand Down
15 changes: 13 additions & 2 deletions src/js/tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2780,10 +2780,21 @@ osd.initialize = function(callback) {
// video mode
const $videoTypes = $('.video-types').empty();
for (let i = 0; i < OSD.constants.VIDEO_TYPES.length; i++) {
// Disable SD or HD option depending on the build
let disabled = false;
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) && FC.CONFIG.buildOptions.length) {
if (OSD.constants.VIDEO_TYPES[i] !== 'HD' && !FC.CONFIG.buildOptions.includes('USE_OSD_SD')) {
disabled = true;
}
if (OSD.constants.VIDEO_TYPES[i] === 'HD' && !FC.CONFIG.buildOptions.includes('USE_OSD_HD')) {
disabled = true;
}
}
const type = OSD.constants.VIDEO_TYPES[i];
const videoFormatOptionText = i18n.getMessage(`osdSetupVideoFormatOption${inflection.camelize(type.toLowerCase())}`);
let videoFormatOptionText = i18n.getMessage(`osdSetupVideoFormatOption${inflection.camelize(type.toLowerCase())}`);
videoFormatOptionText = disabled ? `<span style="color:#AFAFAF">${videoFormatOptionText}</span>` : videoFormatOptionText;
const $checkbox = $('<label/>')
.append($(`<input name="video_system" type="radio"/>${videoFormatOptionText}</label>`)
.append($(`<input name="video_system" ${disabled ? 'disabled' : ''} type="radio"/>${videoFormatOptionText}</label>`)
.prop('checked', i === OSD.data.video_system)
.data('type', type)
.data('type', i),
Expand Down

0 comments on commit 5feb4ef

Please sign in to comment.