Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit. Added Ant and PacMan effects #4536

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BobLoeffler68
Copy link

@BobLoeffler68 BobLoeffler68 commented Feb 3, 2025

I added two new effects: Ant and PacMan Please take a look at them and test them and make any suggestions. I'm a noob at this, so I will probably code these in the most inefficient manner. :-) I don't know if the speeds are going to be good on other esp chips (e.g. ESP8266). I've only tested on an ESP32 WROOM 32D so far. Both effects are pretty rough right now and experts could make them so much better, I would think. I want to add at least another feature to reverse the direction of the PacMan effect.

Summary by CodeRabbit

  • New Features
    • Added new LED animation modes “Ants” and “Pac-Man” for enhanced visual effects.
    • Updated the Rolling Balls effect while removing an outdated effect.
  • Chores
    • Streamlined the configuration by focusing on a single target environment.
    • Increased the upload speed for improved performance.

@blazoncek
Copy link
Collaborator

Thanks.
You'll need to revert changes in platformio.ini and package-lock.json

@DedeHai DedeHai added the effect label Feb 3, 2025
@DedeHai
Copy link
Collaborator

DedeHai commented Feb 3, 2025

I like the general idea of this effect and the animation is well done.
Suggestions:

  • you should return FRAMETIME as anything else is legacy and leads to problems with transitions and overlay
  • IMHO it should be more versatile by user-selectable number of yellow dots, selectable overall-speed and maybe white-dot spacing

maybe I have some more points after testing :)

@BobLoeffler68
Copy link
Author

Thanks. You'll need to revert changes in platformio.ini and package-lock.json

How do I revert changes to those two files in Github Desktop?

@BobLoeffler68
Copy link
Author

I like the general idea of this effect and the animation is well done. Suggestions:

Thanks!

  • you should return FRAMETIME as anything else is legacy and leads to problems with transitions and overlay

Yes, I knew changing the FRAMETIME would be ugly because it slows down the FPS rate, but I couldn't figure out how to do it any other way. Do you have a suggestion of how to do it after looking at the code?

  • IMHO it should be more versatile by user-selectable number of yellow dots, selectable overall-speed and maybe white-dot spacing

Ah, good idea with the user-selectable yellow dots.

The speed is selectable with that first slider, but that is doing it by changing the FRAMETIME. I need a suggestion for a better way to do it. :-(

Yes, white dot spacing would be good to make it more obvious that PacMan is eating the dots.

maybe I have some more points after testing :)

That would be awesome! I am planning on changing the direction that they start moving. Right now they move from LED 0 to SEGLEN, so I will add an option checkbox to start them moving from SEGLEN to 0.

Thanks!

@DedeHai
Copy link
Collaborator

DedeHai commented Feb 4, 2025

Yes, I knew changing the FRAMETIME would be ugly because it slows down the FPS rate, but I couldn't figure out how to do it any other way. Do you have a suggestion of how to do it after looking at the code?

you need to render every frame, meaning rendering the same frame again if time has not advanced enough between calls.

That would be awesome! I am planning on changing the direction that they start moving. Right now they move from LED 0 to SEGLEN, so I will add an option checkbox to start them moving from SEGLEN to 0.

that can be done by selecting "reverse" on the segment as well

@BobLoeffler68
Copy link
Author

you need to render every frame, meaning rendering the same frame again if time has not advanced enough between calls.

Rendering every frame is still a new concept to me. :-) Thanks.

that can be done by selecting "reverse" on the segment as well

Oh, that's right! I won't worry about that one and will check that off of my list. :-)

@DedeHai
Copy link
Collaborator

DedeHai commented Feb 4, 2025

I tested the two effects, I found this:

  • first run of pacman does not clear / initialize correctly
  • ants sometimes randomly disappear (or shrink?) for a brief moment

wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated

antSize = map(SEGMENT.custom1, 0, 255, 1, 5); // the size/length of each ant is user selectable (1 to 5 pixels) with a slider

uint8_t bgColorIdx = map(SEGMENT.custom2, 0, 255, 0, 5); // background color based on the what the user selects from the Background Color slider
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could use one of the WLED colors, COLOR1 I think is usually used for background, that way any color can be selected by the user.

