FastLED 3.9.15
Loading...
Searching...
No Matches

◆ get_position()

FL_OPTIMIZATION_LEVEL_O0_BEGIN float get_position ( uint32_t now)

Definition at line 425 of file curr.h.

425 {
426 if (autoAdvance.value()) {
427 // Check if auto-advance was just enabled
428 // Auto-advance mode: increment smoothly from current position
429 float elapsedSeconds = float(now - lastUpdateTime) / 1000.0f;
430 float increment = elapsedSeconds * speed.value() *
431 0.3f; // Make it 1/20th the original speed
432 currentPosition = fmodf(currentPosition + increment, 1.0f);
433 lastUpdateTime = now;
434 return currentPosition;
435 } else {
436 // Manual mode: use the dual slider control
437 float combinedPosition = positionCoarse.value() + positionFine.value() + positionExtraFine.value();
438 // Clamp to ensure we don't exceed 1.0
439 if (combinedPosition > 1.0f)
440 combinedPosition = 1.0f;
441 return combinedPosition;
442 }
443}
uint16_t speed
Definition Noise.ino:63
UISlider positionCoarse("Position Coarse (10x)", 0.0f, 0.0f, 1.0f, 0.01f)
static float currentPosition
Definition curr.h:262
static uint32_t lastUpdateTime
Definition curr.h:263
UISlider positionFine("Position Fine (1x)", 0.0f, 0.0f, 0.1f, 0.001f)
UICheckbox autoAdvance("Auto Advance", true)
UISlider positionExtraFine("Position Extra Fine (0.1x)", 0.0f, 0.0f, 0.01f, 0.0001f)

References autoAdvance(), currentPosition, lastUpdateTime, positionCoarse(), positionExtraFine(), positionFine(), and speed.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: