mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
некоторые изменения
This commit is contained in:
@@ -22,8 +22,7 @@ void* getAPI_ButtonOut(String subtype, String params);
|
||||
void* getAPI_IoTServo(String subtype, String params);
|
||||
void* getAPI_Mcp23017(String subtype, String params);
|
||||
void* getAPI_Mp3(String subtype, String params);
|
||||
void* getAPI_Pwm32(String subtype, String params);
|
||||
void* getAPI_SysExt(String subtype, String params);
|
||||
void* getAPI_Pwm8266(String subtype, String params);
|
||||
void* getAPI_Lcd2004(String subtype, String params);
|
||||
|
||||
void* getAPI(String subtype, String params) {
|
||||
@@ -50,8 +49,7 @@ if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_IoTServo(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Pwm32(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_SysExt(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -4,57 +4,56 @@
|
||||
https://github.com/adafruit/Adafruit_BMP280_Library
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <map>
|
||||
|
||||
|
||||
std::map<String, Adafruit_BMP280*> bmps;
|
||||
|
||||
class Bmp280t : public IoTItem {
|
||||
private:
|
||||
Adafruit_BMP280* _bmp;
|
||||
|
||||
Adafruit_BMP280* _bmp;
|
||||
|
||||
public:
|
||||
Bmp280t(Adafruit_BMP280* bmp, String parameters): IoTItem(parameters) {
|
||||
Bmp280t(Adafruit_BMP280* bmp, String parameters) : IoTItem(parameters) {
|
||||
_bmp = bmp;
|
||||
}
|
||||
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = _bmp->readTemperature();
|
||||
if (String(value.valD) != "nan") regEvent(value.valD, "Bmp280t");
|
||||
else SerialPrint("E", "Sensor DHTt", "Error");
|
||||
if (String(value.valD) != "nan")
|
||||
regEvent(value.valD, "Bmp280t");
|
||||
else
|
||||
SerialPrint("E", "Sensor Bmp280t", "Error");
|
||||
}
|
||||
|
||||
~Bmp280t() {};
|
||||
~Bmp280t(){};
|
||||
};
|
||||
|
||||
|
||||
class Bmp280p : public IoTItem {
|
||||
private:
|
||||
Adafruit_BMP280* _bmp;
|
||||
Adafruit_BMP280* _bmp;
|
||||
|
||||
public:
|
||||
Bmp280p(Adafruit_BMP280* bmp, String parameters): IoTItem(parameters) {
|
||||
Bmp280p(Adafruit_BMP280* bmp, String parameters) : IoTItem(parameters) {
|
||||
_bmp = bmp;
|
||||
}
|
||||
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = _bmp->readPressure();
|
||||
if (String(value.valD) != "nan") {
|
||||
value.valD = value.valD / 1.333224 / 100;
|
||||
regEvent(value.valD, "Bmp280p");
|
||||
} else SerialPrint("E", "Sensor DHTh", "Error");
|
||||
} else
|
||||
SerialPrint("E", "Sensor Bmp280p", "Error");
|
||||
}
|
||||
|
||||
~Bmp280p() {};
|
||||
~Bmp280p(){};
|
||||
};
|
||||
|
||||
|
||||
void* getAPI_Bmp280(String subtype, String param) {
|
||||
void* getAPI_Bmp280(String subtype, String param) {
|
||||
if (subtype == F("Bmp280t") || subtype == F("Bmp280p")) {
|
||||
String addr;
|
||||
jsonRead(param, "addr", addr);
|
||||
|
||||
Reference in New Issue
Block a user