LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
out_humidifier.h
Go to the documentation of this file.
1
2#pragma once
3#include "options.h"
4#ifdef HUMIDIFIER_ENABLE
5
6#include <abstractout.h>
7#include <item.h>
8
9#define PREPARATION_TIME 10000
10#define MAX_OVERPRESSURE_TIME 20000
11#define MIN_KEEP_TIME 2500 //8
12#define FLUSH_PRESSURE 200 //250 //380
13#define FLUSH_TIMEOUT 125000
14#define PRESSURE_ACHIEVING_TIME 8000 //10
15#define MIN_OPERATION_PRESSURE 400 //550
16#define MAX_OPERATION_PRESSURE 600 //70 atm
17#define RESUME_PRESSURE 0 //400 - not set >0 if not shure!
18
28enum humidifierState {
29 H_UNKNOWN = 0,
30 H_READY = 1,
31 H_PREPARE_FOR_START = 2,
32 H_PREPARE_VALVES = 3,
33 H_MOTOR_ON = 4,
34 H_OPERATE = 5,
35 H_MOTOR_PAUSE = 6,
36 H_MOTOR_OFF = 7,
37 H_MOTOR_OFF_OK = 10,
38 H_FLUSH = 8,
39 H_IDLE = 9,
40 H_FAULT_PRESSURE = -1,
41 H_FAULT_PRESSURE_KEEP = -2,
42 H_FAULT_OVERPRESSURE = -3,
43 H_FAULT_MOTOR_OFF = -4
44};
45
75class out_humidifier : public abstractOut {
76public:
77
78 //out_humidifier(){ /*NO getConfig() here due Poll() optimization*/ };
80 bool getConfig();
81
83 int Setup() override;
85 int Poll(short cause) override;
87 int Stop() override;
89 int Status() override;
90
92 int getChanType() override;
94 int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true, bool authorized = false) override;
95
96protected:
97 aJsonObject * gatesObj;
98 //aJsonObject * outObj;
99 short pumpPin,flushPin,pressurePin;
100 bool inverted;
101 uint32_t idleTime;
102 uint16_t maxPumpTime;
103 uint8_t startLevel;
104 uint8_t minLevel;
105 uint16_t capacity;
106 void pump(bool state);
107 bool isNeedPump(bool steelNeed=false);
108 void turnOffValves();
109 bool prepareValves();
110 void notifyState(short state);
111 int shutdown(humidifierState nextState);
112};
113#endif
Base class of output driver modules (one per channel type).
Definition abstractout.h:19
Item (virtual channel) system of LightHub.