Skip to content

Commit e87ffaa

Browse files
authored
Cleanup + led overlay expansion (#3390)
* Cleanup + led overlay expansion * Delete unused class and design fixes * more spacing * Revert #3391
1 parent 08100ba commit e87ffaa

File tree

4 files changed

+30
-33
lines changed

4 files changed

+30
-33
lines changed

src/css/tabs/led_strip.less

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,21 @@
229229
color: var(--defaultText);
230230
}
231231
}
232+
.header {
233+
color: #c4c4c4;
234+
font-size: 13px;
235+
font-weight: 600;
236+
}
232237
.overlays {
233238
display: inline-block;
239+
margin-top: 5px;
234240
}
235241
.modifiers {
236242
display: inline-block;
243+
margin-top: 5px;
244+
.rainbowOverlay {
245+
margin-top: 1px;
246+
}
237247
.auxSelect {
238248
border: 1px solid var(--subtleAccent);
239249
border-radius: 3px;
@@ -499,9 +509,6 @@
499509
z-index: 100;
500510
border: 1px dotted white;
501511
}
502-
.modifiers .switchery, .overlays .switchery {
503-
margin-top: 2px !important;
504-
}
505512
}
506513
.gridWire {
507514
.wire {

src/js/msp/MSPHelper.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,9 +1170,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
11701170
let ledCount = (data.byteLength - 2) / 4;
11711171

11721172
// The 32 bit config of each LED contains these in LSB:
1173-
// +--------------------+--------------------+------------------+------------------+----------------------+-----------+-----------+
1174-
// | Parameters - 3 bit | Directions - 6 bit | Color ID - 4 bit | Overlays - 7 bit | Function ID - 4 bit | X - 4 bit | Y - 4 bit |
1175-
// +--------------------+--------------------+------------------+------------------+----------------------+-----------+-----------+
1173+
// +----------------------------------------------------------------------------------------------------------+
1174+
// | Directions - 6 bit | Color ID - 4 bit | Overlays - 10 bit | Function ID - 4 bit | X - 4 bit | Y - 4 bit |
1175+
// +----------------------------------------------------------------------------------------------------------+
11761176
// According to betaflight/src/main/msp/msp.c
11771177
// API 1.41 - add indicator for advanced profile support and the current profile selection
11781178
// 0 = basic ledstrip available
@@ -1196,14 +1196,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
11961196
}
11971197
}
11981198

1199-
const overlayMask = (mask >> 12) & 0x7F;
1199+
const overlayMask = (mask >> 12) & 0x3FF;
12001200
for (let overlayLetterIndex = 0; overlayLetterIndex < ledOverlayLetters.length; overlayLetterIndex++) {
12011201
if (bit_check(overlayMask, overlayLetterIndex)) {
12021202
functions.push(ledOverlayLetters[overlayLetterIndex]);
12031203
}
12041204
}
12051205

1206-
const directionMask = (mask >> 23) & 0x3F;
1206+
const directionMask = (mask >> 26) & 0x3F;
12071207
const directions = [];
12081208
for (let directionLetterIndex = 0; directionLetterIndex < ledDirectionLetters.length; directionLetterIndex++) {
12091209
if (bit_check(directionMask, directionLetterIndex)) {
@@ -1214,9 +1214,8 @@ MspHelper.prototype.process_data = function(dataHandler) {
12141214
y: (mask) & 0xF,
12151215
x: (mask >> 4) & 0xF,
12161216
functions: functions,
1217-
color: (mask >> 19) & 0xF,
1217+
color: (mask >> 22) & 0xF,
12181218
directions: directions,
1219-
parameters: (mask >>> 29) & 0x7,
12201219
};
12211220

12221221
FC.LED_STRIP.push(led);
@@ -2552,17 +2551,15 @@ MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) {
25522551
}
25532552
}
25542553

2555-
mask |= (led.color << 19);
2554+
mask |= (led.color << 22);
25562555

25572556
for (let directionLetterIndex = 0; directionLetterIndex < led.directions.length; directionLetterIndex++) {
25582557
const bitIndex = ledDirectionLetters.indexOf(led.directions[directionLetterIndex]);
25592558
if (bitIndex >= 0) {
2560-
mask |= bit_set(mask, bitIndex + 23);
2559+
mask |= bit_set(mask, bitIndex + 26);
25612560
}
25622561
}
25632562

