supla-device
Loading...
Searching...
No Matches
roller_shutter.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15*/
16
17#ifndef SRC_SUPLA_CONTROL_ROLLER_SHUTTER_H_
18#define SRC_SUPLA_CONTROL_ROLLER_SHUTTER_H_
19
20#include "roller_shutter_interface.h"
21
22namespace Supla {
23
24namespace Io {
25class Base;
26}
27
28namespace Html {
30}
31
32namespace Control {
33
35 public:
48 int pinUp,
49 int pinDown,
50 bool highIsOn = true,
51 bool tiltFunctionsEnabled = false);
61 RollerShutter(int pinUp = -1,
62 int pinDown = -1,
63 bool highIsOn = true,
64 bool tiltFunctionsEnabled = false);
65
66 void onInit() override;
67 void onTimer() override;
68
69 void setPinUp(int pin);
70 void setPinDown(int pin);
71
72 void setTargetPosition(int newPosition,
73 int newTilt = UNKNOWN_POSITION) override;
74
75 protected:
76 virtual void stopMovement();
77 virtual void relayDownOn();
78 virtual void relayUpOn();
79 virtual void relayDownOff();
80 virtual void relayUpOff();
81 virtual void startClosing();
82 virtual void startOpening();
83 virtual void switchOffRelays();
84 void calculateCurrentPositionAndTilt();
85
86 void initGpio(int gpio);
87
88 int16_t pinUp = -1;
89 int16_t pinDown = -1;
90
91 uint32_t lastMovementStartTime = 0;
92 uint32_t doNothingTime = 0;
93 Supla::Io::Base *io = nullptr;
94
95 uint32_t operationTimeoutMs = 0;
96
97 bool highIsOn = true;
98};
99
100} // namespace Control
101} // namespace Supla
102
103#endif // SRC_SUPLA_CONTROL_ROLLER_SHUTTER_H_
RollerShutterInterface(bool tiltFunctionsEnabled=false)
Constructor.
Definition roller_shutter_interface.cpp:57
void onTimer() override
Method called on timer interupt.
Definition roller_shutter.cpp:153
void onInit() override
Third method called on element in SuplaDevice.begin().
Definition roller_shutter.cpp:54
RollerShutter(Supla::Io::Base *io, int pinUp, int pinDown, bool highIsOn=true, bool tiltFunctionsEnabled=false)
Constructor.
Definition roller_shutter.cpp:33
Definition roller_shutter_parameters.h:32
Definition io.h:35