diff --git a/_locales/en/messages.json b/_locales/en/messages.json index dd86849a..77876b36 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1933,6 +1933,9 @@ "cliReboot": { "message": "CLI reboot detected" }, + "cliDocsBtn": { + "message": "CLI Command Docs" + }, "cliSaveToFileBtn": { "message": "Save to File" }, diff --git a/js/settings.js b/js/settings.js index feaf205c..e954560d 100644 --- a/js/settings.js +++ b/js/settings.js @@ -672,7 +672,7 @@ var Settings = (function () { } if (typeof dataSettingName !== "undefined" && dataSettingName !== "") { - helpIcon.wrap(''); + helpIcon.wrap(''); } } diff --git a/main.js b/main.js index 64f8c7de..17694738 100644 --- a/main.js +++ b/main.js @@ -24,12 +24,16 @@ let globalSettings = { // Used to depict how the units are displayed within the UI unitType: null, // Used to convert units within the UI - osdUnits: null, + osdUnits: null, + // Map mapProviderType: null, mapApiKey: null, proxyURL: null, proxyLayer: null, + // Show colours for profiles showProfileParameters: null, + // tree target for documents + docsTreeLocation: 'master', }; $(document).ready(function () { @@ -673,7 +677,21 @@ function updateActivatedTab() { function updateFirmwareVersion() { if (CONFIGURATOR.connectionValid) { $('#logo .firmware_version').text(CONFIG.flightControllerVersion + " [" + CONFIG.target + "]"); + globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/' + CONFIG.flightControllerVersion + '/docs/'; + + // If this is a master branch firmware, this will find a 404 as there is no tag tree. So default to master for docs. + $.ajax({ + url : globalSettings.docsTreeLocation + 'Settings.md', + method: "HEAD", + statusCode: { + 404: function() { + globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/'; + } + } + }); } else { $('#logo .firmware_version').text(chrome.i18n.getMessage('fcNotConnected')); + + globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/'; } } diff --git a/tabs/cli.html b/tabs/cli.html index 4e953695..41835aa4 100644 --- a/tabs/cli.html +++ b/tabs/cli.html @@ -20,6 +20,7 @@
+ diff --git a/tabs/cli.js b/tabs/cli.js index 4d85e70f..29d5dcfd 100644 --- a/tabs/cli.js +++ b/tabs/cli.js @@ -146,6 +146,8 @@ TABS.cli.initialize = function (callback) { // translate to user-selected language localize(); + $('.cliDocsBtn').attr('href', globalSettings.docsTreeLocation + 'Settings.md'); + CONFIGURATOR.cliActive = true; var textarea = $('.tab-cli textarea[name="commands"]');