1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-25 17:25:14 +03:00

Switch to new LED_STRIP_CONFIG_EX functions

This commit is contained in:
Marcelo Bezerra 2022-11-09 21:14:25 +01:00
parent 671b2fe49c
commit 2c545011a6
2 changed files with 13 additions and 9 deletions

View file

@ -2666,11 +2666,12 @@ var mspHelper = (function (gui) {
buffer.push(ledIndex); buffer.push(ledIndex);
var mask = 0; var mask = 0;
var extra = 0;
/* /*
ledDirectionLetters: ['n', 'e', 's', 'w', 'u', 'd'], // in LSB bit order ledDirectionLetters: ['n', 'e', 's', 'w', 'u', 'd'], // in LSB bit order
ledFunctionLetters: ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b', 'l'], // in LSB bit order ledFunctionLetters: ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b', 'l'], // in LSB bit order
ledBaseFunctionLetters: ['c', 'f', 'a', 'l', 's', 'g', 'r', 'h'], // in LSB bit ledBaseFunctionLetters: ['c', 'f', 'a', 'l', 's', 'g', 'r', 'h'], // in LSB bit
ledOverlayLetters: ['t', 'o', 'b', 'n', 'i', 'w'], // in LSB bit ledOverlayLetters: ['t', 'o', 'b', 'n', 'i', 'w', 'e'], // in LSB bit
*/ */
mask |= (led.y << 0); mask |= (led.y << 0);
@ -2688,29 +2689,32 @@ var mspHelper = (function (gui) {
bitIndex = MSP.ledOverlayLetters.indexOf(led.functions[overlayLetterIndex]); bitIndex = MSP.ledOverlayLetters.indexOf(led.functions[overlayLetterIndex]);
if (bitIndex >= 0) { if (bitIndex >= 0) {
mask |= bit_set(mask, bitIndex + 12); mask |= bit_set(mask, bitIndex + 16);
} }
} }
mask |= (led.color << 18); mask |= (led.color << 24);
for (directionLetterIndex = 0; directionLetterIndex < led.directions.length; directionLetterIndex++) { for (directionLetterIndex = 0; directionLetterIndex < led.directions.length; directionLetterIndex++) {
bitIndex = MSP.ledDirectionLetters.indexOf(led.directions[directionLetterIndex]); bitIndex = MSP.ledDirectionLetters.indexOf(led.directions[directionLetterIndex]);
if (bitIndex >= 0) { if (bitIndex >= 0) {
mask |= bit_set(mask, bitIndex + 22); if(bitIndex < 2) {
mask |= bit_set(mask, bitIndex + 2);
} else {
extra |= bit_set(exta, bitIndex - 2);
}
} }
} }
mask |= (0 << 28); // parameters extra |= (0 << 4); // parameters
buffer.push(specificByte(mask, 0)); buffer.push(specificByte(mask, 0));
buffer.push(specificByte(mask, 1)); buffer.push(specificByte(mask, 1));
buffer.push(specificByte(mask, 2)); buffer.push(specificByte(mask, 2));
buffer.push(specificByte(mask, 3)); buffer.push(specificByte(mask, 3));
buffer.push(specificByte(extra, 0));
// prepare for next iteration // prepare for next iteration
ledIndex++; ledIndex++;
@ -2718,7 +2722,7 @@ var mspHelper = (function (gui) {
nextFunction = onCompleteCallback; nextFunction = onCompleteCallback;
} }
MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG_EX, buffer, false, nextFunction);
} }
}; };

View file

@ -23,7 +23,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
} }
function load_led_config() { function load_led_config() {
MSP.send_message(MSPCodes.MSP_LED_STRIP_CONFIG, false, false, load_led_colors); MSP.send_message(MSPCodes.MSP_LED_STRIP_CONFIG_EX, false, false, load_led_colors);
} }
function load_led_colors() { function load_led_colors() {