2564-
mask |= (0 << 29); // parameters
2565-
25662563
buffer.push32(mask);
25672564
}
25682565
else {

src/js/tabs/led_strip.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -777,13 +777,6 @@ led_strip.initialize = function (callback, scrollPosition) {
777777
const activeFunction = $('select.functionSelect').val();
778778
$('select.functionSelect').addClass(activeFunction);
779779

780-
// >= 20
781-
// Show GPS (Func)
782-
// Hide RSSI (O/L), Blink (Func)
783-
// Show Battery, RSSI (Func), Larson (O/L), Blink (O/L), Landing (O/L)
784-
$(".extra_functions20").show();
785-
$(".mode_colors").show();
786-
787780
// set color modifiers (check-boxes) visibility
788781
$('.overlays').toggle(areOverlaysActive(activeFunction));
789782

@@ -795,13 +788,13 @@ led_strip.initialize = function (callback, scrollPosition) {
795788

796789
$('.vtxOverlay').toggle(isVtxActive(activeFunction));
797790

798-
$('.mode_colors').hide();
799-
800791
// set mode colors visibility
801-
802792
if (activeFunction === "function-f") {
803793
$('.mode_colors').show();
804794
}
795+
else {
796+
$('.mode_colors').hide();
797+
}
805798

806799
// set special colors visibility
807800
$('.special_colors').show();

src/tabs/led_strip.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@
3838

3939

4040
<div class="select">
41-
<span class="color_section" i18n="ledStripFunctionTitle"></span>
41+
<span i18n="ledStripFunctionTitle"></span>
4242
<select id="ledStripFunctionSelect" class="functionSelect">
4343
<option value="" i18n="ledStripFunctionNoneOption"></option>
4444
<option value="function-c" i18n="ledStripFunctionColorOption"></option>
4545
<option value="function-f" i18n="ledStripFunctionModesOption"></option>
4646
<option value="function-a" i18n="ledStripFunctionArmOption"></option>
47-
<option value="function-l" class="extra_functions20" i18n="ledStripFunctionBatteryOption"></option>
48-
<option value="function-s" class="extra_functions20" i18n="ledStripFunctionRSSIOption"></option>
49-
<option value="function-g" class="extra_functions20" i18n="ledStripFunctionGPSOption"></option>
47+
<option value="function-l" i18n="ledStripFunctionBatteryOption"></option>
48+
<option value="function-s" i18n="ledStripFunctionRSSIOption"></option>
49+
<option value="function-g" i18n="ledStripFunctionGPSOption"></option>
5050
<option value="function-r" i18n="ledStripFunctionRingOption"></option>
5151
</select>
5252
</div>
5353

5454

5555
<div class="modifiers">
56-
<span class="color_section" i18n="ledStripColorModifierTitle"></span>
56+
<span class="header" i18n="ledStripColorModifierTitle"></span>
5757
<div class="checkbox">
5858
<input type="checkbox" name="ThrottleHue" class="toggle function-t" />
5959
<label>
@@ -75,24 +75,24 @@
7575
</label>
7676
</div>
7777

78-
<div class="checkbox extra_functions20">
78+
<div class="checkbox">
7979
<input type="checkbox" name="LarsonScanner" class="toggle function-o" />
8080
<label> <span i18n="ledStripLarsonOverlay"></span></label>
8181
</div>
8282

83-
<div class="checkbox extra_functions20">
83+
<div class="checkbox">
8484
<input type="checkbox" name="blink" class="toggle function-b" />
8585
<label> <span i18n="ledStripBlinkAlwaysOverlay"></span></label>
8686
</div>
8787

88-
<div class="checkbox extra_functions20 rainbowOverlay">
88+
<div class="checkbox rainbowOverlay">
8989
<input type="checkbox" name="Rainbow" class="toggle function-y" />
9090
<label> <span i18n="ledStripRainbowOverlay"></span></label>
9191
</div>
9292
</div>
9393

9494
<div class="overlays">
95-
<span class="color_section" i18n="ledStripOverlayTitle"></span>
95+
<span class="header" i18n="ledStripOverlayTitle"></span>
9696
<div class="checkbox warningOverlay">
9797
<input type="checkbox" name="Warnings" class="toggle function-w" />
9898
<label> <span i18n="ledStripWarningsOverlay"></span></label>

0 commit comments

Comments
 (0)