From 5d314e7525334812f203be1b2899345a7b50f0fd Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Sat, 3 Feb 2018 16:23:01 +0100 Subject: [PATCH] Fixed PWM values being off --- src/assets/version.h | 4 ++-- src/config.h | 2 +- src/stairs.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/assets/version.h b/src/assets/version.h index eb2fafa..d43e9d3 100644 --- a/src/assets/version.h +++ b/src/assets/version.h @@ -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 diff --git a/src/config.h b/src/config.h index a807777..45b689b 100644 --- a/src/config.h +++ b/src/config.h @@ -4,7 +4,7 @@ #include -#define SerialDebug +//#define SerialDebug #ifdef SerialDebug static const uint32_t SerialDebugBaudrate = 115200; diff --git a/src/stairs.cpp b/src/stairs.cpp index 0f97475..3b99c5f 100644 --- a/src/stairs.cpp +++ b/src/stairs.cpp @@ -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; }