mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
SSDP added
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Class/SensorConverting.h"
|
||||
#include "Global.h"
|
||||
@@ -23,16 +21,14 @@ class SensorAnalog : public SensorConverting {
|
||||
pinInt = pinInt;
|
||||
value = analogRead(A0);
|
||||
#endif
|
||||
//float valueFl = this->mapping(value);
|
||||
// valueFl = this->correction(valueFl);
|
||||
|
||||
value = this->mapping(key, value);
|
||||
float valueFl = this->correction(key, value);
|
||||
|
||||
eventGen(key, "");
|
||||
jsonWriteFloat(configLiveJson, key, value);
|
||||
MqttClient::publishStatus(key, String(value));
|
||||
jsonWriteStr(configLiveJson, key, String(valueFl));
|
||||
MqttClient::publishStatus(key, String(valueFl));
|
||||
|
||||
Serial.println("[I] sensor '" + key + "' data: " + String(value));
|
||||
Serial.println("[I] sensor '" + key + "' data: " + String(valueFl));
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,8 +12,6 @@ class SensorConverting : public LineParsing {
|
||||
int mapping(String key, int input) {
|
||||
String map_ = jsonReadStr(configOptionJson, key + "_map");
|
||||
if (map_ != "") {
|
||||
map_.replace("map[", "");
|
||||
map_.replace("]", "");
|
||||
input = map(input,
|
||||
selectFromMarkerToMarker(map_, ",", 0).toInt(),
|
||||
selectFromMarkerToMarker(map_, ",", 1).toInt(),
|
||||
@@ -24,11 +22,11 @@ class SensorConverting : public LineParsing {
|
||||
}
|
||||
|
||||
float correction(String key, float input) {
|
||||
_c.replace("c[", "");
|
||||
_c.replace("]", "");
|
||||
float coef = _c.toFloat();
|
||||
input = input * coef;
|
||||
String corr = jsonReadStr(configOptionJson, key + "_с");
|
||||
if (corr != "") {
|
||||
float coef = corr.toFloat();
|
||||
input = input * coef;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
};
|
||||
//extern SensorConverting* mySensorConverting;
|
||||
};
|
||||
@@ -24,6 +24,9 @@ extern void textOutSet();
|
||||
extern void analogAdc();
|
||||
extern void analogReading();
|
||||
|
||||
extern void ultrasonicCm();
|
||||
extern void ultrasonicReading();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <time.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
|
||||
#ifdef WEBSOCKET_ENABLED
|
||||
extern AsyncWebSocket ws;
|
||||
//extern AsyncEventSource events;
|
||||
|
||||
5
include/SSDP.h
Normal file
5
include/SSDP.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
extern void SsdpInit();
|
||||
extern String xmlNode(String tags, String data);
|
||||
extern String decToHex(uint32_t decValue, byte desiredStringLength);
|
||||
Reference in New Issue
Block a user