Skip to content

Commit 65c552b

Browse files
authored
Merge pull request #141 from Legion2/fix-clear-color-buffer
clear all color channels
2 parents a0e5455 + dd34ee1 commit 65c552b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/FastLEDController.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ void FastLEDController::setLEDColorValues(uint8_t channel, uint8_t color, uint8_
498498
}
499499

500500
void FastLEDController::clearLEDColorValues(uint8_t channel) {
501-
memset(channelData[channel].valuesBuffer[0], 0, channelData[channel].ledCount);
501+
for (uint8_t*& buffer : channelData[channel].valuesBuffer) {
502+
memset(buffer, 0, channelData[channel].ledCount);
503+
}
502504
}
503505

504506
void FastLEDController::timeoutAction() {

src/LEDController.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ class LEDController : public ILEDController {
220220
*/
221221
virtual void setLEDExternalTemperature(uint8_t channel, uint16_t temp) = 0;
222222
virtual bool setLEDGroup(uint8_t channel, uint8_t groupIndex, LEDGroup& group);
223+
/**
224+
* Set the LED color values for one color-channel (red, green or blue) of the given channel.
225+
*
226+
* @param channel the channel index
227+
* @param color the color index to set the values for red(0), green(1), blue(2)
228+
* @param offset the offset in the LED colors buffer to write to
229+
* @param values the array of values to write
230+
* @param len the length of the array of values to write
231+
* @see clearLEDColorValues()
232+
*/
223233
virtual void setLEDColorValues(uint8_t channel, uint8_t color, uint8_t offset, const uint8_t* values,
224234
size_t len) = 0;
225235
/**
@@ -246,6 +256,12 @@ class LEDController : public ILEDController {
246256
* @return true if the port type was changed
247257
*/
248258
virtual bool setLEDPortType(uint8_t channel, PortType ledPortType);
259+
/**
260+
* Clear the LED color buffer for the given channel.
261+
*
262+
* @param channel the channel index
263+
* @see setLEDColorValues()
264+
*/
249265
virtual void clearLEDColorValues(uint8_t channel) = 0;
250266
virtual bool clearLEDGroups(uint8_t channel);
251267
virtual bool save() = 0;

0 commit comments

Comments
 (0)