mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-29 15:42:20 +03:00
Merge branch 'ver4dev' of https://github.com/Mit4el/IoTManager into ver4dev
This commit is contained in:
@@ -52,7 +52,7 @@
|
|||||||
"firmware": "0x10000",
|
"firmware": "0x10000",
|
||||||
"partitions": "0x8000",
|
"partitions": "0x8000",
|
||||||
"littlefs": "0x310000"
|
"littlefs": "0x310000"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "esp32cam_4mb",
|
"name": "esp32cam_4mb",
|
||||||
"boot_app0": "0xe000",
|
"boot_app0": "0xe000",
|
||||||
@@ -154,6 +154,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sensors": [
|
"sensors": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/Pcf8591",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/A02Distance",
|
"path": "src/modules/sensors/A02Distance",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -4,12 +4,12 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
|
|
||||||
<title>IoT Manager 4.5.4</title>
|
<title>IoT Manager 4.5.5</title>
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" href="/build/bundle.css?4541" />
|
<link rel="stylesheet" href="/build/bundle.css?4550" />
|
||||||
|
|
||||||
<script defer src="/build/bundle.js?4541"></script>
|
<script defer src="/build/bundle.js?4550"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body></body>
|
<body></body>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -48,6 +48,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sensors": [
|
"sensors": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/Pcf8591",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/A02Distance",
|
"path": "src/modules/sensors/A02Distance",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
|
|
||||||
<title>IoT Manager 4.5.4</title>
|
<title>IoT Manager 4.5.5</title>
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" href="/build/bundle.css?4541" />
|
<link rel="stylesheet" href="/build/bundle.css?4550" />
|
||||||
|
|
||||||
<script defer src="/build/bundle.js?4541"></script>
|
<script defer src="/build/bundle.js?4550"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body></body>
|
<body></body>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "BuildTime.h"
|
#include "BuildTime.h"
|
||||||
|
|
||||||
// Версия прошивки
|
// Версия прошивки
|
||||||
#define FIRMWARE_VERSION 454
|
#define FIRMWARE_VERSION 455
|
||||||
|
|
||||||
#ifdef esp8266_1mb_ota
|
#ifdef esp8266_1mb_ota
|
||||||
#define FIRMWARE_NAME "esp8266_1mb_ota"
|
#define FIRMWARE_NAME "esp8266_1mb_ota"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
"firmware": "0x10000",
|
"firmware": "0x10000",
|
||||||
"partitions": "0x8000",
|
"partitions": "0x8000",
|
||||||
"littlefs": "0x310000"
|
"littlefs": "0x310000"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "esp32cam_4mb",
|
"name": "esp32cam_4mb",
|
||||||
"boot_app0": "0xe000",
|
"boot_app0": "0xe000",
|
||||||
@@ -170,6 +170,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sensors": [
|
"sensors": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/Pcf8591",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/A02Distance",
|
"path": "src/modules/sensors/A02Distance",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
71
src/modules/exec/Pcf8591/Pcf8591.cpp
Normal file
71
src/modules/exec/Pcf8591/Pcf8591.cpp
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
|
||||||
|
#include "Wire.h"
|
||||||
|
#include <Adafruit_PCF8591.h>
|
||||||
|
|
||||||
|
// Make sure that this is set to the value in volts of VCC
|
||||||
|
#define ADC_REFERENCE_VOLTAGE 3.3
|
||||||
|
|
||||||
|
class Pcf8591 : public IoTItem {
|
||||||
|
int _pin;
|
||||||
|
bool _isRaw;
|
||||||
|
bool _isInited = false;
|
||||||
|
Adafruit_PCF8591 pcf = Adafruit_PCF8591();
|
||||||
|
|
||||||
|
public:
|
||||||
|
Pcf8591(String parameters) : IoTItem(parameters) {
|
||||||
|
String tmp;
|
||||||
|
jsonRead(parameters, "pin", tmp);
|
||||||
|
_pin = tmp.toInt();
|
||||||
|
|
||||||
|
jsonRead(parameters, "mode", tmp);
|
||||||
|
_isRaw = tmp == "raw";
|
||||||
|
|
||||||
|
if (!pcf.begin()) {
|
||||||
|
Serial.println("# Adafruit PCF8591 not found!");
|
||||||
|
_isInited = false;
|
||||||
|
} else
|
||||||
|
|
||||||
|
_isInited = true;
|
||||||
|
|
||||||
|
Serial.println("# Adafruit PCF8591 found");
|
||||||
|
|
||||||
|
pcf.enableDAC(true);
|
||||||
|
|
||||||
|
Serial.println("AIN0, AIN1, AIN2, AIN3");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t dac_counter = 0;
|
||||||
|
|
||||||
|
void doByInterval() {
|
||||||
|
|
||||||
|
// Make a triangle wave on the DAC output
|
||||||
|
pcf.analogWrite(dac_counter++);
|
||||||
|
|
||||||
|
if (_isInited) {
|
||||||
|
if (_isRaw)
|
||||||
|
value.valD = pcf.analogRead(_pin); // Чтение АЦП нулевого канала (Вольты)
|
||||||
|
else
|
||||||
|
value.valD = (int_to_volts(pcf.analogRead(_pin), 8, ADC_REFERENCE_VOLTAGE));
|
||||||
|
regEvent(value.valD, "PCF8591");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float int_to_volts(uint16_t dac_value, uint8_t bits, float logic_level) {
|
||||||
|
return (((float)dac_value / ((1 << bits) - 1)) * logic_level);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
~Pcf8591(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
void *getAPI_Pcf8591(String subtype, String param) {
|
||||||
|
if (subtype == F("Pcf8591")) {
|
||||||
|
return new Pcf8591(param);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
75
src/modules/exec/Pcf8591/modinfo.json
Normal file
75
src/modules/exec/Pcf8591/modinfo.json
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"menuSection": "sensors",
|
||||||
|
"configItem": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "Расширитель портов PCF8591",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Pcf8591",
|
||||||
|
"id": "Pcf85",
|
||||||
|
"widget": "anydataVlt",
|
||||||
|
"page": "PCF8591",
|
||||||
|
"descr": "PCF_0",
|
||||||
|
"pin": "0",
|
||||||
|
"mode": "volt",
|
||||||
|
"map": "1,255,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 2,
|
||||||
|
"int": 7
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"about": {
|
||||||
|
"authorName": "Serghei Crasnicov",
|
||||||
|
"authorContact": "https://t.me/Serghei63",
|
||||||
|
"authorGit": "https://github.com/Serghei63",
|
||||||
|
"specialThanks": "",
|
||||||
|
"moduleName": "Pcf8591",
|
||||||
|
"moduleVersion": "1.0",
|
||||||
|
"usedRam": {
|
||||||
|
"esp32_4mb": 15,
|
||||||
|
"esp8266_4mb": 15
|
||||||
|
},
|
||||||
|
"title": "Расширитель 4-х аналоговых портов PCF8591",
|
||||||
|
"moduleDesc": "Позволяет получить относительную величину напряжения на понижающем трансформаторе.",
|
||||||
|
"propInfo": {
|
||||||
|
"pin": "Номер AN, к которому подключен датчик. Допускается 0, 1, 2, 3",
|
||||||
|
"mode": "Режим работы. volt - вывод в вольтах , raw - значения от 0 до 255",
|
||||||
|
"int": "Количество секунд между опросами датчика."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defActive": false,
|
||||||
|
"usedLibs": {
|
||||||
|
|
||||||
|
"esp32_4mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp32_16mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_4mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_16mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_1mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_1mb_ota": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8285_1mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8285_1mb_ota": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_2mb": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
],
|
||||||
|
"esp8266_2mb_ota": [
|
||||||
|
"https://github.com/adafruit/Adafruit_PCF8591"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user