Merge tag '1.1' into develop
Release 1.1
This commit is contained in:
commit
47dae8c014
3
TODO
3
TODO
@ -1,3 +0,0 @@
|
||||
1. Add an "ease" option to the static mode
|
||||
other mode to static: from 0
|
||||
static to static: depends on current brightness
|
@ -59,6 +59,7 @@ void setup()
|
||||
stairs->init(pwmDriver);
|
||||
|
||||
_dln("Initializing WiFi");
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.hostname(WiFiHostname);
|
||||
WiFi.begin(WiFiSSID, WiFiPassword);
|
||||
|
||||
|
@ -35,11 +35,14 @@ void StaticMode::tick(IStairs* stairs, uint32_t currentTime)
|
||||
if (this->easeState == None)
|
||||
return;
|
||||
|
||||
this->currentBrightness = (currentTime - this->easeStartTime) * ((this->parameters.brightness - this->easeStartBrightness) / this->parameters.easeTime);
|
||||
uint32_t elapsedTime = currentTime - this->easeStartTime;
|
||||
uint32_t diff = this->easeState == Up ? this->parameters.brightness - this->easeStartBrightness : this->easeStartBrightness - this->parameters.brightness;
|
||||
uint32_t delta = (diff * elapsedTime) / this->parameters.easeTime;
|
||||
|
||||
this->currentBrightness = this->easeState == Up ? this->easeStartBrightness + delta : this->easeStartBrightness - delta;
|
||||
|
||||
|
||||
if ((this->easeState == Up && this->currentBrightness >= this->parameters.brightness) ||
|
||||
(this->easeState == Down && this->currentBrightness <= this->parameters.brightness))
|
||||
if (elapsedTime >= this->parameters.easeTime)
|
||||
{
|
||||
this->currentBrightness = this->parameters.brightness;
|
||||
this->easeState = None;
|
||||
|
Loading…
Reference in New Issue
Block a user