Copy link
Author

Choose a reason for hiding this comment

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

True, but the way I did it allows the user to have 3 different colored ants instead of only 2. I guess we can see what the users want after they play with it a little.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I used a palette and got a lot more than 3 ant colors

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let me chime in.
You can use color_from_palette() to select color from selected palette or predefined color slot.

uint32_t fgColor = SEGMENT.color_from_palette(i, (true|false), (true|false), 0, [bri]);
uint32_t bgColor = SEGMENT.color_from_palette(i, (true|false), (true|false), 1, [bri]);

If user selects "default" palette, color slot will be used otherwise palette entry will be used.

You can also use, in a similar fashion, SEGMENT.color_wheel(index).

Copy link
Author

Choose a reason for hiding this comment

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

Let me chime in. You can use color_from_palette() to select color from selected palette or predefined color slot.

uint32_t fgColor = SEGMENT.color_from_palette(i, (true|false), (true|false), 0, [bri]);
uint32_t bgColor = SEGMENT.color_from_palette(i, (true|false), (true|false), 1, [bri]);

If user selects "default" palette, color slot will be used otherwise palette entry will be used.

You can also use, in a similar fashion, SEGMENT.color_wheel(index).

Can the user select the 3 specific colors that they want? Or will it be random colors? A random option would be nice, but I also want them to be able to select 3 specific colors of their choice.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can do all that: there is the "auto generated" palettes from 2 or 3 colors, so if you choose the correct "hue" index it will use the three selected colors. Or make it a checkmark to use colors instead of palette or use color_wheel() which I think does either use colors or palette.
you can use one of the checkmarks as well to do "random colors" and then just assign a random hue index instead of fixed ones for more variation.
Just look at those functions (color from palette and colorwheel) and experiment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Color slots are just slots for stored color values. How you use them is up to you.
I have merely provided information how you can use best of both worlds: color slots and palettes.

The magic word is "Default palette". Default palette behaves a bit differently than other palettes as it is not necessarily a palette (as shown above). It can be color slot 0, 1 or 2 depending on how you choose to use it.

Copy link
Author

Choose a reason for hiding this comment

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

you can do all that: there is the "auto generated" palettes from 2 or 3 colors, so if you choose the correct "hue" index it will use the three selected colors. Or make it a checkmark to use colors instead of palette or use color_wheel() which I think does either use colors or palette. you can use one of the checkmarks as well to do "random colors" and then just assign a random hue index instead of fixed ones for more variation. Just look at those functions (color from palette and colorwheel) and experiment.

Ok, thx.

Copy link
Author

Choose a reason for hiding this comment

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

Color slots are just slots for stored color values. How you use them is up to you. I have merely provided information how you can use best of both worlds: color slots and palettes.

The magic word is "Default palette". Default palette behaves a bit differently than other palettes as it is not necessarily a palette (as shown above). It can be color slot 0, 1 or 2 depending on how you choose to use it.

Ok, thx. Lots to think about. :-)

wled00/FX.cpp Outdated Show resolved Hide resolved
ants[i].height = thisHeight;
}
// check if reached past the end of the strip. If so, wrap around.
if (thisHeight >= 1.0f && ants[i].velocity > 0.0f) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

in general, this effect may also be done with my particle system, the code would be much simpler as the system will handle bounce between ants and wrap around, just need to handle the confused ants "manually". you can take a look at the "PS pinball" effect to see if you like that look.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, thanks for the suggestion. I'll look at that effect and code.

wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
@BobLoeffler68
Copy link
Author

I tested the two effects, I found this:

Thanks for testing!

  • first run of pacman does not clear / initialize correctly

It should work if you set the Transition to 0.

  • ants sometimes randomly disappear (or shrink?) for a brief moment

An ant can "merge" with another ant of the same color, so it looks like it disappears, but it's just using the same LEDs as another ant. That is probably what you are seeing. I haven't seen any actually disappear or shrink.

@blazoncek
Copy link
Collaborator

It should work if you set the Transition to 0.

Do not assume such approach. The effect has to handle everything.

@BobLoeffler68
Copy link
Author

It should work if you set the Transition to 0.

