Fix invalid version (#3449)
parent
c5ddfa4555
commit
99730ef531
|
@ -239,6 +239,26 @@ function setConnectionTimeout() {
|
|||
}, 10000);
|
||||
}
|
||||
|
||||
function abortConnection() {
|
||||
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||
|
||||
GUI.connected_to = false;
|
||||
GUI.connecting_to = false;
|
||||
|
||||
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SerialPortFailed');
|
||||
|
||||
gui_log(i18n.getMessage('serialPortOpenFail'));
|
||||
|
||||
$('div#connectbutton div.connect_state').text(i18n.getMessage('connect'));
|
||||
$('div#connectbutton a.connect').removeClass('active');
|
||||
|
||||
// unlock port select & baud
|
||||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', false);
|
||||
|
||||
// reset data
|
||||
clicks = false;
|
||||
}
|
||||
|
||||
function onOpen(openInfo) {
|
||||
if (openInfo) {
|
||||
CONFIGURATOR.virtualMode = false;
|
||||
|
@ -275,12 +295,16 @@ function onOpen(openInfo) {
|
|||
console.log(`Requesting configuration data`);
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
|
||||
gui_log(i18n.getMessage('apiVersionReceived', FC.CONFIG.apiVersion));
|
||||
|
||||
if (FC.CONFIG.apiVersion.includes('null')) {
|
||||
abortConnection();
|
||||
return;
|
||||
}
|
||||
|
||||
tracking.setFlightControllerData(tracking.DATA.API_VERSION, FC.CONFIG.apiVersion);
|
||||
|
||||
gui_log(i18n.getMessage('apiVersionReceived', [FC.CONFIG.apiVersion]));
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_ACCEPTED)) {
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_FC_VARIANT, false, false, function () {
|
||||
tracking.setFlightControllerData(tracking.DATA.FIRMWARE_TYPE, FC.CONFIG.flightControllerIdentifier);
|
||||
if (FC.CONFIG.flightControllerIdentifier === 'BTFL') {
|
||||
|
@ -329,12 +353,7 @@ function onOpen(openInfo) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SerialPortFailed');
|
||||
|
||||
console.log('Failed to open serial port');
|
||||
gui_log(i18n.getMessage('serialPortOpenFail'));
|
||||
|
||||
abortConnect();
|
||||
abortConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,17 +374,6 @@ function onOpenVirtual() {
|
|||
updateTabList(FC.FEATURE_CONFIG.features);
|
||||
}
|
||||
|
||||
function abortConnect() {
|
||||
$('div#connectbutton div.connect_state').text(i18n.getMessage('connect'));
|
||||
$('div#connectbutton a.connect').removeClass('active');
|
||||
|
||||
// unlock port select & baud
|
||||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', false);
|
||||
|
||||
// reset data
|
||||
clicks = false;
|
||||
}
|
||||
|
||||
function processCustomDefaults() {
|
||||
if (bit_check(FC.CONFIG.targetCapabilities, FC.TARGET_CAPABILITIES_FLAGS.SUPPORTS_CUSTOM_DEFAULTS) && bit_check(FC.CONFIG.targetCapabilities, FC.TARGET_CAPABILITIES_FLAGS.HAS_CUSTOM_DEFAULTS) && FC.CONFIG.configurationState === FC.CONFIGURATION_STATES.DEFAULTS_BARE) {
|
||||
const dialog = $('#dialogResetToCustomDefaults')[0];
|
||||
|
|
|
@ -539,7 +539,11 @@ firmware_flasher.initialize = function (callback) {
|
|||
MSP.clearListeners();
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
function onClose(success) {
|
||||
if (!success) {
|
||||
gui_log(i18n.getMessage('firmwareFlasherBoardVerificationFailed'));
|
||||
}
|
||||
|
||||
serial.disconnect(onFinishClose);
|
||||
MSP.disconnect_cleanup();
|
||||
}
|
||||
|
@ -564,11 +568,10 @@ firmware_flasher.initialize = function (callback) {
|
|||
|
||||
gui_log(i18n.getMessage(targetAvailable ? 'firmwareFlasherBoardVerificationSuccess' : 'firmwareFlasherBoardVerficationTargetNotAvailable',
|
||||
{ boardName: board }));
|
||||
onClose(true);
|
||||
} else {
|
||||
gui_log(i18n.getMessage('firmwareFlasherBoardVerificationFail'));
|
||||
onClose(false);
|
||||
}
|
||||
|
||||
onClose();
|
||||
}
|
||||
|
||||
function getBoardInfo() {
|
||||
|
@ -598,12 +601,11 @@ firmware_flasher.initialize = function (callback) {
|
|||
function detectBoard() {
|
||||
console.log(`Requesting board information`);
|
||||
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, () => {
|
||||
if (!FC.CONFIG.apiVersion || FC.CONFIG.apiVersion === 'null.null.0') {
|
||||
FC.CONFIG.apiVersion = '0.0.0';
|
||||
}
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
|
||||
onClose(); // not supported
|
||||
if (!FC.CONFIG.apiVersion || FC.CONFIG.apiVersion.includes('null')) {
|
||||
gui_log(i18n.getMessage('apiVersionReceived', FC.CONFIG.apiVersion));
|
||||
onClose(false); // not supported
|
||||
} else if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
|
||||
onClose(false); // not supported
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_UID, false, false, getBuildInfo);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue