reverting version

This commit is contained in:
Dmitry Borisenko
2020-09-02 22:34:49 +03:00
parent 70096c71c8
commit 2e8ea582d2
286 changed files with 29912 additions and 0 deletions

43
include/Class/button.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include <Arduino.h>
#include "Class/LineParsing.h"
#include "Global.h"
class Button1 : public LineParsing {
public:
Button1() : LineParsing(){};
void pinModeSet() {
if (_pin != "") {
pinMode(_pin.toInt(), OUTPUT);
}
}
void pinStateSetDefault() {
if (_inv == "" && _state != "") {
pinChange(_key, _pin, _state, true);
}
}
void pinStateSetInvDefault() {
if (_inv != "" && _state != "") {
pinChange(_key, _pin, _state, false);
}
}
void pinChange(String key, String pin, String state, bool rev) {
int pinInt = pin.toInt();
int stateInt;
if (rev) {
digitalWrite(pinInt, state.toInt());
} else {
digitalWrite(pinInt, !state.toInt());
}
eventGen(key, "");
jsonWriteInt(configLiveJson, key, state.toInt());
MqttClient::publishStatus(key, state);
}
};
extern Button1* myButton;