очистка и реорганизация файлов

This commit is contained in:
Dmitry Borisenko
2022-02-02 21:17:50 +01:00
parent e376693028
commit a2f5927172
12 changed files with 211 additions and 272 deletions

View File

@@ -3,7 +3,6 @@
#include "Classes/ScenarioClass3.h"
#include "Classes/IoTSensor.h"
IoTSensor::IoTSensor(String parameters) {
jsonRead(parameters, "int", _interval);
_interval = _interval * 1000;
@@ -12,7 +11,7 @@ IoTSensor::IoTSensor(String parameters) {
jsonRead(parameters, "multiply", _multiply);
jsonRead(parameters, "plus", _plus);
jsonRead(parameters, "round", _round);
String map;
jsonRead(parameters, "map", map);
if (map != "") {
@@ -20,7 +19,7 @@ IoTSensor::IoTSensor(String parameters) {
_map2 = selectFromMarkerToMarker(map, ",", 1).toInt();
_map3 = selectFromMarkerToMarker(map, ",", 2).toInt();
_map4 = selectFromMarkerToMarker(map, ",", 3).toInt();
}
}
}
IoTSensor::~IoTSensor() {}
@@ -44,14 +43,14 @@ void IoTSensor::loop() {
void IoTSensor::regEvent(String value, String consoleInfo = "") {
eventGen2(_id, value);
jsonWriteStr(paramsFlashJson, _id, value);
publishStatus(_id, value);
publishStatusMqtt(_id, value);
SerialPrint("I", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
}
void IoTSensor::regEvent(float value, String consoleInfo = "") {
void IoTSensor::regEvent(float value, String consoleInfo = "") {
if (_multiply) value = value * _multiply;
if (_plus) value = value + _multiply;
if (_round != 0) {
if (_round != 0) {
if (value > 0) {
value = (int)(value * _round + 0.5F);
value = value / _round;