diff --git a/locales/en/messages.json b/locales/en/messages.json index b3a33b23ad..77ecdaacc1 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -895,6 +895,9 @@ "initialSetupCpuTemp": { "message": "CPU Temperature:" }, + "initialSetupCpuTempNotSupported": { + "message": "No support from MSP API before 1.46" + }, "initialSetupRSSI": { "message": "RSSI:" }, @@ -1088,8 +1091,8 @@ "initialSetupInfoBuild": { "message": "Firmware info" }, - "initialSetupInfoBuildHelp": { - "message": "Shows information regarding the build of firmware. The Build Config and Bulid Log links to the cloud information found by the Build key", + "initialSetupInfoFirmwareHelp": { + "message": "Shows information for firmware Build, require online to Build server.
Options show Defined options used in Cloud Build.
Log and Config links show cloud information by key stored in firmware.
At local Build, section are empty.", "description": "Message that pops up to describe the Build / Firmware section" }, "initialSetupInfoBuildDate": { @@ -1101,20 +1104,20 @@ "initialSetupInfoBuildInfoKey": { "message": "Build key" }, - "initialSetupInfoBuildInfoConfig": { + "initialSetupInfoBuildConfig": { "message": "Config" }, - "initialSetupInfoBuildInfoLog": { + "initialSetupInfoBuildLog": { "message": "Log" }, "initialSetupInfoBuildOptions": { - "message": "Build Options:" + "message": "Options" }, - "initialSetupInfoBuildOptionsList": { - "message": "Defines used" + "initialSetupInfoBuildOptionList": { + "message": "Options defined in firmware build" }, - "initialSetupInfoBuildOptionsEmpty": { - "message": "Local Build - no Defines used" + "initialSetupInfoBuildEmpty": { + "message": "Local Build - no Cloud information" }, "initialSetupNotOnline": { "message": "Server unavailable" diff --git a/src/css/dark-theme.less b/src/css/dark-theme.less index 48b577c445..5676579e57 100644 --- a/src/css/dark-theme.less +++ b/src/css/dark-theme.less @@ -467,7 +467,7 @@ progress[value] { } .z { background-color: #CB4B4B; - } + } } .motorblock { background-color: #393b3a; @@ -942,6 +942,9 @@ progress[value] { .attitude_info { color: white; } + .dialogBuildInfo { + background-color: #575757; + } } .tab-transponder { .text { diff --git a/src/css/tabs/setup.less b/src/css/tabs/setup.less index 78a6500871..af1e2680ca 100644 --- a/src/css/tabs/setup.less +++ b/src/css/tabs/setup.less @@ -1,5 +1,5 @@ .tab-setup { - .ui-grid-col { + .ui-grid-col { margin-bottom: 0; } .content_wrapper { @@ -98,7 +98,7 @@ opacity: 0.5; } dialog { - width: 40em; + width: min-content; border-radius: 5px; .buttons { position: static; @@ -171,6 +171,26 @@ float: left; } } +.dialogBuildInfo { + transition: all 0.2s; + overflow-x: hidden; + overflow-y: auto; + background-color: white; + width: min-content; + height: min-content; +} +.dialogBuildInfo-closebtn { + float: right; +} +.dialogBuildInfoGrid-container { + display: grid; + grid-template-columns: auto auto; + grid-gap: 5px; +} +.dialogBuildInfoGrid-item { + padding: 5px 5px 3px 5px; + user-select: text; +} .block.info { .fields { padding: 5px 5px 3px 5px; diff --git a/src/js/tabs/setup.js b/src/js/tabs/setup.js index 401885d8c6..1c5cf79c13 100644 --- a/src/js/tabs/setup.js +++ b/src/js/tabs/setup.js @@ -208,8 +208,7 @@ setup.initialize = function (callback) { // Firmware info msp_api_e = $('.api-version'), build_date_e = $('.build-date'), - build_info_e = $('.build-info'), - build_opt_e = $('.build-options'); + build_info_e = $('.build-info'); // DISARM FLAGS // We add all the arming/disarming flags available, and show/hide them if needed. @@ -417,35 +416,63 @@ setup.initialize = function (callback) { } }; + function showDialogBuildInfo(title, message) { + const dialog = $('.dialogBuildInfo')[0]; + + $('.dialogBuildInfo-title').html(title); + $('.dialogBuildInfo-content').html(message); + + if ( ! dialog.hasAttribute('open')) { + dialog.showModal(); + $('.dialogBuildInfo-closebtn').on('click', function() { + dialog.close(); + }); + } + } + const showFirmwareInfo = function() { // Firmware info msp_api_e.text([FC.CONFIG.apiVersion]); build_date_e.text([FC.CONFIG.buildInfo]); - if (FC.CONFIG.buildKey.length === 32) { - const buildRoot = `https://build.betaflight.com/api/builds/${FC.CONFIG.buildKey}`; - const buildConfig = ` - ${i18n.getMessage('initialSetupInfoBuildInfoConfig')}`; - const buildLog = ` - ${i18n.getMessage('initialSetupInfoBuildInfoLog')}`; - build_info_e.html(`${buildConfig}     ${buildLog}`); - $('.build-info a').removeClass('disabled'); - } else { - $('.build-info a').addClass('disabled'); - } + if (navigator.onLine) { + let buildOptionList = ""; - if (FC.CONFIG.buildOptions.length) { - let buildOptions = ""; - build_opt_e.text = ""; + if (FC.CONFIG.buildOptions.length) { + buildOptionList = `
`; + for (const buildOptionElement of FC.CONFIG.buildOptions) { + buildOptionList += `
${buildOptionElement}
`; + } + buildOptionList += `
`; + build_info_e.html(` + ${i18n.getMessage('initialSetupInfoBuildOptionsList')}`); + } else { + build_info_e.html(i18n.getMessage(navigator.onLine ? 'initialSetupInfoBuildOptionsEmpty' : 'initialSetupNotOnline')); + } + + if (FC.CONFIG.buildKey.length === 32) { + const buildRoot = `https://build.betaflight.com/api/builds/${FC.CONFIG.buildKey}`; + const buildConfig = ` + ${i18n.getMessage('initialSetupInfoBuildConfig')}`; + + const buildLog = ` + ${i18n.getMessage('initialSetupInfoBuildLog')}`; - for (const buildOption of FC.CONFIG.buildOptions) { - buildOptions = `${buildOptions}   ${buildOption}`; + const buildOptions = ` + ${i18n.getMessage('initialSetupInfoBuildOptions')}`; + + build_info_e.html(`${buildConfig} ${buildLog}     ${buildOptions}`); + $('a.buildOptions').on('click', async function() { + showDialogBuildInfo(`

${i18n.getMessage('initialSetupInfoBuildOptionList')}

`, buildOptionList); + }); + $('.build-info a').removeClass('disabled'); + } else { + build_info_e.html(i18n.getMessage('initialSetupInfoBuildEmpty')); + $('.build-info a').addClass('disabled'); } - build_opt_e.html(` - ${i18n.getMessage('initialSetupInfoBuildOptionsList')}`); } else { - build_opt_e.html(i18n.getMessage(navigator.onLine ? 'initialSetupInfoBuildOptionsEmpty' : 'initialSetupNotOnline')); + build_info_e.html(i18n.getMessage('initialSetupNotOnline')); + $('.build-info a').addClass('disabled'); } }; @@ -477,6 +504,8 @@ setup.initialize = function (callback) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46) && FC.CONFIG.cpuTemp) { cputemp_e.html(`${FC.CONFIG.cpuTemp.toFixed(0)} ℃`); + } else { + cputemp_e.text(i18n.getMessage('initialSetupCpuTempNotSupported')); } // GPS info is acquired in the background using update_live_status() in serial_backend.js diff --git a/src/main.html b/src/main.html index 6adca02151..c0139ba8f8 100644 --- a/src/main.html +++ b/src/main.html @@ -134,7 +134,7 @@ :batteryState="FC.BATTERY_STATE?.batteryState" > - diff --git a/src/tabs/setup.html b/src/tabs/setup.html index 8f13ca15f9..cda9cf4c9e 100644 --- a/src/tabs/setup.html +++ b/src/tabs/setup.html @@ -108,7 +108,7 @@
-
+
@@ -154,7 +154,7 @@
-
+
@@ -189,7 +189,7 @@
-
+
@@ -221,7 +221,7 @@
-
+
@@ -239,10 +239,6 @@ - - - -
@@ -262,4 +258,14 @@

+ +
+
+
+
+
+ +
+
+