Fixed PWM values being off
This commit is contained in:
parent
ce26beffec
commit
5d314e7525
@ -4,10 +4,10 @@
|
|||||||
const uint8_t VersionMajor = 2;
|
const uint8_t VersionMajor = 2;
|
||||||
const uint8_t VersionMinor = 0;
|
const uint8_t VersionMinor = 0;
|
||||||
const uint8_t VersionPatch = 0;
|
const uint8_t VersionPatch = 0;
|
||||||
const uint8_t VersionMetadata = 34;
|
const uint8_t VersionMetadata = 35;
|
||||||
const char VersionBranch[] = "release/2.0";
|
const char VersionBranch[] = "release/2.0";
|
||||||
const char VersionSemVer[] = "2.0.0-beta.1";
|
const char VersionSemVer[] = "2.0.0-beta.1";
|
||||||
const char VersionFullSemVer[] = "2.0.0-beta.1+34";
|
const char VersionFullSemVer[] = "2.0.0-beta.1+35";
|
||||||
const char VersionCommitDate[] = "2018-02-03";
|
const char VersionCommitDate[] = "2018-02-03";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define SerialDebug
|
//#define SerialDebug
|
||||||
|
|
||||||
#ifdef SerialDebug
|
#ifdef SerialDebug
|
||||||
static const uint32_t SerialDebugBaudrate = 115200;
|
static const uint32_t SerialDebugBaudrate = 115200;
|
||||||
|
@ -207,12 +207,12 @@ uint16_t Stairs::getPWMValue(uint8_t step, uint8_t brightness)
|
|||||||
{
|
{
|
||||||
//_dln("Stairs :: Using curve");
|
//_dln("Stairs :: Using curve");
|
||||||
float factor = ((rangeEnd - rangeStart) + 1) * CurveFactor;
|
float factor = ((rangeEnd - rangeStart) + 1) * CurveFactor;
|
||||||
brightness = pow(2, ((brightness * LinearFactor) / factor)) - 1 + rangeStart;
|
pwmValue = pow(2, ((brightness * LinearFactor) / factor)) - 1 + rangeStart;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//_dln("Stairs :: Not using curve");
|
//_dln("Stairs :: Not using curve");
|
||||||
float factor = ((rangeEnd - rangeStart) + 1) * LinearFactor;
|
float factor = ((rangeEnd - rangeStart) + 1) / 255.0f;
|
||||||
pwmValue = (brightness * factor) + rangeStart;
|
pwmValue = (brightness * factor) + rangeStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user