From 778e8347595401eddbe7704d3a814ba6a84f172e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Fri, 3 Jan 2020 16:39:02 +0000 Subject: [PATCH] [OSD] Correctly detect devices compatible with MAX7456 fonts Use the flags added in https://github.com/betaflight/betaflight/pull/9333 to detect wether the font manager dialog should be shown. This fixes the that was preventing the Font Manager dialog to be shown when FrSky OSD was in use. --- src/js/tabs/osd.js | 14 ++++++++------ src/tabs/osd.html | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/js/tabs/osd.js b/src/js/tabs/osd.js index 78db4440..0a9207a8 100644 --- a/src/js/tabs/osd.js +++ b/src/js/tabs/osd.js @@ -1881,8 +1881,10 @@ OSD.msp = { d.state = {}; d.state.haveSomeOsd = (d.flags != 0) - d.state.haveMax7456Video = bit_check(d.flags, 4) || (d.flags == 1 && semver.lt(CONFIG.apiVersion, "1.34.0")); - d.state.isMax7456Detected = bit_check(d.flags, 5) || (d.state.haveMax7456Video && semver.lt(CONFIG.apiVersion, API_VERSION_1_43)); + d.state.haveMax7456Configured = bit_check(d.flags, 4) || (d.flags == 1 && semver.lt(CONFIG.apiVersion, "1.34.0")); + d.state.haveFrSkyOSDConfigured = semver.gte(CONFIG.apiVersion, API_VERSION_1_43) && bit_check(d.flags, 3); + d.state.haveMax7456FontDeviceConfigured = d.state.haveMax7456Configured || d.state.haveFrSkyOSDConfigured; + d.state.isMax7456FontDeviceDetected = bit_check(d.flags, 5) || (d.state.haveMax7456FontDeviceConfigured && semver.lt(CONFIG.apiVersion, API_VERSION_1_43)); d.state.haveOsdFeature = bit_check(d.flags, 0) || (d.flags == 1 && semver.lt(CONFIG.apiVersion, "1.34.0")); d.state.isOsdSlave = bit_check(d.flags, 1) && semver.gte(CONFIG.apiVersion, "1.34.0"); @@ -2258,7 +2260,7 @@ TABS.osd.initialize = function (callback) { OSD.msp.decode(info); - if (!OSD.data.state.haveMax7456Video || !OSD.data.state.isMax7456Detected) { + if (OSD.data.state.haveMax7456FontDeviceConfigured && !OSD.data.state.isMax7456FontDeviceDetected) { $('.noOsdChipDetect').show(); } @@ -2495,12 +2497,12 @@ TABS.osd.initialize = function (callback) { } } - if (!OSD.data.state.haveMax7456Video) { + if (!OSD.data.state.haveMax7456Configured) { $('.requires-max7456').hide(); } - if (!OSD.data.state.haveMax7456Video || !OSD.data.state.isMax7456Detected) { - $('.requires-detected-max7456').addClass('disabled'); + if (!OSD.data.state.isMax7456FontDeviceDetected || !OSD.data.state.haveMax7456FontDeviceConfigured) { + $('.requires-max7456-font-device-detected').addClass('disabled'); } if (!OSD.data.state.haveOsdFeature) { diff --git a/src/tabs/osd.html b/src/tabs/osd.html index 1053f89b..7c2af76d 100644 --- a/src/tabs/osd.html +++ b/src/tabs/osd.html @@ -202,7 +202,7 @@
- +