supla-device
Toggle main menu visibility
Loading...
Searching...
No Matches
src
supla
control
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 <supla/io.h>
21
22
#include "roller_shutter_interface.h"
23
24
namespace
Supla {
25
26
namespace
Io {
27
class
Base
;
28
}
29
30
namespace
Html {
31
class
RollerShutterParameters
;
32
}
33
34
namespace
Control {
35
36
class
RollerShutter
:
public
RollerShutterInterface
{
37
public
:
38
friend
class
Supla::Html::RollerShutterParameters
;
49
RollerShutter
(
Supla::Io::Base
*io,
50
int
pinUp,
51
int
pinDown,
52
bool
highIsOn =
true
,
53
bool
tiltFunctionsEnabled =
false
);
63
RollerShutter
(
int
pinUp = -1,
64
int
pinDown = -1,
65
bool
highIsOn =
true
,
66
bool
tiltFunctionsEnabled =
false
);
75
RollerShutter
(
Supla::Io::IoPin
pinUp,
76
Supla::Io::IoPin
pinDown,
77
bool
tiltFunctionsEnabled =
false
);
78
79
void
onInit
()
override
;
80
void
onTimer
()
override
;
81
82
void
setPinUp(
int
pin);
83
void
setPinDown(
int
pin);
84
85
void
setTargetPosition(
int
newPosition,
86
int
newTilt = UNKNOWN_POSITION)
override
;
87
88
protected
:
89
RollerShutter
(
Supla::Io::IoPin
pinUp,
90
Supla::Io::IoPin
pinDown,
91
bool
tiltFunctionsEnabled,
92
Supla::Channel
&externalChannel,
93
ElementMode mode);
94
95
virtual
void
stopMovement();
96
virtual
void
relayDownOn();
97
virtual
void
relayUpOn();
98
virtual
void
relayDownOff();
99
virtual
void
relayUpOff();
100
virtual
void
startClosing();
101
virtual
void
startOpening();
102
virtual
void
switchOffRelays();
103
void
calculateCurrentPositionAndTilt();
104
105
void
initGpio(
const
Supla::Io::IoPin
&pin);
106
107
Supla::Io::IoPin
pinUp;
108
Supla::Io::IoPin
pinDown;
109
110
uint32_t lastMovementStartTime = 0;
111
uint32_t doNothingTime = 0;
112
113
uint32_t operationTimeoutMs = 0;
114
};
115
116
}
// namespace Control
117
}
// namespace Supla
118
119
#endif
// SRC_SUPLA_CONTROL_ROLLER_SHUTTER_H_
Supla::Channel
Definition
channel.h:33
Supla::Control::RollerShutterInterface::RollerShutterInterface
RollerShutterInterface(bool tiltFunctionsEnabled=false)
Constructor.
Definition
roller_shutter_interface.cpp:78
Supla::Control::RollerShutter::onTimer
void onTimer() override
Method called on timer interupt.
Definition
roller_shutter.cpp:166
Supla::Control::RollerShutter::onInit
void onInit() override
Third method called on element in SuplaDevice.begin().
Definition
roller_shutter.cpp:88
Supla::Control::RollerShutter::RollerShutter
RollerShutter(Supla::Io::Base *io, int pinUp, int pinDown, bool highIsOn=true, bool tiltFunctionsEnabled=false)
Constructor.
Definition
roller_shutter.cpp:43
Supla::Html::RollerShutterParameters
Definition
roller_shutter_parameters.h:32
Supla::Io::Base
Definition
io.h:36
Supla::Io::IoPin
Definition
io_pin.h:28
Generated by
1.17.0