Merge pull request #1243 from tlyu/fix-gamma

restore gamma correction on Model 100
master
Jesse Vincent 2 years ago committed by GitHub
commit be28b367ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -214,6 +214,7 @@ void Model100Side::sendLEDData() {
} }
} }
auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction;
void Model100Side::sendLEDBank(uint8_t bank) { void Model100Side::sendLEDBank(uint8_t bank) {
uint8_t data[LED_BYTES_PER_BANK + 1]; uint8_t data[LED_BYTES_PER_BANK + 1];
@ -229,25 +230,25 @@ void Model100Side::sendLEDBank(uint8_t bank) {
else else
c = 0; c = 0;
data[i + 1] = c; data[i + 1] = pgm_read_byte(&gamma8[c]);
} }
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
} }
void Model100Side::setAllLEDsTo(cRGB color) { void Model100Side::setAllLEDsTo(cRGB color) {
uint8_t data[] = {TWI_CMD_LED_SET_ALL_TO, uint8_t data[] = {TWI_CMD_LED_SET_ALL_TO,
color.b, pgm_read_byte(&gamma8[color.b]),
color.g, pgm_read_byte(&gamma8[color.g]),
color.r}; pgm_read_byte(&gamma8[color.r])};
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
} }
void Model100Side::setOneLEDTo(uint8_t led, cRGB color) { void Model100Side::setOneLEDTo(uint8_t led, cRGB color) {
uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO, uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO,
led, led,
color.b, pgm_read_byte(&gamma8[color.b]),
color.g, pgm_read_byte(&gamma8[color.g]),
color.r}; pgm_read_byte(&gamma8[color.r])};
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
} }

Loading…
Cancel
Save