Last active
July 16, 2024 01:59
-
-
Save eqhmcow/b54e543d51b49f082f4f14e96ccfe2c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eqhmcow@DESKTOP-DLUP89P:~/Kaleidoscope/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin$ git diff | |
diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp | |
index 1b55ed43..e788ae1d 100644 | |
--- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp | |
+++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp | |
@@ -25,6 +25,7 @@ | |
#include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::... | |
#include "kaleidoscope/KeyEvent.h" // for KeyEvent | |
+#include "kaleidoscope/LiveKeys.h" // for live_keys | |
#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ | |
#include "kaleidoscope/device/device.h" // for Device, cRGB | |
#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult, EventHandlerRes... | |
@@ -115,6 +116,15 @@ void WavepoolEffect::TransientLEDMode::update() { | |
frames_since_event_++; | |
+ for (auto key_addr : KeyAddr::all()) { | |
+ // If key is active (held), set its animation position to the start | |
+ if (live_keys[key_addr] != Key_Inactive) { | |
+ surface_[page_][pgm_read_byte(rc2pos + key_addr.toInt())] = 0x7f; | |
+ frames_since_event_ = 0; | |
+ } | |
+ | |
+ } | |
+ | |
// needs two pages of height map to do the calculations | |
int8_t *newpg = &surface_[page_ ^ 1][0]; | |
int8_t *oldpg = &surface_[page_][0]; | |
@@ -193,10 +203,12 @@ void WavepoolEffect::TransientLEDMode::update() { | |
int8_t *p; | |
for (p = offsets, value = 0; p < offsets + 8; p++) | |
value += oldpg[offset + (*p)]; | |
- value = (value >> 2) - newpg[offset]; | |
+// value = (value >> 2) - newpg[offset]; | |
+ value = ((value >> 3) + (value >> 4)) - newpg[offset]; | |
// reduce intensity gradually over time | |
- newpg[offset] = value - (value >> 3); | |
+ //newpg[offset] = value - (value >> 3); | |
+ newpg[offset] = value - ((value >> 2) + (value >> 3)); | |
} | |
} | |
#ifdef INTERPOLATE | |
@@ -224,6 +236,8 @@ void WavepoolEffect::TransientLEDMode::update() { | |
hue = (current_hue + height + (height >> 1)) & 0xff; | |
} | |
+ hue = current_hue; | |
+ | |
cRGB color = hsvToRgb(hue, saturation, value); | |
::LEDControl.setCrgbAt(key_addr, color); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment