Skip to content

Conversation

@mdwn
Copy link
Owner

@mdwn mdwn commented Dec 18, 2025

Refactor so that the lighting engine is simplified. Refactored the effects so that there's less repetition.


Note

Refactors lighting engine, effects, and parsers to remove duplication with shared helpers, simplify conflict/processing logic, and expose is_multiplier_channel.

  • Engine:
    • Extracts format_effect_for_logging and preserve_conflicting_permanent_effects; avoids unnecessary clones; tweaks layer speed handling and effect ordering; simplifies conflict checks and blend-mode compatibility in engine/layers.rs.
    • Uses is_multiplier_channel when filtering locked channels; streamlines multiplier key removal on temporary effect completion.
  • Effects:
    • Exports is_multiplier_channel from effects and defines it in state.
    • color.rs: refactors HSV→RGB via sector mapping; adds small lerp helper.
    • fixture.rs: adds layer_suffix; DRYs multiplier keys (_dimmer_mult*, _pulse_mult*) and normalizes RGB u8f64.
    • state.rs: minor DMX multiplier consolidation and readability tweaks.
    • tempo_aware.rs: adds rate/measure/beat conversion helpers; consolidates duration→rate logic.
  • Processing:
    • Adds cycle_progress, phase, and calculate_color_indices; reuses across color cycle, strobe, chase, rainbow, and pulse; applies crossfade uniformly; simplifies dimmer path.
  • Parser:
    • effect_parse.rs and show.rs: introduce helpers (color normalization, score-time/offset math, sequence duration/loop parsing); replace repeated logic and centralize sequence ref parsing.

Written by Cursor Bugbot for commit f467150. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 17

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.


Bug: Direction parsing now unexpectedly lowercases input value

The Chase direction parameter parsing now uses clean_string_value() which applies to_lowercase(), but the original code only stripped quotes and trimmed whitespace without lowercasing. While pattern parsing intentionally used lowercase matching (with an explicit comment about "case-insensitive matching"), direction parsing deliberately did not. This DRY refactoring inadvertently changed the parsing behavior - previously "Right_To_Left" would fall through to the default, but now it would match "right_to_left". This may break existing content that relied on the case-sensitive behavior.

src/lighting/parser/effect_parse.rs#L446-L456

},
"direction" => {
*direction = match clean_string_value(value).as_str() {
"left_to_right" => ChaseDirection::LeftToRight,
"right_to_left" => ChaseDirection::RightToLeft,
"top_to_bottom" => ChaseDirection::TopToBottom,
"bottom_to_top" => ChaseDirection::BottomToTop,
"clockwise" => ChaseDirection::Clockwise,
"counter_clockwise" => ChaseDirection::CounterClockwise,
_ => ChaseDirection::LeftToRight,
};

Fix in Cursor Fix in Web


Refactor so that the lighting engine is simplified. Refactored the
effects so that there's less repetition.
@mdwn mdwn merged commit db158af into main Dec 20, 2025
7 checks passed
@mdwn mdwn deleted the chore/quality branch December 20, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants