Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
SetpointProfileRunner.cpp
Go to the documentation of this file.
2
5
7 if(!running) {
8 return;
9 }
10
12
13 if(millis() - timeStart > profile.back().time*1000) {
14 // Reached end of profile
15 running = false;
16 }
17}
18
20 timeStart = millis();
22}
23
24void SetpointProfileRunner::setProfile(const etl::span<const Point> &profile) {
25 this->profile = profile;
26}
27
29 return running;
30}
31
33 // Loop backwards over profile, returning the first (largest) index of the point whose time is less than runtime
34 for (size_t i = profile.size() - 1; i >= 0; i--) {
35 if(millis() - timeStart > profile[i].time*1000) {
36 return i;
37 }
38 }
39}
double sp
Setpoint.
Definition Controller.h:22
Base class for a humidistat. Holds a reference to a HumiditySensor instance.
Definition Humidistat.h:10
void update()
Run the profile (if running). Call this periodically.
void setProfile(const etl::span< const Point > &profile)
Set the profile.
bool isRunning() const
Get the run state.
size_t getCurrentPoint() const
Get the index of the current Point in the profile.
void toggle()
Toggle the run state.
SetpointProfileRunner(Humidistat *humidistat)
Constructor.
etl::span< const Point > profile
SerialLogger< cHumidistat > serialLogger & humidistat
Definition main.cpp:84