Skip to content

Commit

Permalink
Add MSP support for led profile and status (betaflight#3671)
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Dec 15, 2023
1 parent 3dcc41f commit b8da48a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const FC = {
LED_COLORS: null,
LED_MODE_COLORS: null,
LED_STRIP: null,
LED_STRIP_CONFIG: null,
LED_CONFIG_VALUES: [],
MISC: null, // DEPRECATED
MIXER_CONFIG: null,
Expand Down Expand Up @@ -210,6 +211,7 @@ const FC = {
};

this.LED_STRIP = [];
this.LED_STRIP_CONFIG = [];
this.LED_COLORS = [];
this.LED_MODE_COLORS = [];

Expand Down
7 changes: 7 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.LED_STRIP.push(led);
}
}

FC.LED_STRIP_CONFIG.status = data.readU8(); // basic or advanced
FC.LED_STRIP_CONFIG.profile = data.readU8();

break;
case MSPCodes.MSP_SET_LED_STRIP_CONFIG:
console.log('Led strip config saved');
Expand Down Expand Up @@ -2604,6 +2608,9 @@ MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) {
nextFunction = onCompleteCallback;
}

buffer.push8(FC.LED_STRIP_CONFIG.status); // basic or advanced
buffer.push8(FC.LED_STRIP_CONFIG.profile);

MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG, buffer, false, nextFunction);
}
};
Expand Down

0 comments on commit b8da48a

Please sign in to comment.