StateHandler: first version of pid() for fan

This commit is contained in:
Evgenii Meshcheriakov
2022-10-19 09:46:55 +03:00
parent 2de40ba7c0
commit 4b1ef018dd
3 changed files with 17 additions and 11 deletions

View File

@@ -105,7 +105,14 @@ private:
void SetState (state_pointer newstate);
bool current_mode;
Counter value[2] = { { 0, 100 }, { 0, 120 } };
Counter fan_speed = {80, 1000};
/* motor of fan starts at value 90. probably because of some
* weigh of fan, so voltage within range of 0-89 is not
* sufficient to start motor.
* TODO: Value 89 should be scaled to 0 at some point */
Counter fan_speed = {89, 1000};
/*integral controller for PID. should be global, since it
* accumulates error signals encountered since startup*/
int integral = 0;
int saved_set_value[2] = { 0, 0 };
int saved_curr_value[2] = { 0, 0 };
LiquidCrystal *_lcd;