1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 05:15:21 +03:00

MSP versioning CF compatible

This commit is contained in:
gaelj 2016-06-26 23:02:28 +02:00
parent 92ec31f80b
commit b62abd74e7
4 changed files with 30 additions and 30 deletions

View file

@ -941,13 +941,13 @@ var MSP = {
LED_STRIP = [];
var ledCount = data.byteLength / 7; // v1.4.0 and below incorrectly reported 4 bytes per led.
if (semver.gte(CONFIG.apiVersion, "1.17.0"))
if (semver.gte(CONFIG.apiVersion, "1.20.0"))
ledCount = data.byteLength / 4;
var offset = 0;
for (var i = 0; offset < data.byteLength && i < ledCount; i++) {
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
var directionMask = data.getUint16(offset, 1);
offset += 2;
@ -1048,7 +1048,7 @@ var MSP = {
console.log('Led strip colors saved');
break;
case MSP_codes.MSP_LED_STRIP_MODECOLOR:
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
LED_MODE_COLORS = [];
@ -1838,7 +1838,7 @@ MSP.sendLedStripConfig = function(onCompleteCallback) {
buffer.push(ledIndex);
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
var directionMask = 0;
for (var directionLetterIndex = 0; directionLetterIndex < led.directions.length; directionLetterIndex++) {
var bitIndex = MSP.ledDirectionLetters.indexOf(led.directions[directionLetterIndex]);