1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 04:15:28 +03:00

Allow LED strip colors to be used. Requires new firmware.

At the moment colors are only used by the thrust ring mode.
This commit is contained in:
Dominic Clifton 2015-01-23 02:12:20 +01:00
parent d045deb28f
commit a5de593da7
4 changed files with 121 additions and 49 deletions

View file

@ -94,7 +94,7 @@ var MSP = {
packet_error: 0,
ledDirectionLetters: ['n', 'e', 's', 'w', 'u', 'd'], // in LSB bit order
ledFunctionLetters: ['i', 'w', 'f', 'a', 't'], // in LSB bit order
ledFunctionLetters: ['i', 'w', 'f', 'a', 't', 'r'], // in LSB bit order
read: function (readInfo) {
var data = new Uint8Array(readInfo.data);
@ -620,7 +620,7 @@ var MSP = {
case MSP_codes.MSP_LED_STRIP_CONFIG:
LED_STRIP = [];
var ledCount = data.byteLength / 6; // v1.4.0 and below incorrectly reported 4 bytes per led.
var ledCount = data.byteLength / 7; // v1.4.0 and below incorrectly reported 4 bytes per led.
var offset = 0;
for (var i = 0; offset < data.byteLength && i < ledCount; i++) {
@ -649,7 +649,8 @@ var MSP = {
directions: directions,
functions: functions,
x: data.getUint8(offset++, 1),
y: data.getUint8(offset++, 1)
y: data.getUint8(offset++, 1),
color: data.getUint8(offset++, 1)
};
LED_STRIP.push(led);
@ -1045,6 +1046,8 @@ MSP.sendLedStripConfig = function(onCompleteCallback) {
buffer.push(led.x);
buffer.push(led.y);
buffer.push(led.color);
// prepare for next iteration
ledIndex++;