LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
out_motor.h
Go to the documentation of this file.
1#pragma once
2#include "options.h"
3#ifndef MOTOR_DISABLE
4#include <abstractout.h>
5#include <item.h>
6#include "itemCmd.h"
7
8#ifndef POS_ERR
9#define POS_ERR 10
10#endif
11
12#define MIN_PWM 70
13// The number of simultaniusly working motors
14#ifndef MOTOR_QUOTE
15#define MOTOR_QUOTE 2
16#endif
17
18static int8_t motorQuote = MOTOR_QUOTE;
19
38class out_Motor : public abstractOut {
39public:
40
41 //out_Motor(Item * _item):abstractOut(_item){getConfig();};
42 //out_Motor(){};
44 void link(Item * _item){abstractOut::link(_item); if (_item) getConfig();};
46 int Setup() override;
48 int Poll(short cause) override;
50 int Stop() override;
51 //int isActive() override;
53 int getChanType() override;
54 //int getDefaultStorageType(){return ST_PERCENTS255;};
55 //int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
57 int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true, bool authorized = false) override;
58
59 int8_t pinUp;
60 int8_t pinDown;
62 int16_t maxOnTime;
63 uint16_t feedbackOpen;
66protected:
67 void getConfig();
68};
69#endif
A single LightHub item (virtual channel).
Definition item.h:232
abstractOut()
Definition abstractout.h:22
virtual void link(Item *_item)
Definition abstractout.h:24
Command + value container passed between items, drivers and MQTT.
Definition itemCmd.h:306
Motorized gate/shutter driver with analog position feedback, channel type CH_MOTOR = 12.
Definition out_motor.h:38
int16_t maxOnTime
Definition out_motor.h:62
int Poll(short cause) override
Drives the motor toward the target position with speed ramp, enforces the max on-time,...
Definition out_motor.cpp:84
void getConfig()
Definition out_motor.cpp:12
bool inverted
Definition out_motor.h:65
uint16_t feedbackOpen
Definition out_motor.h:63
int8_t pinUp
Definition out_motor.h:59
int Stop() override
Deactivates both motor outputs and resets the channel state.
Definition out_motor.cpp:71
int Setup() override
Sets the up/down pins as outputs, the feedback pin as input, resets the action flags.
Definition out_motor.cpp:48
uint16_t feedbackClosed
Definition out_motor.h:64
int Ctrl(itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override
Sets the target position via /set (0-255) and /cmd on/off, requesting a move (see class doc).
Definition out_motor.cpp:248
int8_t pinFeedback
Definition out_motor.h:61
int8_t pinDown
Definition out_motor.h:60
void link(Item *_item)
Links the channel item and reads the pin config from itemArg.
Definition out_motor.h:44
int getChanType() override
Returns CH_PWM (3).
Definition out_motor.cpp:241
Item (virtual channel) system of LightHub.
#define MOTOR_QUOTE
Definition out_motor.h:15