Skip to content

Commit

Permalink
Revert "Add LED strip sliders (#3531)"
Browse files Browse the repository at this point in the history
This reverts commit 7bca5f9.
  • Loading branch information
haslinghuis committed Aug 18, 2023
1 parent 7bca5f9 commit 6ffc098
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 186 deletions.
25 changes: 1 addition & 24 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3670,29 +3670,6 @@
"ledStripVtxOverlay": {
"message": "VTX (uses vtx frequency to assign color)"
},
"ledStripBrightnessSliderTitle": {
"message": "Brightness",
"description": "Brightness of the LED Strip"
},
"ledStripBrightnessSliderHelp": {
"message": "Maximum brightness percent of the LEDs."
},
"ledStripRainbowDeltaSliderTitle": {
"message": "Delta",
"description": "LED Strip rainbow effect delta"
},
"ledStripRainbowDeltaSliderHelp": {
"message": "Hue difference between each LEDs.",
"description": "Hint on LED Strip tab for rainbow delta"
},
"ledStripRainbowFreqSliderTitle": {
"message": "Frequency",
"description": "LED Strip rainbow effect frequency"
},
"ledStripRainbowFreqSliderHelp": {
"message": "Frequency of the color change, in other terms the speed of the effect.",
"description": "Hint on LED Strip tab for rainbow frequency"
},
"ledStripFunctionSection": {
"message": "LED Functions"
},
Expand Down Expand Up @@ -3850,7 +3827,7 @@
},
"ledStripRainbowOverlay": {
"message": "Rainbow",
"description": "Label of rainbow effect switch on LED Strip tab"
"description": "Rainbow effect switch label on LED Strip tab"
},
"ledStripOverlayTitle": {
"message": "Overlay"
Expand Down
35 changes: 0 additions & 35 deletions src/css/tabs/led_strip.less
Original file line number Diff line number Diff line change
Expand Up @@ -250,42 +250,7 @@
background: var(--boxBackground);
color: var(--defaultText);
}
.rainbowSlidersDiv {
display: none;
margin-top: 5px;
.rainbowDeltaSlider, .rainbowFreqSlider {
display: flex;
align-items: center;
input {
width: 150px;
margin-right: 5px;
margin-top: 5px;
}
label {
margin-right: 10px;
margin-top: 5px;
}
}
}
}

.brightnessSliderDiv {
margin-top: -15px;
.brightnessSlider{
display: flex;
align-items: center;
input {
width: 150px;
margin-right: 5px;
margin-top: 5px;
}
label {
margin-right: 10px;
margin-top: 5px;
}
}
}

