1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Merge pull request #126 from gaelj/BF_LED_Strip_bugfixes

Don't display first invalid LED / Fix overlay not disabled properly
This commit is contained in:
Michael Keller 2016-07-19 08:36:54 +12:00 committed by GitHub
commit aaef07a01b

View file

@ -124,7 +124,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$(element).removeClass(classesToRemove.join(' ')); $(element).removeClass(classesToRemove.join(' '));
} }
// Directional Buttons // Directional Buttons
$('.directions').on('click', 'button', function() { $('.directions').on('click', 'button', function() {
var that = this; var that = this;
@ -189,7 +188,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
}); });
// Color sliders // Color sliders
var ip = $('div.colorDefineSliders input'); var ip = $('div.colorDefineSliders input');
ip.eq(0).on("input change", function() { updateColors($(this).val(), 0); }); ip.eq(0).on("input change", function() { updateColors($(this).val(), 0); });
@ -199,7 +197,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
updateColors(ip.eq(i).val(), i); updateColors(ip.eq(i).val(), i);
} }
// Color Buttons // Color Buttons
$('.colors').on('click', 'button', function(e) { $('.colors').on('click', 'button', function(e) {
var that = this; var that = this;
@ -419,7 +416,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
$(this).removeClass('mode_color-' + i + '-' + j); $(this).removeClass('mode_color-' + i + '-' + j);
$(this).addClass('mode_color-' + mode + '-' + j); $(this).addClass('mode_color-' + mode + '-' + j);
} }
}); });
$('.mode_colors').each(function() { setModeBackgroundColor($(this)); }); $('.mode_colors').each(function() { setModeBackgroundColor($(this)); });
@ -463,7 +459,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
}); });
clearModeColorSelection(); clearModeColorSelection();
updateBulkCmd(); updateBulkCmd();
setOptionalGroupsVisibility(); setOptionalGroupsVisibility();
@ -493,7 +488,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
var ledIndex = ledResult.index; var ledIndex = ledResult.index;
var led = ledResult.led; var led = ledResult.led;
if (led.functions.length == 0 && led.directions.length == 0 && led.color == 0) { if (led.functions[0] == 'c' && led.functions.length == 1 && led.directions.length == 0 && led.color == 0 && led.x == 0 && led.y == 0) {
return; return;
} }
@ -759,28 +754,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
break; break;
} }
// set color palette visibility
/*
switch (activeFunction) {
case "":
case "function-c":
case "function-b":
case "function-r":
case "function-a":
case "function-f":
case "function-g":
case "function-l":
$('.colors').show();
$('.colorDefineSliders').show();
break;
default:
$('.colors').hide();
$('.colorDefineSliders').hide();
break;
}
*/
// set overlays (checkboxes) visibility // set overlays (checkboxes) visibility
// set directions visibility // set directions visibility
if (semver.lt(CONFIG.apiVersion, "1.20.0")) { if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
@ -896,7 +869,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
function unselectOverlay(func, overlay) { function unselectOverlay(func, overlay) {
if ($('input.function-' + overlay).is(':checked')) {
$('input.function-' + overlay).prop('checked', false); $('input.function-' + overlay).prop('checked', false);
$('input.function-' + overlay).change(); $('input.function-' + overlay).change();
$('.ui-selected').each(function() { $('.ui-selected').each(function() {
@ -905,7 +877,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
}); });
} }
}
function updateColors(value, hsvIndex) { function updateColors(value, hsvIndex) {
var change = false; var change = false;
@ -1005,6 +976,9 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
function HsvToColor(input) { function HsvToColor(input) {
if (input == undefined)
return "";
var HSV = { h:Number(input.h), s:Number(input.s), v:Number(input.v) }; var HSV = { h:Number(input.h), s:Number(input.s), v:Number(input.v) };
if (HSV.s == 0 && HSV.v == 0) if (HSV.s == 0 && HSV.v == 0)