Skip to content

Conversation

@netmindz
Copy link
Collaborator

  • Usermod to be disabled by default to not clutter the list of effects too much
  • Disabling actually preventing the effects being listed (reboot required)
  • Updated library with fix for SM1
  • Pass speed slider to animartrix speed factor

@netmindz netmindz marked this pull request as ready for review June 29, 2023 11:54
if (SEGENV.call == 0) {
init(SEGMENT.virtualWidth(), SEGMENT.virtualHeight(), false);
}
float speedFactor = map(SEGMENT.speed, 0, 255, 1, 100) / 10;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This calc isn't right.

Requirements:
0 = 0.1
125 = 1.0
255 = 10.0

Problem: 125 currently returns 5.0

Copy link
Collaborator

@softhack007 softhack007 Jun 29, 2023

Choose a reason for hiding this comment

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

I think the easiest solution would be to split the mapping into two parts: <1.0 and >=1.0.
Also you need to use "mapf" as the mapped result is float.
something like

float speedFactor = 1.0f:
if (SEGMENT.speed < 128) speedFactor = mapf(SEGMENT.speed,   0, 127, 0.1f, 1.0f);
                    else speedFactor = mapf(SEGMENT.speed, 128, 255, 1.0f, 10.0f);

The small overlap at "1.0f" does not matter much - nobody will notice there is no difference between 127 and 128.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, didn't know about mapf (). Thought I might need to split into increase Vs decrease

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 grab mapf() here

https://github.com/MoonModules/WLED/blob/17147f3b5014fedf82a5ed6bd2aa75fedf2109e0/wled00/FX.cpp#L6205-L6209

actually its planned to make this function global, as WLED is starting to collect several copies of mapf() in unsermods..

@netmindz netmindz merged commit 40751b4 into MoonModules:mdev Jun 29, 2023
@netmindz netmindz deleted the animartrix-updates branch June 29, 2023 20:15
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