Skip to content

Commit

Permalink
Make Daryl happy
Browse files Browse the repository at this point in the history
  • Loading branch information
computergeek1507 committed Dec 29, 2024
1 parent f10ab46 commit 068b052
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xLights/ValueCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <log4cpp/Category.hh>

#include <limits>

AudioManager* ValueCurve::__audioManager = nullptr;
SequenceElements* ValueCurve::__sequenceElements = nullptr;

Expand Down Expand Up @@ -2203,7 +2205,11 @@ void ValueCurve::ScaleAndOffsetValues(float scale, int offset)
return;
}
float range = _max - _min;
auto ScaleVal = [&](float val)
if (std::abs(range) <= std::numeric_limits<float>::epsilon()) {
wxASSERT(false); // should be zero
return;
}
auto ScaleVal = [&](float val) -> float
{
const float valScaled = val * range;//0-255
float newVal = (valScaled * (scale * _divisor)) + (offset * _divisor);
Expand Down

1 comment on commit 068b052

@derwin12
Copy link
Collaborator

Choose a reason for hiding this comment

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

A Happy Daryl is a Happy xLights user 👍

Please sign in to comment.