MSP versioning CF compatible

10.3.x-maintenance
gaelj 2016-06-26 23:02:28 +02:00
parent 92ec31f80b
commit b62abd74e7
4 changed files with 30 additions and 30 deletions

View File

@ -112,7 +112,7 @@ function configuration_backup(callback) {
uniqueData.push(MSP_codes.MSP_FAILSAFE_CONFIG);
uniqueData.push(MSP_codes.MSP_RXFAIL_CONFIG);
}
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
uniqueData.push(MSP_codes.MSP_LED_STRIP_MODECOLOR);
}
}
@ -136,7 +136,7 @@ function configuration_backup(callback) {
configuration.LED_STRIP = jQuery.extend(true, [], LED_STRIP);
configuration.LED_COLORS = jQuery.extend(true, [], LED_COLORS);
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
configuration.LED_MODE_COLORS = jQuery.extend(true, [], LED_MODE_COLORS);
}
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
@ -612,7 +612,7 @@ function configuration_restore(callback) {
appliedMigrationsCount++;
}
if (!compareVersions(migratedVersion, '1.2.1')) {
if (!compareVersions(migratedVersion, '1.3.1')) {
// LED_COLORS & LED_MODE_COLORS support was added.
if (!configuration.LED_COLORS) {
@ -622,7 +622,7 @@ function configuration_restore(callback) {
configuration.LED_MODE_COLORS = [];
}
migratedVersion = '1.2.1';
migratedVersion = '1.3.1';
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
@ -793,7 +793,7 @@ function configuration_restore(callback) {
}
function send_led_strip_mode_colors() {
if (semver.gte(CONFIG.apiVersion, "1.17.0"))
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
MSP.sendLedStripModeColors(send_rxfail_config);
else
send_rxfail_config();

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]);

View File

@ -64,9 +64,9 @@
<option value="function-c" class="">Color</option>
<option value="function-f" class="">Modes &amp; Orientation</option>
<option value="function-a" class="">Arm State</option>
<option value="function-l" class="extra_functions17">Battery</option>
<option value="function-s" class="extra_functions17">RSSI</option>
<option value="function-g" class="extra_functions17">GPS</option>
<option value="function-l" class="extra_functions20">Battery</option>
<option value="function-s" class="extra_functions20">RSSI</option>
<option value="function-g" class="extra_functions20">GPS</option>
<option value="function-r" class="">Ring</option>
</select>
</div>
@ -78,13 +78,13 @@
<input type="checkbox" name="ThrottleHue" class="toggle function-t" />
<label> <span>Throttle</span></label>
</div>
<div class="checkbox extra_functions17">
<div class="checkbox extra_functions20">
<input type="checkbox" name="LarsonScanner" class="toggle function-o" />
<label> <span>Larson scanner</span></label>
</div>
</div>
<div class="blinkers extra_functions17">
<div class="blinkers extra_functions20">
<span class="color_section">Blink</span>
<div class="checkbox blinkOverlay">
<input type="checkbox" name="blink" class="toggle function-b" />

View File

@ -11,7 +11,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
var selectedColorIndex = null;
var selectedModeColor = null;
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
TABS.led_strip.functions = ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b'];
TABS.led_strip.baseFuncs = ['c', 'f', 'a', 'b', 'g', 'r'];
TABS.led_strip.overlays = ['t', 's', 'i', 'w'];
@ -36,7 +36,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}
function load_led_mode_colors() {
if (semver.gte(CONFIG.apiVersion, "1.17.0"))
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
MSP.send_message(MSP_codes.MSP_LED_STRIP_MODECOLOR, false, false, load_html);
else
load_html();
@ -73,7 +73,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
var theHTML = [];
var theHTMLlength = 0;
for (var i = 0; i < 256; i++) {
if (semver.lt(CONFIG.apiVersion, "1.17.0"))
if (semver.lte(CONFIG.apiVersion, "1.19.0"))
theHTML[theHTMLlength++] = ('<div class="gPoint"><div class="indicators"><span class="north"></span><span class="south"></span><span class="west"></span><span class="east"></span><span class="up">U</span><span class="down">D</span></div><span class="wire"></span><span class="overlay-t"> </span><span class="overlay-s"> </span><span class="overlay-w"> </span><span class="overlay-i"> </span><span class="overlay-color"> </span></div>');
else
theHTML[theHTMLlength++] = ('<div class="gPoint"><div class="indicators"><span class="north"></span><span class="south"></span><span class="west"></span><span class="east"></span><span class="up">U</span><span class="down">D</span></div><span class="wire"></span><span class="overlay-t"> </span><span class="overlay-o"> </span><span class="overlay-b"> </span><span class="overlay-n"> </span><span class="overlay-w"> </span><span class="overlay-i"> </span><span class="overlay-color"> </span></div>');
@ -520,7 +520,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}
function send_led_strip_mode_colors() {
if (semver.gte(CONFIG.apiVersion, "1.17.0"))
if (semver.gte(CONFIG.apiVersion, "1.19.0"))
MSP.sendLedStripModeColors(save_to_eeprom);
else
save_to_eeprom();
@ -645,7 +645,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// refresh mode color buttons
function setModeBackgroundColor(element) {
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
element.find('[class*="mode_color"]').each(function() {
var m = 0;
var d = 0;
@ -678,19 +678,19 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$('select.functionSelect').addClass(activeFunction);
if (semver.lte(CONFIG.apiVersion, "1.16.0")) {
// <= 16
if (semver.lte(CONFIG.apiVersion, "1.18.0")) {
// <= 18
// Hide GPS (Func)
// Hide RSSI (O/L), Blink (Func)
// Hide Battery, RSSI (Func), Larson (O/L), Blink (O/L), Landing (O/L)
$(".extra_functions17").hide();
$(".extra_functions20").hide();
$(".mode_colors").hide();
} else {
// >= 17
// >= 20
// Show GPS (Func)
// Hide RSSI (O/L), Blink (Func)
// Show Battery, RSSI (Func), Larson (O/L), Blink (O/L), Landing (O/L)
$(".extra_functions17").show();
$(".extra_functions20").show();
$(".mode_colors").show();
}
@ -701,7 +701,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$('.modifiers').hide();
$('.blinkers').hide();
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
switch (activeFunction) {
case "function-c":
case "function-a":
@ -751,7 +751,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
break;
case "function-r":
case "function-b":
if (semver.lt(CONFIG.apiVersion, "1.17.0"))
if (semver.lt(CONFIG.apiVersion, "1.20.0"))
$('.warningOverlay').hide();
break;
default:
@ -783,7 +783,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// set overlays (checkboxes) visibility
// set directions visibility
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
switch (activeFunction) {
case "function-r":
$('.indicatorOverlay').hide();
@ -796,7 +796,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}
}
$('.mode_colors').hide();
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
// set mode colors visibility
if (activeFunction == "function-f")
$('.mode_colors').show();
@ -868,7 +868,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}
function unselectOverlays(letter) {
if (semver.lt(CONFIG.apiVersion, "1.17.0")) {
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
if (letter == 'b' || letter == 'r') {
unselectOverlay(letter, 'i');
}
@ -878,7 +878,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
unselectOverlay(letter, 's');
}
} else {
// MSP 1.17
// MSP 1.20
if (letter == 'r' || letter == '') {
unselectOverlay(letter, 'o');
unselectOverlay(letter, 'b');