.colorDefineSliders {
display: inline-block;
position: absolute;
Expand Down
1 change: 0 additions & 1 deletion src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ const FC = {
LED_COLORS: null,
LED_MODE_COLORS: null,
LED_STRIP: null,
LED_CONFIG_VALUES: [],
MISC: null, // DEPRECATED
MIXER_CONFIG: null,
MODE_RANGES: null,
Expand Down
2 changes: 0 additions & 2 deletions src/js/msp/MSPCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ const MSPCodes = {

MSP_MULTIPLE_MSP: 230,

MSP_SET_LED_STRIP_CONFIG_VALUES:231,
MSP_LED_STRIP_CONFIG_VALUES: 232,
MSP_MODE_RANGES_EXTRA: 238,
MSP_SET_ACC_TRIM: 239,
MSP_ACC_TRIM: 240,
Expand Down
18 changes: 1 addition & 17 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1298,15 +1298,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
case MSPCodes.MSP_SET_LED_STRIP_MODECOLOR:
console.log('Led strip mode colors saved');
break;
case MSPCodes.MSP_LED_STRIP_CONFIG_VALUES:
FC.LED_CONFIG_VALUES = {
brightness: data.readU8(),
rainbow_delta: data.readU8(),
rainbow_freq: data.readU16(),
};
break;
case MSPCodes.MSP_SET_LED_STRIP_CONFIG_VALUES:
break;

case MSPCodes.MSP_DATAFLASH_SUMMARY:
if (data.byteLength >= 13) {
flags = data.readU8();
Expand Down Expand Up @@ -2640,14 +2632,6 @@ MspHelper.prototype.sendLedStripModeColors = function(onCompleteCallback) {
}
};

MspHelper.prototype.sendLedStripConfigValues = function(onCompleteCallback) {
const buffer = [];
buffer.push8(FC.LED_CONFIG_VALUES.brightness);
buffer.push8(FC.LED_CONFIG_VALUES.rainbow_delta);
buffer.push16(FC.LED_CONFIG_VALUES.rainbow_freq);
MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG_VALUES, buffer, false, onCompleteCallback);
};

MspHelper.prototype.serialPortFunctionMaskToFunctions = function(functionMask) {
const self = this;
const functions = [];
Expand Down
85 changes: 1 addition & 84 deletions src/js/tabs/led_strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ led_strip.initialize = function (callback, scrollPosition) {
}

function load_led_mode_colors() {
MSP.send_message(MSPCodes.MSP_LED_STRIP_MODECOLOR, false, false, load_led_config_values);
}

function load_led_config_values() {
MSP.send_message(MSPCodes.MSP_LED_STRIP_CONFIG_VALUES, false, false, load_html);
MSP.send_message(MSPCodes.MSP_LED_STRIP_MODECOLOR, false, false, load_html);
}

function load_html() {
Expand Down Expand Up @@ -382,8 +378,6 @@ led_strip.initialize = function (callback, scrollPosition) {
if (feature_o.is(':checked') !== newVal) {
feature_o.prop('checked', newVal);
feature_o.trigger('change');

$('.rainbowSlidersDiv').toggle($('.checkbox.rainbowOverlay').find('input').is(':checked')); //rainbow slider visibility
}
});

Expand Down Expand Up @@ -510,11 +504,6 @@ led_strip.initialize = function (callback, scrollPosition) {
}
}

//Change Rainbow slider visibility
if (that.is('.function-y')) {
$('.rainbowSlidersDiv').toggle(that.is(':checked'));
}

if ($('.ui-selected').length > 0) {
TABS.led_strip.overlays.forEach(function(letter) {
if ($(that).is(functionTag + letter)) {
Expand Down Expand Up @@ -566,78 +555,6 @@ led_strip.initialize = function (callback, scrollPosition) {
$(this).addClass(`color-${led.color}`);
});

//default slider values
$('div.brightnessSlider input').first().prop('value', FC.LED_CONFIG_VALUES.brightness);
$('div.brightnessSlider label').first().text($('div.brightnessSlider input').first().val());
$('div.rainbowDeltaSlider input').first().prop('value', FC.LED_CONFIG_VALUES.rainbow_delta);
$('div.rainbowDeltaSlider label').first().text($('div.rainbowDeltaSlider input').first().val());
$('div.rainbowFreqSlider input').first().prop('value', FC.LED_CONFIG_VALUES.rainbow_freq);
$('div.rainbowFreqSlider label').first().text($('div.rainbowFreqSlider input').first().val());

//Brightness slider
let bufferingBrightness = [],
buffer_delay_brightness = false;

$('div.brightnessSlider input').on('input', function () {
const val = $(this).val();
bufferingBrightness.push(val);

if (!buffer_delay_brightness) {
buffer_delay_brightness = setTimeout(function () {
FC.LED_CONFIG_VALUES.brightness = bufferingBrightness.pop();
mspHelper.sendLedStripConfigValues();

bufferingBrightness = [];
buffer_delay_brightness = false;
}, 10);
}

$('div.brightnessSlider label').first().text(val);
});

//Rainbow Delta slider
let bufferingRainbowDelta = [],
buffer_delay_rainbow_delta = false;

$('div.rainbowDeltaSlider input').on('input', function () {
const val = $(this).val();
bufferingRainbowDelta.push(val);

if (!buffer_delay_rainbow_delta) {
buffer_delay_rainbow_delta = setTimeout(function () {
FC.LED_CONFIG_VALUES.rainbow_delta = bufferingRainbowDelta.pop();
mspHelper.sendLedStripConfigValues();

bufferingRainbowDelta = [];
buffer_delay_rainbow_delta = false;
}, 10);
}

$('div.rainbowDeltaSlider label').first().text(val);
});

//Rainbow Frequency slider
let bufferingRainbowFreq = [],
buffer_delay_rainbow_freq = false;

$('div.rainbowFreqSlider input').on('input', function () {
const val = $(this).val();
bufferingRainbowFreq.push(val);

if (!buffer_delay_rainbow_freq) {
buffer_delay_rainbow_freq = setTimeout(function () {
FC.LED_CONFIG_VALUES.rainbow_freq = bufferingRainbowFreq.pop();
mspHelper.sendLedStripConfigValues();

bufferingRainbowFreq = [];
buffer_delay_rainbow_freq = false;
}, 10);
}

$('div.rainbowFreqSlider label').first().text(val);
});


$('a.save').on('click', function () {
mspHelper.sendLedStripConfig(send_led_strip_colors);

Expand Down
23 changes: 0 additions & 23 deletions src/tabs/led_strip.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,6 @@
<div class="checkbox rainbowOverlay">
<input type="checkbox" name="Rainbow" class="toggle function-y" />
<label> <span i18n="ledStripRainbowOverlay"></span></label>
<div class="rainbowSlidersDiv">
<span i18n="ledStripRainbowDeltaSliderTitle"></span>
<div class="rainbowDeltaSlider">
<input type="range" min="0" max="359"/>
<label></label>
<div class="helpicon cf_tip" i18n_title="ledStripRainbowDeltaSliderHelp"></div>
</div>
<span i18n="ledStripRainbowFreqSliderTitle"></span>
<div class="rainbowFreqSlider">
<input type="range" min="1" max="360"/>
<label></label>
<div class="helpicon cf_tip" i18n_title="ledStripRainbowFreqSliderHelp"></div>
</div>
</div>
</div>
</div>

Expand Down Expand Up @@ -200,15 +186,6 @@
<button class="mode_color-6-7" i18n_title="colorGreen" i18n="ledStripModeColorsModeGPSLocked"></button>
</div>

<div class="brightnessSliderDiv">
<span i18n="ledStripBrightnessSliderTitle"></span>
<div class="brightnessSlider">
<input type="range" min="5" max="100"/>
<label></label>
<div class="helpicon cf_tip" i18n_title="ledStripBrightnessSliderHelp"></div>
</div>
</div>

<div class="section" i18n="ledStripWiring"></div>
<div class="wiringMode">
<button class="funcWire w100" i18n="ledStripWiringMode"></button>
Expand Down

0 comments on commit 6ffc098

Please sign in to comment.