mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-29 15:42:20 +03:00
Убираем нумерацию папок модулей
This commit is contained in:
45
src/modules/sensors/Max6675/Max6675.cpp
Normal file
45
src/modules/sensors/Max6675/Max6675.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/******************************************************************
|
||||
Used MAX6675 Driver (temperature sensor)
|
||||
Support for MAX6675
|
||||
|
||||
https://github.com/adafruit/MAX6675-library
|
||||
|
||||
adapted for version 4 @Serghei63
|
||||
******************************************************************/
|
||||
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include "max6675.h"
|
||||
#include <map>
|
||||
|
||||
MAX6675* thermocouple = nullptr;
|
||||
|
||||
class MAX6675t : public IoTItem {
|
||||
public:
|
||||
MAX6675t(String parameters) : IoTItem(parameters) {
|
||||
int thermoDO = jsonReadInt(parameters, "DO");
|
||||
int thermoCS = jsonReadInt(parameters, "CS");
|
||||
int thermoCLK = jsonReadInt(parameters, "CLK");
|
||||
thermocouple = new MAX6675(thermoCLK, thermoCS, thermoDO);
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = thermocouple->readCelsius();
|
||||
if (String(value.valD) != "nan") {
|
||||
regEvent(value.valD, "Max6675t");
|
||||
} else {
|
||||
SerialPrint("E", "Sensor Max6675t", "Error");
|
||||
}
|
||||
}
|
||||
|
||||
~MAX6675t(){};
|
||||
};
|
||||
|
||||
void* getAPI_Max6675(String subtype, String param) {
|
||||
if (subtype == F("Max6675t")) {
|
||||
return new MAX6675t(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
44
src/modules/sensors/Max6675/modinfo.json
Normal file
44
src/modules/sensors/Max6675/modinfo.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"menuSection": "Сенсоры",
|
||||
|
||||
"configItem": [{
|
||||
"name": "Cенсор температуры MAX6675",
|
||||
"type": "Reading",
|
||||
"subtype": "Max6675t",
|
||||
"id": "maxtmp",
|
||||
"widget": "anydataTmp",
|
||||
"page": "Сенсоры",
|
||||
"descr": "MAX Температура",
|
||||
"int": 15,
|
||||
"DO": 12,
|
||||
"CS": 13,
|
||||
"CLK": 14
|
||||
}],
|
||||
|
||||
"about": {
|
||||
"authorName": "Serghei Crasnicov",
|
||||
"authorContact": "https://t.me/Serghei63",
|
||||
"authorGit": "https://github.com/Serghei63",
|
||||
"specialThanks": "",
|
||||
"moduleName": "Max6675",
|
||||
"moduleVersion": "1.0",
|
||||
"moduleDesc": "Позволяет получить значения температуры с Max6675.",
|
||||
"propInfo": {
|
||||
"DO": "GPIO шины данных",
|
||||
"CS": "GPIO шины данных",
|
||||
"CLK": "GPIO шины данных",
|
||||
"int": "Количество секунд между опросами датчика."
|
||||
}
|
||||
},
|
||||
|
||||
"defActive": true,
|
||||
|
||||
"devices": {
|
||||
"esp32_4mb": [
|
||||
"adafruit/MAX6675 library"
|
||||
],
|
||||
"esp8266_4mb": [
|
||||
"adafruit/MAX6675 library"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user