Do not assume such approach. The effect has to handle everything.

Good point. Is there a way to set the transition to 0 in the code?

@DedeHai
Copy link
Collaborator

DedeHai commented Feb 5, 2025

It should work if you set the Transition to 0.

Do not assume such approach. The effect has to handle everything.

Good point. Is there a way to set the transition to 0 in the code?

no, you need to handle transitions in the FX.

@blazoncek
Copy link
Collaborator

Is there a way to set the transition to 0 in the code?

There is, but you don't do that from effect. You have to handle transitions (if needed at all).
@DedeHai has provided valuable information on how to do that.

@blazoncek
Copy link
Collaborator

How do I revert changes to those two files in Github Desktop?

I don't use Github Desktop app but here are some instructions for git:
https://git-scm.com/book/ms/v2/Git-Basics-Undoing-Things
https://stackoverflow.com/questions/2733873/how-can-i-revert-a-single-file-to-a-previous-version

Basically you check-out a file from previous commit. And then commit it again.

NEVER FORCE PUSH YOUR CHANGES!

@BobLoeffler68
Copy link
Author

How do I revert changes to those two files in Github Desktop?

I don't use Github Desktop app but here are some instructions for git: https://git-scm.com/book/ms/v2/Git-Basics-Undoing-Things https://stackoverflow.com/questions/2733873/how-can-i-revert-a-single-file-to-a-previous-version

Basically you check-out a file from previous commit. And then commit it again.

NEVER FORCE PUSH YOUR CHANGES!

I think I did the reverts correctly, but I can't tell from the messages that came back. WLED-AC is my working directory.
Here is what I performed:

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git status
On branch pr-ant-and-pacman-modes
Your branch is up to date with 'BobLoeffler68/pr-ant-and-pacman-modes'.
nothing to commit, working tree clean

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- package-lock.json

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- platformio.ini

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git status
On branch pr-ant-and-pacman-modes
Your branch is up to date with 'BobLoeffler68/pr-ant-and-pacman-modes'.
nothing to commit, working tree clean

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git commit -m "Reverted 2 files"
On branch pr-ant-and-pacman-modes
Your branch is up to date with 'BobLoeffler68/pr-ant-and-pacman-modes'.
nothing to commit, working tree clean

Does it look like I did it correctly? I also tried the full file path of the two files when the checkouts didn't give me any feedback:

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- C:\Users\boblo\Documents\GitHub\repos\WLED-AC\package-lock.json

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- C:\Users\boblo\Documents\GitHub\repos\WLED-AC\platformio.ini

I have not done a push yet after running the commands above.

@blazoncek
Copy link
Collaborator

git checkout <commit> -- path/to/filespec is the correct way to revert a file to a previous commit.

@BobLoeffler68
Copy link
Author

git checkout -- path/to/filespec is the correct way to revert a file to a previous commit.

So these should've worked, right?

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- C:\Users\boblo\Documents\GitHub\repos\WLED-AC\package-lock.json

C:\Users\boblo\Documents\GitHub\repos\WLED-AC>git checkout 34d0f17 -- C:\Users\boblo\Documents\GitHub\repos\WLED-AC\platformio.ini

I saw several websites that said that you can use just the filename of the file if you were running the command from the working directory. But I'll use the full file path from now on. Thanks.

@netmindz
Copy link
Member

netmindz commented Feb 9, 2025

@coderabbitai review

Copy link

coderabbitai bot commented Feb 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

coderabbitai bot commented Feb 9, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request updates the project configuration and LED effect implementations. In platformio.ini, the default environment is changed to esp32dev and the upload speed increased. In the WLED effect files, two new effect modes—"ants" and "pacman"—are added, the "rolling_balls" effect is modified, and "mode_racers" is removed. Additionally, the header file is updated to define new effect mode constants and adjust the total mode count.

Changes

