-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.hpp
108 lines (76 loc) · 2.21 KB
/
Controller.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
CavyCave - A temperature controlled box for guinea pigs and other
small animals kept outside in winter
Copyright (C) 2020-2021 Flössie <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <Arduino.h>
#include "Fan.hpp"
#include "Heating.hpp"
#include "Led.hpp"
#include "Sensors.hpp"
class Controller final
{
public:
enum class Mode : uint8_t {
AUTO,
MANUAL
};
struct Configuration {
enum class AutoMode : uint8_t {
INDEPENDENT,
LINKED
};
int16_t min_room_temperature_10th_c;
int16_t max_room_temperature_10th_c;
int16_t min_floor_temperature_10th_c;
int16_t max_floor_temperature_10th_c;
int16_t max_humidity_per_mill;
int16_t min_humidity_per_mill;
uint8_t fan_max_run_minutes;
uint8_t fan_pause_minutes;
uint8_t fan_speedup_delay_minutes;
uint8_t fan_speed_low;
uint8_t fan_speed_high;
AutoMode auto_mode;
};
struct State {
bool room_values_valid;
int16_t temperature_10th_c;
int16_t humidity_per_mill;
bool floor_value_valid;
int16_t floor_temperature_10th_c;
Mode mode;
Fan::Speed fan_speed;
bool heating_lounge;
bool heating_vestibule;
Led::Color led_color;
};
Controller();
~Controller();
void begin();
const Configuration& getConfiguration() const;
void setConfiguration(const Configuration& value);
void run();
void dump() const;
const State& getState() const;
Mode getMode() const;
void setAutoMode();
void setFanSpeed(Fan::Speed value);
void setHeatingLounge(bool value);
void setHeatingVestibule(bool value);
void setLedColor(Led::Color value);
private:
class Implementation;
Implementation* const implementation;
};