mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
Убираем нумерацию папок модулей
This commit is contained in:
58
src/modules/sensors/Hdc1080/Hdc1080.cpp
Normal file
58
src/modules/sensors/Hdc1080/Hdc1080.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/******************************************************************
|
||||
Used ClosedCube HDC1080 Driver (temperature and humidity sensor)
|
||||
Support for HDC1080
|
||||
https://github.com/closedcube/ClosedCube_HDC1080_Arduino
|
||||
|
||||
adapted for version 4 @Serghei63
|
||||
******************************************************************/
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include "Wire.h"
|
||||
#include "ClosedCube_HDC1080.h"
|
||||
#include <map>
|
||||
|
||||
// to do убрать глобальный экземпляр
|
||||
ClosedCube_HDC1080 hdc1080;
|
||||
|
||||
class Hdc1080t : public IoTItem {
|
||||
public:
|
||||
Hdc1080t(String parameters) : IoTItem(parameters) {}
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = hdc1080.readTemperature();
|
||||
if (value.valD < 124)
|
||||
regEvent(value.valD, "Hdc1080t");
|
||||
else
|
||||
SerialPrint("E", "Sensor Hdc1080t", "Error");
|
||||
}
|
||||
|
||||
~Hdc1080t(){};
|
||||
};
|
||||
|
||||
class Hdc1080h : public IoTItem {
|
||||
public:
|
||||
Hdc1080h(String parameters) : IoTItem(parameters) {}
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = hdc1080.readHumidity();
|
||||
if (value.valD < 99)
|
||||
regEvent(value.valD, "Hdc1080h");
|
||||
else
|
||||
SerialPrint("E", "Sensor Hdc1080h", "Error");
|
||||
}
|
||||
|
||||
~Hdc1080h(){};
|
||||
};
|
||||
|
||||
void* getAPI_Hdc1080(String subtype, String param) {
|
||||
if (subtype == F("Hdc1080t")) {
|
||||
hdc1080.begin(0x40);
|
||||
return new Hdc1080t(param);
|
||||
} else if (subtype == F("Hdc1080h")) {
|
||||
hdc1080.begin(0x40);
|
||||
return new Hdc1080h(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
53
src/modules/sensors/Hdc1080/modinfo.json
Normal file
53
src/modules/sensors/Hdc1080/modinfo.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"menuSection": "Сенсоры",
|
||||
|
||||
"configItem": [{
|
||||
"name": "Cенсор температуры HDC1080",
|
||||
"type": "Reading",
|
||||
"subtype": "Hdc1080t",
|
||||
"id": "Temp1080",
|
||||
"widget": "anydataTmp",
|
||||
"page": "Сенсоры",
|
||||
"descr": "1080 Температура",
|
||||
"int": 15,
|
||||
"addr": "0x40",
|
||||
"round": 1
|
||||
},
|
||||
{
|
||||
"name": "Cенсор влажности HDC1080",
|
||||
"type": "Reading",
|
||||
"subtype": "Hdc1080h",
|
||||
"id": "Hum1080",
|
||||
"widget": "anydataHum",
|
||||
"page": "Сенсоры",
|
||||
"descr": "1080 Влажность",
|
||||
"int": 15,
|
||||
"addr": "0x40",
|
||||
"round": 1
|
||||
}],
|
||||
|
||||
"about": {
|
||||
"authorName": "Serghei Crasnicov",
|
||||
"authorContact": "https://t.me/Serghei63",
|
||||
"authorGit": "https://github.com/Serghei63",
|
||||
"specialThanks": "",
|
||||
"moduleName": "Hdc1080",
|
||||
"moduleVersion": "1.0",
|
||||
"moduleDesc": "Позволяет получить значения температуры и влажности с Hdc1080.",
|
||||
"propInfo": {
|
||||
"addr": "Адрес датчика на шине данных, обычно 0x40",
|
||||
"int": "Количество секунд между опросами датчика."
|
||||
}
|
||||
},
|
||||
|
||||
"defActive": true,
|
||||
|
||||
"devices": {
|
||||
"esp32_4mb": [
|
||||
"ClosedCube HDC1080"
|
||||
],
|
||||
"esp8266_4mb": [
|
||||
"ClosedCube HDC1080"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user