robertlipe / NightDriverStrip

NightDriver client for ESP32
https://plummerssoftwarellc.github.io/NightDriverStrip/
GNU General Public License v3.0
0 stars 0 forks source link

Put Snakes on caffeine #5

Open robertlipe opened 11 months ago

robertlipe commented 11 months ago

make faster

robertlipe commented 11 months ago

I think I see the disconnect here, @davepl . Snake speed is random when you encounter them (just like in the woods - eek!) and music both arouses and chills them. Upon beat detection, the speed is randomized further, with a downward bias to the current setting.

Spin up a local build, drop an #if 0 around the body of HandleBeat() (maybe an #undef ENABLE_AUDIO up at the top would be enough....) and see if you agree that our snakes are bookin'. The Snakes display is one of our higher fps animations, IIRC. (Could we maybe do > 30fps? It's "just" integer math....)

I'm showing a solid 30fps with a fairly terrifying number of snakes active, but if you happened ot get a low random draw and/or had enough background noise to lose the draw on setting Speed and Speedfactor , you may have just received prozac snakes instead of speed snakes. (There's some nightmare material for ya.)

I think it's overall an effect above the cutoff, though I wish we had collision detection. If we should just disable the audio randomization, I'm OK with that. It was a forced fit anyway and just made the snakes react to whatever I was playing at the time. If we need to shift the randomization up, I'm OK with that, too. But I don't think hthis is far off The List.

I could be wrong. Just losing the randomization as below was enough to make me think this is fast enough:

diff --git a/include/effects/matrix/PatternSMSnakes.h b/include/effects/matrix/PatternSMSnakes.h index 849d341..c7c63b0 100644 --- a/include/effects/matrix/PatternSMSnakes.h +++ b/include/effects/matrix/PatternSMSnakes.h @@ -293,6 +293,7 @@ class PatternSMSnakes : public LEDStripEffect

if ENABLE_AUDIO

 void HandleBeat(bool bMajor, float elapsed, float span) override
 {

+#if 0 // Kinda dumb, but make the snakes and the board visibly respond. It would // be nice to animate camera altitude pans or something, but changing all // the paramaters at runtine just makes the code explode. Settle for @@ -303,6 +304,7 @@ class PatternSMSnakes : public LEDStripEffect } Speed = 150 + random8(75) - 72; // 1-255 Setting speedfactor = (float)Speed / 555.0f + 0.001f; // The actually used class member. +#endif }

endif

};

(I) (loop)(C1) WiFi: WL_CONNECTED, IP: 192.168.2.165, Mem: 80404, LargestBlk: 47092, PSRAM Free: 973655/4173947, LED FPS: 31 Refresh: 60 Hz, Power: 2797 mW, Brite: 100%, Audio FPS: 41, MinVU: 210.8, PeakVU: 215.1, VURatio: 0.0 Buffer: 0/500, CPU: 060%, 044%, FreeDraw: 0.020 (I) (loop)(C1) WiFi: WL_CONNECTED, IP: 192.168.2.165, Mem: 80404, LargestBlk: 47092, PSRAM Free: 973127/4173931, LED FPS: 30 Refresh: 60 Hz, Power: 2797 mW, Brite: 100%, Audio FPS: 40, MinVU: 193.5, PeakVU: 203.1, VURatio: 0.1 Buffer: 0/500, CPU: 060%, 043%, FreeDraw: 0.013

LMK if you want the audio stuff deleted or if we should move Speed = 150 + random8(75) - 72; // 1-255 Setting up to give a higher bias that 150.

robertlipe commented 11 months ago

Those snakes seem pretty peppy to me. They're running at 250 of 255 and @davepl touched that line during 717fba204c486b6f9aa5ceb9bf86ef48a4650817, so I'll say thsi was written before he touched the code.

@davepl , if you disagree with closing this, reopen it and we'll see about removing/constrainging the speed variability based on audio.