rgb animations perf
This commit is contained in:
parent
c11984135a
commit
b6af43ef90
@ -289,6 +289,7 @@ class Firmware:
|
|||||||
if self.rgb_pixel_pin:
|
if self.rgb_pixel_pin:
|
||||||
self.pixels = rgb.RGB(self.rgb_config, self.rgb_pixel_pin)
|
self.pixels = rgb.RGB(self.rgb_config, self.rgb_pixel_pin)
|
||||||
self.rgb_config = None # No longer needed
|
self.rgb_config = None # No longer needed
|
||||||
|
self.pixels.loopcounter = 0
|
||||||
else:
|
else:
|
||||||
self.pixels = None
|
self.pixels = None
|
||||||
|
|
||||||
@ -351,7 +352,10 @@ class Firmware:
|
|||||||
self._send_hid()
|
self._send_hid()
|
||||||
|
|
||||||
if self.pixels and self.pixels.enabled and self.pixels.animation_mode:
|
if self.pixels and self.pixels.enabled and self.pixels.animation_mode:
|
||||||
self.pixels = self.pixels.animate()
|
self.pixels.loopcounter +=1
|
||||||
|
if self.pixels.loopcounter >= 7:
|
||||||
|
self.pixels = self.pixels.animate()
|
||||||
|
self.pixels.loopcounter = 0
|
||||||
|
|
||||||
if self.led and self.led.enabled and self.led.animation_mode:
|
if self.led and self.led.enabled and self.led.animation_mode:
|
||||||
self.led = self.led.animate()
|
self.led = self.led.animate()
|
||||||
|
35
kmk/rgb.py
35
kmk/rgb.py
@ -432,33 +432,30 @@ class RGB:
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def effect_breathing_rainbow(self):
|
def effect_breathing_rainbow(self):
|
||||||
if self._animation_step():
|
self.increase_hue(self.animation_speed)
|
||||||
self.increase_hue(self.animation_speed)
|
|
||||||
self.effect_breathing()
|
self.effect_breathing()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def effect_rainbow(self):
|
def effect_rainbow(self):
|
||||||
if self._animation_step():
|
self.increase_hue(self.animation_speed)
|
||||||
self.increase_hue(self.animation_speed)
|
self.set_hsv_fill(self.hue, self.sat, self.val)
|
||||||
self.set_hsv_fill(self.hue, self.sat, self.val)
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def effect_swirl(self):
|
def effect_swirl(self):
|
||||||
if self._animation_step():
|
self.increase_hue(self.animation_speed * 2)
|
||||||
self.increase_hue(self.animation_speed)
|
self.disable_auto_write = True # Turn off instantly showing
|
||||||
self.disable_auto_write = True # Turn off instantly showing
|
for i in range(0, self.num_pixels):
|
||||||
for i in range(0, self.num_pixels):
|
self.set_hsv(
|
||||||
self.set_hsv(
|
(self.hue - (i * self.num_pixels)) % 360,
|
||||||
(self.hue - (i * self.num_pixels)) % 360,
|
self.sat,
|
||||||
self.sat,
|
self.val,
|
||||||
self.val,
|
i)
|
||||||
i)
|
|
||||||
|
|
||||||
# Show final results
|
# Show final results
|
||||||
self.disable_auto_write = False # Resume showing changes
|
self.disable_auto_write = False # Resume showing changes
|
||||||
self.show()
|
self.show()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def effect_knight(self):
|
def effect_knight(self):
|
||||||
@ -476,9 +473,9 @@ class RGB:
|
|||||||
self.reverse_animation = not self.reverse_animation
|
self.reverse_animation = not self.reverse_animation
|
||||||
|
|
||||||
if self.reverse_animation:
|
if self.reverse_animation:
|
||||||
self.pos -= self.animation_speed / 5
|
self.pos -= self.animation_speed / 2
|
||||||
else:
|
else:
|
||||||
self.pos += self.animation_speed / 5
|
self.pos += self.animation_speed / 2
|
||||||
|
|
||||||
# Show final results
|
# Show final results
|
||||||
self.disable_auto_write = False # Resume showing changes
|
self.disable_auto_write = False # Resume showing changes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user