1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 12:55:13 +03:00

Path more cases that lead to inproper MSP version select

This commit is contained in:
Pawel Spychalski (DzikuVx) 2022-03-11 13:02:06 +01:00
parent 66d682daba
commit 32ab753e23
4 changed files with 25 additions and 5 deletions

View file

@ -4062,5 +4062,8 @@
},
"pidOutput": {
"message": "Output"
},
"illegalStateRestartRequired": {
"message": "Illegal state. Restart required."
}
}

View file

@ -67,6 +67,7 @@ var CONFIG,
FEATURES;
var FC = {
restartRequired: false,
MAX_SERVO_RATE: 125,
MIN_SERVO_RATE: 0,
isAirplane: function () {

View file

@ -57,7 +57,7 @@ var MSP = {
CHECKSUM_V1: 16,
CHECKSUM_V2: 17,
},
protocolVersion: 1, // this.constants.PROTOCOL_V1
protocolVersion: 2, // this.constants.PROTOCOL_V2
state: 0, // this.decoder_states.IDLE
message_direction: 1,
code: 0,

View file

@ -236,6 +236,13 @@ function onInvalidFirmwareVersion()
}
function onOpen(openInfo) {
if (FC.restartRequired) {
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("illegalStateRestartRequired") + "</strong></span>");
$('div.connect_controls a').click(); // disconnect
return;
}
if (openInfo) {
// update connected_to
GUI.connected_to = GUI.connecting_to;
@ -268,7 +275,12 @@ function onOpen(openInfo) {
if (!CONFIGURATOR.connectionValid) {
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
$('div.connect_controls ').click(); // disconnect
helper.mspQueue.flush();
helper.mspQueue.freeHardLock();
helper.mspQueue.freeSoftLock();
serial.emptyOutputBuffer();
$('div.connect_controls a').click(); // disconnect
}
}, 10000);
@ -276,11 +288,15 @@ function onOpen(openInfo) {
// request configuration data. Start with MSPv1 and
// upgrade to MSPv2 if possible.
MSP.protocolVersion = MSP.constants.PROTOCOL_V1;
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
if (CONFIG.apiVersion && semver.gte(CONFIG.apiVersion, "2.0.0")) {
MSP.protocolVersion = MSP.constants.PROTOCOL_V2;
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
if (CONFIG.apiVersion === "0.0.0") {
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("illegalStateRestartRequired") + "</strong></span>");
FC.restartRequired = true;
return;
}
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
MSP.send_message(MSPCodes.MSP_FC_VARIANT, false, false, function () {