Merge pull request #704 from keyboardio/led-palette-theme/led-count

LEDPaletteTheme: Use the number of LEDs, not number of keys
pull/711/head
Jesse Vincent 5 years ago committed by GitHub
commit 10537e7f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,16 +28,16 @@ uint16_t LEDPaletteTheme::reserveThemes(uint8_t max_themes) {
if (!palette_base_) if (!palette_base_)
palette_base_ = ::EEPROMSettings.requestSlice(16 * sizeof(cRGB)); palette_base_ = ::EEPROMSettings.requestSlice(16 * sizeof(cRGB));
return ::EEPROMSettings.requestSlice(max_themes * KeyboardHardware.numKeys() / 2); return ::EEPROMSettings.requestSlice(max_themes * KeyboardHardware.led_count / 2);
} }
void LEDPaletteTheme::updateHandler(uint16_t theme_base, uint8_t theme) { void LEDPaletteTheme::updateHandler(uint16_t theme_base, uint8_t theme) {
if (!Kaleidoscope.has_leds) if (!Kaleidoscope.has_leds)
return; return;
uint16_t map_base = theme_base + (theme * KeyboardHardware.numKeys() / 2); uint16_t map_base = theme_base + (theme * KeyboardHardware.led_count / 2);
for (uint8_t pos = 0; pos < KeyboardHardware.numKeys(); pos++) { for (uint8_t pos = 0; pos < KeyboardHardware.led_count; pos++) {
cRGB color = lookupColorAtPosition(map_base, pos); cRGB color = lookupColorAtPosition(map_base, pos);
::LEDControl.setCrgbAt(pos, color); ::LEDControl.setCrgbAt(pos, color);
} }
@ -47,7 +47,7 @@ void LEDPaletteTheme::refreshAt(uint16_t theme_base, uint8_t theme, KeyAddr key_
if (!Kaleidoscope.has_leds) if (!Kaleidoscope.has_leds)
return; return;
uint16_t map_base = theme_base + (theme * KeyboardHardware.numKeys() / 2); uint16_t map_base = theme_base + (theme * KeyboardHardware.led_count / 2);
uint8_t pos = KeyboardHardware.getLedIndex(key_addr); uint8_t pos = KeyboardHardware.getLedIndex(key_addr);
cRGB color = lookupColorAtPosition(map_base, pos); cRGB color = lookupColorAtPosition(map_base, pos);
@ -151,7 +151,7 @@ EventHandlerResult LEDPaletteTheme::themeFocusEvent(const char *command,
if (strcmp_P(command, expected_command) != 0) if (strcmp_P(command, expected_command) != 0)
return EventHandlerResult::OK; return EventHandlerResult::OK;
uint16_t max_index = (max_themes * KeyboardHardware.numKeys()) / 2; uint16_t max_index = (max_themes * KeyboardHardware.led_count) / 2;
if (::Focus.isEOL()) { if (::Focus.isEOL()) {
for (uint16_t pos = 0; pos < max_index; pos++) { for (uint16_t pos = 0; pos < max_index; pos++) {

Loading…
Cancel
Save