|
@@ -66,6 +66,15 @@ bool is_rgblight_initialized = false;
|
|
LED_TYPE led[RGBLED_NUM];
|
|
LED_TYPE led[RGBLED_NUM];
|
|
bool rgblight_timer_enabled = false;
|
|
bool rgblight_timer_enabled = false;
|
|
|
|
|
|
|
|
+static uint8_t clipping_start_pos = 0;
|
|
|
|
+static uint8_t clipping_num_leds = RGBLED_NUM;
|
|
|
|
+
|
|
|
|
+void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) {
|
|
|
|
+ clipping_start_pos = start_pos;
|
|
|
|
+ clipping_num_leds = num_leds;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
|
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
|
uint8_t r = 0, g = 0, b = 0, base, color;
|
|
uint8_t r = 0, g = 0, b = 0, base, color;
|
|
|
|
|
|
@@ -621,7 +630,7 @@ void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) {
|
|
|| defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT)
|
|
|| defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT)
|
|
|
|
|
|
static uint8_t get_interval_time(const uint8_t* default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) {
|
|
static uint8_t get_interval_time(const uint8_t* default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) {
|
|
- return
|
|
|
|
|
|
+ return
|
|
#ifdef VELOCIKEY_ENABLE
|
|
#ifdef VELOCIKEY_ENABLE
|
|
velocikey_enabled() ? velocikey_match_speed(velocikey_min, velocikey_max) :
|
|
velocikey_enabled() ? velocikey_match_speed(velocikey_min, velocikey_max) :
|
|
#endif
|
|
#endif
|
|
@@ -668,21 +677,20 @@ void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val) {
|
|
|
|
|
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
|
void rgblight_set(void) {
|
|
void rgblight_set(void) {
|
|
|
|
+ LED_TYPE *start_led = led + clipping_start_pos;
|
|
|
|
+ uint16_t num_leds = clipping_num_leds;
|
|
if (rgblight_config.enable) {
|
|
if (rgblight_config.enable) {
|
|
- LED_TYPE *ledp;
|
|
|
|
#ifdef RGBLIGHT_LED_MAP
|
|
#ifdef RGBLIGHT_LED_MAP
|
|
LED_TYPE led0[RGBLED_NUM];
|
|
LED_TYPE led0[RGBLED_NUM];
|
|
for(uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
for(uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
led0[i] = led[pgm_read_byte(&led_map[i])];
|
|
led0[i] = led[pgm_read_byte(&led_map[i])];
|
|
}
|
|
}
|
|
- ledp = led0;
|
|
|
|
- #else
|
|
|
|
- ledp = led;
|
|
|
|
|
|
+ start_led = led0 + clipping_start_pos;
|
|
#endif
|
|
#endif
|
|
#ifdef RGBW
|
|
#ifdef RGBW
|
|
- ws2812_setleds_rgbw(ledp, RGBLED_NUM);
|
|
|
|
|
|
+ ws2812_setleds_rgbw(start_led, num_leds);
|
|
#else
|
|
#else
|
|
- ws2812_setleds(ledp, RGBLED_NUM);
|
|
|
|
|
|
+ ws2812_setleds(start_led, num_leds);
|
|
#endif
|
|
#endif
|
|
} else {
|
|
} else {
|
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
@@ -691,9 +699,9 @@ void rgblight_set(void) {
|
|
led[i].b = 0;
|
|
led[i].b = 0;
|
|
}
|
|
}
|
|
#ifdef RGBW
|
|
#ifdef RGBW
|
|
- ws2812_setleds_rgbw(led, RGBLED_NUM);
|
|
|
|
|
|
+ ws2812_setleds_rgbw(start_led, num_leds);
|
|
#else
|
|
#else
|
|
- ws2812_setleds(led, RGBLED_NUM);
|
|
|
|
|
|
+ ws2812_setleds(start_led, num_leds);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -813,7 +821,7 @@ void rgblight_effect_breathing(uint8_t interval) {
|
|
float val;
|
|
float val;
|
|
|
|
|
|
uint8_t interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[interval], 1, 100);
|
|
uint8_t interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[interval], 1, 100);
|
|
-
|
|
|
|
|
|
+
|
|
if (timer_elapsed(last_timer) < interval_time) {
|
|
if (timer_elapsed(last_timer) < interval_time) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|