Files Change Summary
platformio.ini Updated "default_envs" to "esp32dev" (commenting out multiple defaults) and increased "upload_speed" from 115200 to 921600.
wled00/FX.cpp, wled00/FX.h Added new LED effects (mode_ants, mode_pacman), modified rolling_balls function, commented out mode_racers, updated effect registration in setupEffectData, and revised mode constants with an increased MODE_COUNT (from 187 to 189).

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Controller as WLED Controller
    participant Data as Effect Data Setup
    participant LED as LED Strip

    User->>Controller: Select LED effect mode
    Controller->>Data: Load effect data (including new modes)
    alt "Ants" effect selected
        Controller->>Controller: Execute mode_ants()
    else "Pacman" effect selected
        Controller->>Controller: Execute mode_pacman()
    else Other effect selected
        Controller->>Controller: Execute existing effect
    end
    Controller->>LED: Update LED display
Loading

🪧 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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

@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 (6)
wled00/FX.cpp (6)

3023-3024: Consider using a more descriptive struct name

The struct name RollingBall is being used for both rolling balls and ants effects. Consider renaming it to something more generic like MovingObject or creating separate structs for better code clarity.

-typedef struct RollingBall {                                          // used for rolling_balls and Ants modes
+typedef struct MovingObject {                                         // used for rolling_balls and Ants modes

3133-3136: Consider using constexpr for compile-time constants

The magic numbers used for array sizes and limits could be defined as constexpr values for better maintainability.

-  uint32_t bgcolor = BLACK;
-  uint8_t antSize = 1;
-  const uint16_t maxNumAnts = 32;                                 // 255/16 + 1 ( * 2 ?????)
-  uint16_t dataSize = sizeof(rball_t) * maxNumAnts;
+  static constexpr uint16_t MAX_ANTS = 32;                       // Maximum number of ants
+  static constexpr uint8_t DEFAULT_ANT_SIZE = 1;
+  uint32_t bgcolor = BLACK;
+  uint8_t antSize = DEFAULT_ANT_SIZE;
+  uint16_t dataSize = sizeof(rball_t) * MAX_ANTS;

3243-3247: Consider using bit fields to reduce memory usage

The PacManChars struct could use bit fields to reduce memory usage since some fields don't need full bytes.

typedef struct PacManChars {
-  uint16_t  pos;
-  uint8_t   size;
-  uint32_t  color;
+  uint16_t  pos;    // Position needs full range
+  uint8_t   size:4; // Size likely won't exceed 15
+  uint32_t  color;  // Color needs full 32 bits
} pacmancharacters_t;

3386-3388: Consider using a constant for timing value

The hardcoded timing value could be defined as a constant for better maintainability.

+  static constexpr uint16_t PACMAN_FRAME_TIME = 20;
-  return 20 + ((22 * (uint32_t)(255 - SEGMENT.speed)) / SEGLEN);                // FRAMETIME and FRAMETIME_FIXED were too fast
+  return PACMAN_FRAME_TIME + ((22 * (uint32_t)(255 - SEGMENT.speed)) / SEGLEN); // Custom timing for smooth animation

7944-7965: Consider adding bounds checking for effect IDs

The addEffect function could benefit from additional bounds checking and error handling.

uint8_t WS2812FX::addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name) {
+  if (mode_fn == nullptr || mode_name == nullptr) return 255; // Invalid parameters
+  
  if (id == 255) { // find empty slot
    for (size_t i=1; i<_mode.size(); i++) if (_modeData[i] == _data_RESERVED) { id = i; break; }
  }

7967-7975: Consider using std::vector::reserve for performance

Pre-allocating vector capacity could improve performance during initialization.

void WS2812FX::setupEffectData() {
+  _mode.reserve(_modeCount);     // Pre-allocate capacity
+  _modeData.reserve(_modeCount); // Pre-allocate capacity
  // Solid must be first! (assuming vector is empty upon call to setup)
  _mode.push_back(&mode_static);
  _modeData.push_back(_data_FX_MODE_STATIC);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b64cd36 and 34d0f17.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • platformio.ini (2 hunks)
  • wled00/FX.cpp (3 hunks)
  • wled00/FX.h (1 hunks)
🔇 Additional comments (4)
wled00/FX.h (2)

329-329: Mode count updated correctly.

The MODE_COUNT is correctly updated to 189 to account for the two new effect modes (FX_MODE_ANTS and FX_MODE_PACMAN).


325-327: New effect modes added.

The addition of FX_MODE_ANTS and FX_MODE_PACMAN effects aligns with the PR objectives. However, FX_MODE_RACERS is commented out, which suggests it was initially planned but removed.

Let's verify if there are any references to the commented-out mode:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for any references to FX_MODE_RACERS in the codebase
rg "FX_MODE_RACERS|mode_racers"

Length of output: 171


FX_MODE_RACERS confirmed as intentionally disabled.
The search results show that all references to FX_MODE_RACERS—both in wled00/FX.h and wled00/FX.cpp—are commented out. This indicates that the removal/replacement of FX_MODE_RACERS was deliberate. The addition of FX_MODE_ANTS and FX_MODE_PACMAN, along with the updated mode count, aligns well with the PR objectives.

platformio.ini (2)

13-14: Default Environment Configuration Change
The changes here narrow the default board selection to only esp32dev by commenting out the original multi-board list and then setting “default_envs = esp32dev.” Given the community feedback requesting a reversion of unintended configuration changes, please confirm if this restriction is intentional. Limiting the environments could reduce testing flexibility, especially as the effects were originally noted for potential issues on other ESP chips.

Also applies to: 21-21


130-130: Upload Speed Parameter Update
The upload_speed setting has been increased from 115200 to 921600. While a higher upload speed can accelerate firmware deployment on ESP32, it might introduce compatibility issues on other boards. Considering prior feedback about reverting some changes in platformio.ini, please verify whether this adjustment is needed solely for the new visual effects or if it should remain unchanged to support broader hardware compatibility.

wled00/FX.cpp Show resolved Hide resolved
platformio.ini Outdated Show resolved Hide resolved
platformio.ini Outdated Show resolved Hide resolved
platformio.ini Outdated Show resolved Hide resolved
Ants
----
- Made the number of ants more dynamically user-selectable.
- The size of ants can now be up to 20 pixels wide.
- Changed random() and random16() to hw_random() and hw_random16().
- Fixed a few suggestions by CodeRabbit

TODO:
- Foreground and background color selection needs to be improved.
  The current way of setting the background color is very clunky
  (with slider wled-dev#4).

PacMan
------
- constexpr instead of const
- return mode_static() on short segments (15 or less pixels)
- made use of numGhosts intead of hard-coded integers
- now using aux0 for binary flags (DIRECTION_FLAG and GHOSTSBLUE_FLAG)
- now using aux1 for the timer tick count
- reworked timing to draw moving characters and power dot
- now returning FRAMETIME correctly

TODO:
- Speed adjustments?
- Transition from previous FX is not looking good. It is supposed to
  wipe out any pixels by making them black. Then draw whitish dots
  every other pixel if the White Dots checkbox is enabled. But there
  are usually colored pixels still displayed from the previous FX.
Copy link
Collaborator

@blazoncek blazoncek left a comment

Choose a reason for hiding this comment

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

I would like you to also remove changes to package-lock.json and reuse removed effects IDs (marked in the source) for new effects.

Otherwise the code is clean and readable, no comments there.

wled00/FX.h Outdated Show resolved Hide resolved
wled00/FX.cpp Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated Show resolved Hide resolved
wled00/FX.cpp Outdated
@@ -3124,38 +3124,27 @@ static const char _data_FX_MODE_ROLLINGBALLS[] PROGMEM = "Rolling Balls@!,# of b
* First slider is for the ants' speed.
* Second slider is for the # of ants.
* Third slider is for the Ants' size.
*
* Checkbox1 is for using the palettes (enabled) or the color slots (disabled)
Copy link
Collaborator

@DedeHai DedeHai Feb 14, 2025

Choose a reason for hiding this comment

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

in other FX, this is also done using something like if(palette==0) which is the "default" palette at the top.

wled00/FX.cpp Show resolved Hide resolved
@BobLoeffler68
Copy link
Author

  • ants sometimes randomly disappear (or shrink?) for a brief moment

I found that this was happening when one of the ant colors was the same as the background color (e.g. a black ant on a black background). You couldn't see that there was an ant there, until a different colored ant moved over it and then you would see just one or two pixels. I fixed this so that the ant color will never be the background color if the user is using the color slots. But it can still happen if they use a palette that has the same color as the background. I don't think it will be a problem most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants