SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
base_button.h
Go to the documentation of this file.
1#ifndef SENSESP_SRC_SENSESP_SYSTEM_BASE_BUTTON_H_
2#define SENSESP_SRC_SENSESP_SYSTEM_BASE_BUTTON_H_
3
4#include "AceButton.h"
5#include "elapsedMillis.h"
6#include "sensesp.h"
9#include "sensesp_base_app.h"
10
11namespace sensesp {
12
13using namespace ace_button;
14
21class BaseButtonHandler : public Configurable, public Startable, public IEventHandler {
22 public:
28
29 virtual void start() override {
30 ButtonConfig* button_config = button_->getButtonConfig();
31 button_config->setIEventHandler(this);
32 button_config->setFeature(ButtonConfig::kFeatureLongPress);
33 button_config->setFeature(ButtonConfig::kFeatureSuppressAfterLongPress);
34
35 debugD("Button handler started");
36
37 ReactESP::app->onRepeat(4, [this]() { this->button_->check(); });
38 }
39
40 protected:
42};
43
44
45} // namespace sensesp
46
47#endif // SENSESP_SRC_SENSESP_SYSTEM_BASE_BUTTON_H_
Base class for button handlers.
Definition base_button.h:21
virtual void start() override
Definition base_button.h:29
BaseButtonHandler(int pin, String config_path="")
Definition base_button.h:23
An object that is capable of having configuration data that can be set remotely using a RESTful API,...
Construct a new transform based on a single function.
Automatic calling of the start() method at startup.
Definition startable.h:20
#define debugD(fmt,...)
Definition local_debug.h:47