Skip to content

Conversation

@casesolved-co-uk
Copy link

@casesolved-co-uk casesolved-co-uk commented Feb 10, 2024

v2 usermod for replicating the effect found on KITT, the car from the 80's TV show Knightrider.
The original effect was in Red, however, the usermod also supports palettes

Has 4 controls:

  • Speed
  • Tail length
  • Delay before start
  • Dual

Similar to Sinelon but uses triangular wave not sine.

Summary by CodeRabbit

  • New Features

    • Introduced a dynamic lighting effect inspired by the iconic Knight Rider KITT. This effect now offers multiple customizable color palettes and refined transitions.
  • Documentation

    • Added detailed setup instructions to guide users in enabling and configuring the new effect.

@blazoncek
Copy link
Contributor

That seems similar to K.I.T.T (Scanner and Scanner dual) existing effects.

@casesolved-co-uk
Copy link
Author

That seems similar to K.I.T.T (Scanner and Scanner dual) existing effects.

Yes, but there is no delay feature and this combines two effects into one

@blazoncek
Copy link
Contributor

Yes, but there is no delay feature and this combines two effects into one

I managed to test the effect but apart from the delay on one side of the scan it is no different than the mentioned Scanner.
If you do want "delay" why not on both sides of the scan? I admit this might be personal preference.

I was also wondering about modulus (%) used in the effect. It is quite inefficient.

What if we incorporate the delay into original effect?

@casesolved-co-uk
Copy link
Author

In the original show it was quite common to see intermittent scans, but the scan always did a full loop not one way. Plus the effect gets quite tiring if it is continuous.

Optimisation vs maintenance. A single division operation per segment once every 23ms? How many microseconds are saved, 0.01us?

I'd have thought changing the behaviour of an existing effect would be the last thing to suggest for backward compatibility.

@softhack007
Copy link
Member

Can we close this PR in favour of #3763 ? Or is this usermod still "sufficiently different" so to keep it open?

@casesolved-co-uk
Copy link
Author

Can we close this PR in favour of #3763 ? Or is this usermod still "sufficiently different" so to keep it open?

I was going to add support for 2D matrices but since blaz doesn't seem to like collaboration maybe he can add it to his. I don't have time.

@blazoncek
Copy link
Contributor

blaz doesn't seem to like collaboration

I did not know this. Thanks for enlightening me.

@softhack007 softhack007 added the rebase needed This PR needs to be re-based to the current development branch label Aug 15, 2024
@mishu28nmv
Copy link

Can someone please write this effect as found when you save the presets as json file?
I tried the Scanner dual and is nothing like KITT. Maybe something is wrong with my ESP32, but please someone, just upload this as this ex. for Xmas "115":{"on":true,"bri":125,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":150,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":125,"cct":127,"set":0,"col":[[255,0,0,0],[8,255,0,0],[255,255,255,0]],"fx":54,"sx":13,"ix":0,"pal":0,"c1":8,"c2":20,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":0,"m12":1},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}],"n":"Xmas Classic R/G/W","ql":"🎅"},

@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Hey! This pull request has been open for quite some time without any new comments now. It will be closed automatically in a week if no further activity occurs.
Thank you for contributing to WLED! ❤️

@github-actions github-actions bot added the stale This issue will be closed soon because of prolonged inactivity label Apr 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 4, 2025

Walkthrough

This change introduces a new usermod feature called KITT, which replicates the lighting effect inspired by the 1980s TV show Knight Rider. The update adds accompanying documentation, a new usermod class with methods for setup, effect processing, and identification, a new constant identifier in the configuration header, and registration code to enable the KITT effect when configured. All changes are integrated via new files and updates to existing ones.

Changes

File(s) Summary of Changes
usermods/...KITT/README.md
usermods/...KITT/usermod_v2_KITT.h
Added new documentation and implementation for the KITT usermod effect including the new KITTUsermod class with methods (setup, loop, getId) and configuration variables.
wled00/const.h
wled00/usermods_list.cpp
Introduced a new usermod ID (USERMOD_ID_KITT 45) and registered the KITT usermod via conditional inclusion and instantiation in the usermods registration function.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
usermods/usermod_v2_KITT/README.md (1)

1-8: Consider adding basic configuration instructions.
Currently, the README summarizes the concept and flags needed for compilation but doesn’t detail how to set up or tune the KITT effect parameters (speed, tail length, delay, dual mode). A short usage section clarifying these controls would help new users.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6f25a and d452cda.

📒 Files selected for processing (4)
  • usermods/usermod_v2_KITT/README.md (1 hunks)
  • usermods/usermod_v2_KITT/usermod_v2_KITT.h (1 hunks)
  • wled00/const.h (1 hunks)
  • wled00/usermods_list.cpp (2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
wled00/const.h (1)
usermods/usermod_v2_KITT/usermod_v2_KITT.h (1)
  • USERMOD_ID_KITT (62-64)
🔇 Additional comments (7)
wled00/const.h (1)

154-154: No issues with new usermod ID definition.
The newly introduced identifier USERMOD_ID_KITT correctly follows the existing pattern of usermod IDs. The skip of number 44 may be intentional or reserved; no immediate problems are detected.

wled00/usermods_list.cpp (2)

204-207: Include directive looks good.
The conditional inclusion of usermod_v2_KITT.h under #ifdef USERMOD_KITT follows the standard pattern and should safely integrate the KITT usermod without affecting others.


389-391: Registration logic appears correct.
Instantiating KITTUsermod under USERMOD_KITT is consistent with WLED’s approach for adding usermods, and no conflicts are apparent.

usermods/usermod_v2_KITT/usermod_v2_KITT.h (4)

8-49: The scanning logic is well-structured.

  1. Correctly handles single and multiple LED segments without off-by-one risks.
  2. Uses delays (SEGMENT.step) and position tracking (SEGMENT.aux0) to produce the forward/backward sweep.
  3. The fade-out invocation and optional dual reflection mode look logically sound.

51-65: Setup and metadata methods are clean.

  1. Registering the KITT mode via strip.addEffect() is consistent with WLED’s add-on model.
  2. loop() stub is acceptable if no continuous processing is needed.
  3. getId() aligns with the newly introduced constant in const.h.

67-69: Configuration string is concise and clear.
The string-based parameter definition for speed, tail, delay, and dual mode should integrate smoothly with WLED’s UI. No changes required.


1-7:

Details

✅ Verification successful

Verify effect number uniqueness.
Defining FX_MODE_KITT as 255 is fine if no other effect or usermod uses the same slot. Consider confirming it is indeed free to avoid any accidental collisions.


🏁 Script executed:

#!/bin/bash
# Description: Searching for existing definitions of FX_MODE_* as 255 across the codebase
rg -A 2 "FX_MODE_.*255"

Length of output: 596


Effect number uniqueness verified.

The search confirms that the only definition using the value 255 for an effect mode is in usermods/usermod_v2_KITT/usermod_v2_KITT.h for FX_MODE_KITT; no other effect or usermod defines an FX_MODE with this value. Although the number 255 appears elsewhere (e.g., as a brightness value in wled00/ir.cpp and within a string in wled00/FX.cpp), these do not indicate a conflict.

@DedeHai DedeHai closed this Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effect rebase needed This PR needs to be re-based to the current development branch stale This issue will be closed soon because of prolonged inactivity usermod usermod related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants