Merge pull request #507 from mikeller/load_craft_name_on_startup

Added loading of craft name on startup.
10.3.x-maintenance
Michael Keller 2017-06-03 11:00:28 +12:00 committed by GitHub
commit 3b476e528e
2 changed files with 25 additions and 11 deletions

View File

@ -190,10 +190,13 @@
"message": "Firmware Version: <strong>$1</strong>"
},
"apiVersionReceived": {
"message": "MultiWii API version <span style=\"color: #ffbb00\">received</span> - <strong>$1</strong>"
"message": "MultiWii API version: <strong>$1</strong>"
},
"uniqueDeviceIdReceived": {
"message": "Unique device ID <span style=\"color: #ffbb00\">received</span> - <strong>0x$1</strong>"
"message": "Unique device ID: <strong>0x$1</strong>"
},
"craftNameReceived": {
"message": "Craft name: <strong>$1</strong>"
},
"boardInfoReceived": {
"message": "Board: <strong>$1</strong>, version: <strong>$2</strong>"

View File

@ -208,16 +208,15 @@ function onOpen(openInfo) {
MSP.send_message(MSPCodes.MSP_UID, false, false, function () {
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
// continue as usually
CONFIGURATOR.connectionValid = true;
GUI.allowedTabs = GUI.defaultAllowedFCTabsWhenConnected.slice();
if (semver.lt(CONFIG.apiVersion, "1.4.0")) {
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('led_strip'), 1);
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
MSP.send_message(MSPCodes.MSP_NAME, false, false, function () {
GUI.log(chrome.i18n.getMessage('craftNameReceived', [CONFIG.name]));
finishOpen();
});
} else {
finishOpen();
}
onConnect();
$('#tabs ul.mode-connected .tab_setup a').click();
});
});
});
@ -251,6 +250,18 @@ function onOpen(openInfo) {
}
}
function finishOpen() {
CONFIGURATOR.connectionValid = true;
GUI.allowedTabs = GUI.defaultAllowedFCTabsWhenConnected.slice();
if (semver.lt(CONFIG.apiVersion, "1.4.0")) {
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('led_strip'), 1);
}
onConnect();
$('#tabs ul.mode-connected .tab_setup a').click();
}
function connectCli() {
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
GUI.allowedTabs = ['cli'];