30class Button :
public SimpleButton,
public ActionHandler {
32 friend class ActionTrigger;
33 enum class ButtonType : uint8_t {
39 enum class OnLoadConfigType : uint8_t {
41 LOAD_BUTTON_SETUP_ONLY,
48 bool invertLogic =
false);
49 explicit Button(
int pin,
bool pullUp =
false,
bool invertLogic =
false);
54 void addAction(uint16_t action, ActionHandler &client, uint16_t event,
55 bool alwaysEnabled =
false)
override;
56 void addAction(uint16_t action, ActionHandler *client, uint16_t event,
57 bool alwaysEnabled =
false)
override;
58 void disableAction(int32_t action,
59 ActionHandler *client,
60 int32_t event)
override;
61 void enableAction(int32_t action,
62 ActionHandler *client,
63 int32_t event)
override;
65 void setHoldTime(
unsigned int timeMs);
66 void repeatOnHoldEvery(
unsigned int timeMs);
70 void setMulticlickTime(
unsigned int timeMs,
bool bistableButton =
false);
72 void setButtonType(
const ButtonType type);
73 bool isBistable()
const;
74 bool isMonostable()
const;
75 bool isMotionSensor()
const;
78 bool disableActionsInConfigMode()
override;
79 void dontUseOnLoadConfig();
80 void setOnLoadConfigType(OnLoadConfigType type);
82 uint8_t getMaxMulticlickValue();
83 int8_t getButtonNumber()
const override;
84 void setButtonNumber(int8_t number);
86 void handleAction(
int event,
int action)
override;
91 uint32_t getLastStateChange()
const;
94 void evaluateMaxMulticlickValue();
97 void disableRepeatOnHold(uint32_t threshold = 0);
98 void enableRepeatOnHold();
99 uint32_t multiclickTimeMs = 0;
100 uint32_t lastStateChangeMs = 0;
101 uint16_t repeatOnHoldMs = 0;
102 uint16_t holdSend = 0;
103 uint16_t holdTimeMs = 0;
104 ButtonType buttonType = ButtonType::MONOSTABLE;
105 enum OnLoadConfigType onLoadConfigType = OnLoadConfigType::LOAD_FULL_CONFIG;
107 uint8_t clickCounter = 0;
108 uint8_t maxMulticlickValueConfigured = 0;
109 bool repeatOnHoldEnabled =
false;
110 bool configButton =
false;
111 int8_t buttonNumber = -1;
112 bool disabled =
false;
114 static int buttonCounter;