Fixed PWM values being off

This commit is contained in:
Mark van Renswoude 2018-02-03 16:23:01 +01:00
parent ce26beffec
commit 5d314e7525
3 changed files with 5 additions and 5 deletions

View File

@ -4,10 +4,10 @@
const uint8_t VersionMajor = 2;
const uint8_t VersionMinor = 0;
const uint8_t VersionPatch = 0;
const uint8_t VersionMetadata = 34;
const uint8_t VersionMetadata = 35;
const char VersionBranch[] = "release/2.0";
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";
#endif

View File

@ -4,7 +4,7 @@
#include <stdint.h>
#define SerialDebug
//#define SerialDebug
#ifdef SerialDebug
static const uint32_t SerialDebugBaudrate = 115200;

View File

@ -207,12 +207,12 @@ uint16_t Stairs::getPWMValue(uint8_t step, uint8_t brightness)
{
//_dln("Stairs :: Using curve");
float factor = ((rangeEnd - rangeStart) + 1) * CurveFactor;
brightness = pow(2, ((brightness * LinearFactor) / factor)) - 1 + rangeStart;
pwmValue = pow(2, ((brightness * LinearFactor) / factor)) - 1 + rangeStart;
}
else
{
//_dln("Stairs :: Not using curve");
float factor = ((rangeEnd - rangeStart) + 1) * LinearFactor;
float factor = ((rangeEnd - rangeStart) + 1) / 255.0f;
pwmValue = (brightness * factor) + rangeStart;
}