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

Add support for MSPv2

MWC side detection is done by sending an MSPv1 message for
MSP_API_VERSION. If the MSP_VERSION supports MSPv2 (>= 2.0.0),
then the rest of the messages for the session will be MSPv2 only.
This commit is contained in:
Alberto García Hierro 2017-08-27 01:46:41 +02:00
parent dbf4fa164d
commit acd455d6da
3 changed files with 296 additions and 142 deletions

View file

@ -246,8 +246,13 @@ function onOpen(openInfo) {
FC.resetState();
// request configuration data
// 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;
}
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.apiVersionAccepted)) {