mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Merge branch 'ver3' of https://github.com/biveraxe/IoTManager into ver3
This commit is contained in:
@@ -38,6 +38,6 @@
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[HDC1080_hum];addr[0x76]*
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_temp];addr[0x76]
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_hum];addr[0x76]*
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[0];k[0];int[10];type[LCD];val[any]
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[8];k[1];int[10];type[LCD];val[any]*
|
||||
0;sensor;anyid;anydata;Page;Tmp;1;c[0];k[0];int[10];type[LCD];val[any]
|
||||
0;sensor;anyid;anydata;Page;Hum;1;c[8];k[1];int[10];type[LCD];val[any]*
|
||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[type1];addr[0x76]*
|
||||
@@ -6,3 +6,4 @@ float yourSensorReading(String type, String addr);
|
||||
void HDC1080_init(String addr);
|
||||
void AHTX0_init();
|
||||
void LCD_init();
|
||||
void BH1750_init();
|
||||
|
||||
@@ -25,6 +25,7 @@ class SensorAny {
|
||||
String _addr;
|
||||
String _type;
|
||||
String _val;
|
||||
String _descr;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
|
||||
@@ -44,6 +44,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
Adafruit AHTX0
|
||||
LiquidCrystal_I2C
|
||||
BH1750
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
@@ -71,6 +72,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
Adafruit AHTX0
|
||||
LiquidCrystal_I2C
|
||||
BH1750
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
@@ -116,6 +118,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
Adafruit AHTX0
|
||||
LiquidCrystal_I2C
|
||||
BH1750
|
||||
monitor_filters = esp32_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
//подключаем необходимые файлы библиотеки
|
||||
#include <Adafruit_AHTX0.h>
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
|
||||
//#include "Adafruit_ADS1X15.h"
|
||||
#include "Adafruit_AHTX0.h"
|
||||
#include "BH1750.h"
|
||||
#include "ClosedCube_HDC1080.h"
|
||||
#include "LiquidCrystal_I2C.h"
|
||||
|
||||
//создаем объект HDC1080
|
||||
ClosedCube_HDC1080 hdc1080;
|
||||
@@ -21,13 +22,20 @@ sensors_event_t tmpEvent_t;
|
||||
//создаем объект LCD
|
||||
LiquidCrystal_I2C LCD(0x27, 16, 2);
|
||||
|
||||
//создаем объект BH1750
|
||||
BH1750 lightMeter;
|
||||
|
||||
//создаем объект ADS1015
|
||||
//Adafruit_ADS1015 ads;
|
||||
|
||||
float yourSensorReading(String type, String paramsAny) {
|
||||
float value;
|
||||
//========================================================HDC1080================================================================
|
||||
if (type == "HDC1080_temp") {
|
||||
HDC1080_init(jsonReadStr(paramsAny, "addr"));
|
||||
value = hdc1080.readTemperature();
|
||||
} else if (type == "HDC1080_hum") {
|
||||
}
|
||||
if (type == "HDC1080_hum") {
|
||||
HDC1080_init(jsonReadStr(paramsAny, "addr"));
|
||||
value = hdc1080.readHumidity();
|
||||
}
|
||||
@@ -36,7 +44,8 @@ float yourSensorReading(String type, String paramsAny) {
|
||||
AHTX0_init();
|
||||
aht_temp->getEvent(&tmpEvent_t);
|
||||
value = tmpEvent_t.temperature;
|
||||
} else if (type == "AHTX0_hum") {
|
||||
}
|
||||
if (type == "AHTX0_hum") {
|
||||
AHTX0_init();
|
||||
aht_humidity->getEvent(&tmpEvent_t);
|
||||
value = tmpEvent_t.relative_humidity;
|
||||
@@ -45,8 +54,15 @@ float yourSensorReading(String type, String paramsAny) {
|
||||
if (type == "LCD") {
|
||||
LCD_init();
|
||||
LCD.setCursor(jsonReadInt(paramsAny, "с"), jsonReadInt(paramsAny, "k"));
|
||||
LCD.print(jsonReadFloat(configLiveJson, jsonReadStr(paramsAny, "val")));
|
||||
String toPrint = jsonReadStr(paramsAny, "descr") + " " + jsonReadStr(configLiveJson, jsonReadStr(paramsAny, "val"));
|
||||
LCD.print(toPrint);
|
||||
}
|
||||
//==========================================================BH1750=================================================================
|
||||
if (type == "BH1750_lux") {
|
||||
BH1750_init();
|
||||
value = lightMeter.readLightLevel();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -81,3 +97,12 @@ void LCD_init() {
|
||||
LCD.backlight(); //включаем подсветку
|
||||
}
|
||||
}
|
||||
|
||||
void BH1750_init() {
|
||||
static bool BH1750_flag = true;
|
||||
if (BH1750_flag) {
|
||||
lightMeter.begin();
|
||||
|
||||
BH1750_flag = false;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ SensorAny::SensorAny(const String& paramsAny) {
|
||||
_addr = jsonReadStr(_paramsAny, "addr");
|
||||
_type = jsonReadStr(_paramsAny, "type");
|
||||
_val = jsonReadStr(_paramsAny, "val");
|
||||
_descr = jsonReadStr(_paramsAny, "descr");
|
||||
}
|
||||
|
||||
SensorAny::~SensorAny() {}
|
||||
@@ -59,6 +60,7 @@ void AnySensor() {
|
||||
jsonWriteStr(params, "k", myLineParsing.gk());
|
||||
jsonWriteStr(params, "val", myLineParsing.gval());
|
||||
jsonWriteStr(params, "type", myLineParsing.gtype());
|
||||
jsonWriteStr(params, "descr", myLineParsing.gdescr());
|
||||
myLineParsing.clear();
|
||||
|
||||
static bool firstTime = true;
|
||||
|
||||
Reference in New Issue
Block a user