Telegram V2 & espCAM

This commit is contained in:
Mit4el
2023-10-02 21:29:02 +03:00
parent 8eb719ea6c
commit 0e679f132d
88 changed files with 527 additions and 446 deletions

View File

@@ -15,7 +15,10 @@
# #
# поддерживаемые контроллеры (профили): # поддерживаемые контроллеры (профили):
# esp8266_4mb # esp8266_4mb
# esp8266_16mb
# esp32_4mb # esp32_4mb
# esp32cam_4mb
# esp32_16mb
# esp32s2_4mb # esp32s2_4mb
# esp8266_1mb # esp8266_1mb
# esp8266_1mb_ota # esp8266_1mb_ota

View File

@@ -25,13 +25,18 @@
"projectProp": { "projectProp": {
"platformio": { "platformio": {
"default_envs": "esp8266_4mb", "default_envs": "esp8266_4mb",
"comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32cam_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota",
"envs": [ "envs": [
{ {
"name": "esp8266_4mb", "name": "esp8266_4mb",
"firmware": "0x00000", "firmware": "0x00000",
"littlefs": "0x300000" "littlefs": "0x300000"
}, },
{
"name": "esp8266_16mb",
"firmware": "0x00000",
"littlefs": "0x200000"
},
{ {
"name": "esp32_4mb", "name": "esp32_4mb",
"boot_app0": "0xe000", "boot_app0": "0xe000",
@@ -40,6 +45,22 @@
"partitions": "0x8000", "partitions": "0x8000",
"littlefs": "0x290000" "littlefs": "0x290000"
}, },
{
"name": "esp32cam_4mb",
"boot_app0": "0xe000",
"bootloader_qio_80m": "0x1000",
"firmware": "0x10000",
"partitions": "0x8000",
"littlefs": "0x290000"
},
{
"name": "esp32_16mb",
"boot_app0": "0xe000",
"bootloader_qio_80m": "0x1000",
"firmware": "0x10000",
"partitions": "0x8000",
"littlefs": "0x910000"
},
{ {
"name": "esp8266_1mb", "name": "esp8266_1mb",
"firmware": "0x00000000", "firmware": "0x00000000",
@@ -359,6 +380,10 @@
"path": "src/modules/exec/TelegramLT", "path": "src/modules/exec/TelegramLT",
"active": true "active": true
}, },
{
"path": "src/modules/exec/Telegram_v2",
"active": false
},
{ {
"path": "src/modules/exec/Thermostat", "path": "src/modules/exec/Thermostat",
"active": false "active": false

View File

@@ -32,6 +32,10 @@
#define FIRMWARE_NAME "esp32_4mb" #define FIRMWARE_NAME "esp32_4mb"
#endif #endif
#ifdef esp32cam_4mb
#define FIRMWARE_NAME "esp32cam_4mb"
#endif
#ifdef esp32_16mb #ifdef esp32_16mb
#define FIRMWARE_NAME "esp32_16mb" #define FIRMWARE_NAME "esp32_16mb"
#endif #endif

View File

@@ -56,6 +56,8 @@
**********************************************************************************************************************/ **********************************************************************************************************************/
extern IoTGpio IoTgpio; extern IoTGpio IoTgpio;
extern IoTItem* rtcItem; extern IoTItem* rtcItem;
//extern IoTItem* camItem;
extern IoTItem* tlgrmItem;
extern TickerScheduler ts; extern TickerScheduler ts;
extern WiFiClient espClient; extern WiFiClient espClient;

View File

@@ -48,8 +48,16 @@ class IoTItem {
virtual IoTGpio* getGpioDriver(); virtual IoTGpio* getGpioDriver();
virtual IoTItem* getRtcDriver(); virtual IoTItem* getRtcDriver();
//virtual IoTItem* getCAMDriver();
virtual IoTItem* getTlgrmDriver();
virtual unsigned long getRtcUnixTime(); virtual unsigned long getRtcUnixTime();
// делаем доступным модулям отправку сообщений в телеграм
virtual void sendTelegramMsg(bool often, String msg);
virtual void sendFoto(uint8_t *buf, uint32_t length, const String &name);
virtual void editFoto(uint8_t *buf, uint32_t length, const String &name);
virtual void setValue(const IoTValue& Value, bool genEvent = true); virtual void setValue(const IoTValue& Value, bool genEvent = true);
virtual void setValue(const String& valStr, bool genEvent = true); virtual void setValue(const String& valStr, bool genEvent = true);
String getRoundValue(); String getRoundValue();
@@ -61,9 +69,6 @@ class IoTItem {
virtual void onMqttWsAppConnectEvent(); virtual void onMqttWsAppConnectEvent();
virtual void onModuleOrder(String& key, String& value); virtual void onModuleOrder(String& key, String& value);
// делаем доступным модулям отправку сообщений в телеграм
virtual void sendTelegramMsg(bool often, String msg);
// методы для графиков (будет упрощено) // методы для графиков (будет упрощено)
virtual void publishValue(); virtual void publishValue();
virtual void clearValue(); virtual void clearValue();

View File

@@ -25,7 +25,7 @@
"projectProp": { "projectProp": {
"platformio": { "platformio": {
"default_envs": "esp8266_4mb", "default_envs": "esp8266_4mb",
"comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp32cam_4mb or esp32s2_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota",
"envs": [ "envs": [
{ {
"name": "esp8266_4mb", "name": "esp8266_4mb",
@@ -45,6 +45,14 @@
"partitions": "0x8000", "partitions": "0x8000",
"littlefs": "0x290000" "littlefs": "0x290000"
}, },
{
"name": "esp32cam_4mb",
"boot_app0": "0xe000",
"bootloader_qio_80m": "0x1000",
"firmware": "0x10000",
"partitions": "0x8000",
"littlefs": "0x290000"
},
{ {
"name": "esp32_16mb", "name": "esp32_16mb",
"boot_app0": "0xe000", "boot_app0": "0xe000",
@@ -372,6 +380,10 @@
"path": "src/modules/exec/TelegramLT", "path": "src/modules/exec/TelegramLT",
"active": true "active": true
}, },
{
"path": "src/modules/exec/Telegram_v2",
"active": false
},
{ {
"path": "src/modules/exec/Thermostat", "path": "src/modules/exec/Thermostat",
"active": false "active": false

View File

@@ -199,6 +199,29 @@ build_src_filter =
+<modules/*.cpp> +<modules/*.cpp>
${env:esp32_4mb_fromitems.build_src_filter} ${env:esp32_4mb_fromitems.build_src_filter}
[env:esp32cam_4mb]
lib_deps =
${common_env_data.lib_deps_external}
${env:esp32cam_4mb_fromitems.lib_deps}
build_flags =
-Desp32cam_4mb="esp32cam_4mb"
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
framework = arduino
board = esp32cam
platform = espressif32 @5.1.1
monitor_filters = esp32_exception_decoder
upload_speed = 921600
monitor_speed = 115200
debug_tool = esp-prog
board_build.filesystem = littlefs
build_src_filter =
+<*.cpp>
+<classes/*.cpp>
+<utils/*.cpp>
+<modules/*.cpp>
${env:esp32cam_4mb_fromitems.build_src_filter}
[env:esp32s2_4mb] [env:esp32s2_4mb]
lib_deps = lib_deps =
${common_env_data.lib_deps_external} ${common_env_data.lib_deps_external}
@@ -459,6 +482,7 @@ lib_deps =
marcoschwartz/LiquidCrystal_I2C@^1.1.4 marcoschwartz/LiquidCrystal_I2C@^1.1.4
https://github.com/maxint-rd/TM16xx https://github.com/maxint-rd/TM16xx
adafruit/Adafruit GFX Library @ ^1.11.5 adafruit/Adafruit GFX Library @ ^1.11.5
adafruit/Adafruit BusIO @ ^1.13.2
build_src_filter = build_src_filter =
+<modules/virtual/Cron> +<modules/virtual/Cron>
+<modules/virtual/Loging> +<modules/virtual/Loging>
@@ -556,11 +580,25 @@ build_src_filter =
+<modules/display/Smi2_m> +<modules/display/Smi2_m>
+<modules/display/TM16XX> +<modules/display/TM16XX>
[env:esp32cam_4mb_fromitems]
lib_deps =
espressif/esp32-camera @ ^2.0.0
gyverlibs/FastBot
build_src_filter =
+<modules/virtual/Cron>
+<modules/virtual/Loging>
+<modules/virtual/LogingDaily>
+<modules/virtual/Timer>
+<modules/virtual/Variable>
+<modules/virtual/VariableColor>
+<modules/virtual/VButton>
+<modules/exec/EspCam>
+<modules/exec/Telegram_v2>
[env:esp32s2_4mb_fromitems] [env:esp32s2_4mb_fromitems]
lib_deps = lib_deps =
build_src_filter = build_src_filter =
+<modules/virtual/Cron> +<modules/virtual/Cron>
+<modules/virtual/GoogleSheet>
+<modules/virtual/Loging> +<modules/virtual/Loging>
+<modules/virtual/LogingDaily> +<modules/virtual/LogingDaily>
+<modules/virtual/Timer> +<modules/virtual/Timer>

View File

@@ -31,7 +31,10 @@ void configure(String path) {
if (driver = myIoTItem->getGpioDriver()) IoTgpio.regDriver((IoTGpio*)driver); if (driver = myIoTItem->getGpioDriver()) IoTgpio.regDriver((IoTGpio*)driver);
// пробуем спросить драйвер RTC // пробуем спросить драйвер RTC
if (driver = myIoTItem->getRtcDriver()) rtcItem = (IoTItem*)driver; if (driver = myIoTItem->getRtcDriver()) rtcItem = (IoTItem*)driver;
// пробуем спросить драйвер CAM
//if (driver = myIoTItem->getCAMDriver()) camItem = (IoTItem*)driver;
// пробуем спросить драйвер Telegram_v2
if (driver = myIoTItem->getTlgrmDriver()) tlgrmItem = (IoTItem*)driver;
IoTItems.push_back(myIoTItem); IoTItems.push_back(myIoTItem);
} }
} }
@@ -44,6 +47,8 @@ void configure(String path) {
void clearConfigure() { void clearConfigure() {
Serial.printf("Start clearing config\n"); Serial.printf("Start clearing config\n");
rtcItem = nullptr; rtcItem = nullptr;
//camItem = nullptr;
tlgrmItem = nullptr;
IoTgpio.clearDrivers(); IoTgpio.clearDrivers();
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) { for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {

View File

@@ -31,7 +31,8 @@ WebSocketsServer standWebSocket = WebSocketsServer(81);
**********************************************************************************************************************/ **********************************************************************************************************************/
IoTGpio IoTgpio(0); IoTGpio IoTgpio(0);
IoTItem* rtcItem = nullptr; IoTItem* rtcItem = nullptr;
//IoTItem* camItem = nullptr;
IoTItem* tlgrmItem = nullptr;
String settingsFlashJson = "{}"; // переменная в которой хранятся все настройки, находится в оперативной памяти и синхронизированна с flash памятью String settingsFlashJson = "{}"; // переменная в которой хранятся все настройки, находится в оперативной памяти и синхронизированна с flash памятью
String valuesFlashJson = "{}"; // переменная в которой хранятся все значения элементов, которые необходимо сохранить на flash. Находится в оперативной памяти и синхронизированна с flash памятью String valuesFlashJson = "{}"; // переменная в которой хранятся все значения элементов, которые необходимо сохранить на flash. Находится в оперативной памяти и синхронизированна с flash памятью
String errorsHeapJson = "{}"; // переменная в которой хранятся все ошибки, находится в оперативной памяти только String errorsHeapJson = "{}"; // переменная в которой хранятся все ошибки, находится в оперативной памяти только

View File

@@ -44,7 +44,7 @@ void elementsLoop() {
#define COUNTER_ERRORMARKER 4 // количество шагов счетчика #define COUNTER_ERRORMARKER 4 // количество шагов счетчика
#define STEPPER_ERRORMARKER 100000 // размер шага счетчика интервала доверия выполнения блока кода мкс #define STEPPER_ERRORMARKER 100000 // размер шага счетчика интервала доверия выполнения блока кода мкс
#ifdef esp32_4mb #if defined(esp32_4mb) || defined(esp32_16mb) || defined(esp32cam_4mb)
static int IRAM_ATTR initErrorMarkerId = 0; // ИД маркера static int IRAM_ATTR initErrorMarkerId = 0; // ИД маркера
static int IRAM_ATTR errorMarkerId = 0; static int IRAM_ATTR errorMarkerId = 0;
@@ -63,14 +63,14 @@ void IRAM_ATTR onTimer() {
#endif #endif
void initErrorMarker(int id) { void initErrorMarker(int id) {
#ifdef esp32_4mb #if defined(esp32_4mb) || defined(esp32_16mb) || defined(esp32cam_4mb)
initErrorMarkerId = id; initErrorMarkerId = id;
errorMarkerCounter = 0; errorMarkerCounter = 0;
#endif #endif
} }
void stopErrorMarker(int id) { void stopErrorMarker(int id) {
#ifdef esp32_4mb #if defined(esp32_4mb) || defined(esp32_16mb) || defined(esp32cam_4mb)
errorMarkerCounter = -1; errorMarkerCounter = -1;
if (errorMarkerId) if (errorMarkerId)
SerialPrint("I", "WARNING!", "A lazy (freezing loop more than " + (String)(COUNTER_ERRORMARKER * STEPPER_ERRORMARKER / 1000) + " ms) section has been found! With ID=" + (String)errorMarkerId); SerialPrint("I", "WARNING!", "A lazy (freezing loop more than " + (String)(COUNTER_ERRORMARKER * STEPPER_ERRORMARKER / 1000) + " ms) section has been found! With ID=" + (String)errorMarkerId);
@@ -83,7 +83,7 @@ void setup() {
#ifdef esp32s2_4mb #ifdef esp32s2_4mb
USB.begin(); USB.begin();
#endif #endif
#ifdef esp32_4mb #if defined(esp32_4mb) || defined(esp32_16mb) || defined(esp32cam_4mb)
My_timer = timerBegin(0, 80, true); My_timer = timerBegin(0, 80, true);
timerAttachInterrupt(My_timer, &onTimer, true); timerAttachInterrupt(My_timer, &onTimer, true);
timerAlarmWrite(My_timer, STEPPER_ERRORMARKER, true); timerAlarmWrite(My_timer, STEPPER_ERRORMARKER, true);

View File

@@ -101,7 +101,7 @@ String ESP32GetResetReason(uint32_t cpu_no) {
} }
} }
#endif #endif
#if defined(esp32_4mb) || defined(esp32_16mb) #if defined(esp32_4mb) || defined(esp32_16mb) || defined(esp32cam_4mb)
String ESP_getResetReason(void) { String ESP_getResetReason(void) {
return ESP32GetResetReason(0); // CPU 0 return ESP32GetResetReason(0); // CPU 0
} }

View File

@@ -184,7 +184,8 @@ void IoTItem::onModuleOrder(String& key, String& value) {}
// делаем доступным модулям отправку сообщений в телеграм // делаем доступным модулям отправку сообщений в телеграм
void IoTItem::sendTelegramMsg(bool often, String msg) {} void IoTItem::sendTelegramMsg(bool often, String msg) {}
void IoTItem::sendFoto(uint8_t *buf, uint32_t length, const String &name) {}
void IoTItem::editFoto(uint8_t *buf, uint32_t length, const String &name) {}
// методы для графиков (будет упрощено) // методы для графиков (будет упрощено)
void IoTItem::publishValue() {} void IoTItem::publishValue() {}
void IoTItem::clearValue() {} void IoTItem::clearValue() {}
@@ -211,6 +212,14 @@ IoTGpio* IoTItem::getGpioDriver() {
IoTItem* IoTItem::getRtcDriver() { IoTItem* IoTItem::getRtcDriver() {
return nullptr; return nullptr;
} }
/*
IoTItem* IoTItem::getCAMDriver() {
return nullptr;
}
*/
IoTItem* IoTItem::getTlgrmDriver() {
return nullptr;
}
unsigned long IoTItem::getRtcUnixTime() { unsigned long IoTItem::getRtcUnixTime() {
return 0; return 0;

View File

@@ -44,6 +44,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -123,6 +123,10 @@
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C", "https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
"marcoschwartz/LiquidCrystal_I2C@^1.1.4" "marcoschwartz/LiquidCrystal_I2C@^1.1.4"
], ],
"esp32cam_4mb": [
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
"marcoschwartz/LiquidCrystal_I2C@^1.1.4"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C", "https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
"marcoschwartz/LiquidCrystal_I2C@^1.1.4" "marcoschwartz/LiquidCrystal_I2C@^1.1.4"

View File

@@ -39,6 +39,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/avaksru/ESPNexUpload.git" "https://github.com/avaksru/ESPNexUpload.git"
], ],
"esp32cam_4mb": [
"https://github.com/avaksru/ESPNexUpload.git"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/avaksru/ESPNexUpload.git" "https://github.com/avaksru/ESPNexUpload.git"
], ],

View File

@@ -52,6 +52,7 @@
}, },
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [] "esp32_4mb": [],
"esp32cam_4mb": []
} }
} }

View File

@@ -107,6 +107,11 @@
"adafruit/Adafruit GFX Library @ ^1.11.5", "adafruit/Adafruit GFX Library @ ^1.11.5",
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"
], ],
"esp32cam_4mb": [
"https://github.com/maxint-rd/TM16xx",
"adafruit/Adafruit GFX Library @ ^1.11.5",
"adafruit/Adafruit BusIO @ ^1.13.2"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/maxint-rd/TM16xx", "https://github.com/maxint-rd/TM16xx",
"adafruit/Adafruit GFX Library @ ^1.11.5", "adafruit/Adafruit GFX Library @ ^1.11.5",

View File

@@ -100,6 +100,9 @@
"esp32_4mb": [ "esp32_4mb": [
"adafruit/Adafruit NeoPixel@^1.10.6" "adafruit/Adafruit NeoPixel@^1.10.6"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit NeoPixel@^1.10.6"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit NeoPixel@^1.10.6" "adafruit/Adafruit NeoPixel@^1.10.6"
] ]

View File

@@ -46,6 +46,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -45,6 +45,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -104,6 +104,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -46,6 +46,9 @@
"esp32_4mb": [ "esp32_4mb": [
"gyverlibs/EncButton @ ^2.0" "gyverlibs/EncButton @ ^2.0"
], ],
"esp32cam_4mb": [
"gyverlibs/EncButton @ ^2.0"
],
"esp8266_4mb": [ "esp8266_4mb": [
"gyverlibs/EncButton @ ^2.0" "gyverlibs/EncButton @ ^2.0"
], ],

View File

@@ -30,17 +30,15 @@ void handleGetPic();
// #define CAMERA_MODEL_ESP32S2_CAM_BOARD // #define CAMERA_MODEL_ESP32S2_CAM_BOARD
// #define CAMERA_MODEL_ESP32S3_CAM_LCD // #define CAMERA_MODEL_ESP32S3_CAM_LCD
#define LED_LEDC_CHANNEL 2 // Using different ledc channel/timer than camera #define LED_LEDC_CHANNEL 2 // Using different ledc channel/timer than camera
#define CONFIG_LED_MAX_INTENSITY 255 #define CONFIG_LED_MAX_INTENSITY 255
#include "camera_pins.h" #include "camera_pins.h"
IoTItem *_camItem = nullptr;
IoTItem* globalItem = nullptr; camera_fb_t *frame = NULL;
class EspCam : public IoTItem
{
class EspCam : public IoTItem {
private: private:
bool _useLed, _ticker, _webTicker, _initSD; bool _useLed, _ticker, _webTicker, _initSD;
@@ -48,19 +46,65 @@ class EspCam : public IoTItem {
bool isUsedLed() { return _useLed; } bool isUsedLed() { return _useLed; }
bool isWebTicker() { return _webTicker; } bool isWebTicker() { return _webTicker; }
EspCam(String parameters): IoTItem(parameters) { EspCam(String parameters) : IoTItem(parameters)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector {
jsonRead(parameters, "useLed", _useLed); // используем = 1 или нет = 0 подсветку (вспышку)
if (_useLed) {
ledcSetup(LED_LEDC_CHANNEL, 5000, 8);
ledcAttachPin(LED_GPIO_NUM, LED_LEDC_CHANNEL);
}
jsonRead(parameters, "ticker", _ticker); // тикать = 1 - сообщаем всем, что сделали снимок и он готов jsonRead(parameters, "ticker", _ticker); // тикать = 1 - сообщаем всем, что сделали снимок и он готов
jsonRead(parameters, "webTicker", _webTicker); // сообщать всем, что через веб попросили отдать картинку с камеры jsonRead(parameters, "webTicker", _webTicker); // сообщать всем, что через веб попросили отдать картинку с камеры
globalItem = this; // выносим адрес переменной экземпляра для доступа к данным из обработчика событий веб jsonRead(parameters, "flashOn", _useLed); // используем = 1 или нет = 0 подсветку (вспышку)
// globalItem = this; // выносим адрес переменной экземпляра для доступа к данным из обработчика событий веб
_camItem = this;
initCam();
HTTP.on("/getpic", HTTP_GET, handleGetPic);
initSD();
}
void doByInterval()
{
// save_picture();
}
IoTValue execute(String command, std::vector<IoTValue> &param)
{
if (command == "save")
{
if (param.size() == 1)
save_picture(param[0].valS);
else
save_picture();
}
else if (command == "flashOn" && param.size() == 1)
{
ledcSetup(LED_LEDC_CHANNEL, 5000, 8);
ledcAttachPin(LED_GPIO_NUM, LED_LEDC_CHANNEL);
_useLed = true;
}
else if (command == "flashOff")
{
_useLed = false;
}
else if (command == "sendFoto")
{
sendFoto();
}
else if (command == "editFoto")
{
editFoto();
}
return {};
}
/*
IoTItem *getCAMDriver()
{
return this;
}
*/
void initCam()
{
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); // disable brownout detector
camera_config_t config; camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0; config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0; config.ledc_timer = LEDC_TIMER_0;
@@ -92,11 +136,14 @@ class EspCam : public IoTItem {
// if PSRAM IC present, init with UXGA resolution and higher JPEG quality // if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer. // for larger pre-allocated frame buffer.
if(psramFound()){ if (psramFound())
{
config.jpeg_quality = 10; config.jpeg_quality = 10;
config.fb_count = 2; config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST; config.grab_mode = CAMERA_GRAB_LATEST;
} else { }
else
{
// Limit the frame size when PSRAM is not available // Limit the frame size when PSRAM is not available
config.frame_size = FRAMESIZE_SVGA; config.frame_size = FRAMESIZE_SVGA;
config.fb_location = CAMERA_FB_IN_DRAM; config.fb_location = CAMERA_FB_IN_DRAM;
@@ -109,19 +156,27 @@ class EspCam : public IoTItem {
// camera init // camera init
esp_err_t err = esp_camera_init(&config); esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) { if (err != ESP_OK)
{
Serial.printf("Camera init failed with error 0x%x", err); Serial.printf("Camera init failed with error 0x%x", err);
return; return;
} }
sensor_t *s = esp_camera_sensor_get(); sensor_t *s = esp_camera_sensor_get();
// initial sensors are flipped vertically and colors are a bit saturated // initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) { if (s->id.PID == OV3660_PID)
{
s->set_vflip(s, 1); // flip it back s->set_vflip(s, 1); // flip it back
s->set_brightness(s, 1); // up the brightness just a bit s->set_brightness(s, 1); // up the brightness just a bit
s->set_saturation(s, -2); // lower the saturation s->set_saturation(s, -2); // lower the saturation
} }
if (_useLed)
{
ledcSetup(LED_LEDC_CHANNEL, 5000, 8);
ledcAttachPin(LED_GPIO_NUM, LED_LEDC_CHANNEL);
}
#if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM) #if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)
s->set_vflip(s, 1); s->set_vflip(s, 1);
s->set_hmirror(s, 1); s->set_hmirror(s, 1);
@@ -130,63 +185,83 @@ class EspCam : public IoTItem {
#if defined(CAMERA_MODEL_ESP32S3_EYE) #if defined(CAMERA_MODEL_ESP32S3_EYE)
s->set_vflip(s, 1); s->set_vflip(s, 1);
#endif #endif
}
HTTP.on("/getpic", HTTP_GET, handleGetPic); void initSD()
{
// Start Micro SD card // Start Micro SD card
_initSD = true; _initSD = true;
Serial.println("Starting SD Card"); Serial.println("Starting SD Card");
if(!SD_MMC.begin("/sdcard", true)){ if (!SD_MMC.begin("/sdcard", true))
{
Serial.println("SD Card Mount Failed"); Serial.println("SD Card Mount Failed");
_initSD = false; _initSD = false;
return; return;
} }
uint8_t cardType = SD_MMC.cardType(); uint8_t cardType = SD_MMC.cardType();
if(cardType == CARD_NONE){ if (cardType == CARD_NONE)
{
Serial.println("No SD Card attached"); Serial.println("No SD Card attached");
_initSD = false; _initSD = false;
return; return;
} }
fs::FS &fs = SD_MMC; fs::FS &fs = SD_MMC;
fs.mkdir("/photos/"); fs.mkdir("/photos");
} }
void save_picture(String path = "") { void sendFoto()
// if (_useLed) digitalWrite(4, HIGH); //Turn on the flash {
if (tlgrmItem)
{
if (_useLed)
ledcWrite(LED_LEDC_CHANNEL, CONFIG_LED_MAX_INTENSITY); // Turn on the flash
frame = esp_camera_fb_get();
if (!frame)
{
SerialPrint("E", F("Esp-Cam to Telegram"), "Fail esp-cam initialization");
return;
}
if (_useLed)
ledcWrite(LED_LEDC_CHANNEL, 0);
(tlgrmItem)->sendFoto((byte *)frame->buf, frame->len, "photo.jpg");
esp_camera_fb_return(frame);
SerialPrint("i", F("Esp-Cam to Telegram"), "esp_CAM send foto");
}
}
// // Take Picture with Camera void editFoto()
// fb = esp_camera_fb_get(); {
// if(!fb || fb->len >= PICBUF_SIZE) { if (tlgrmItem)
// if (fb) { {
// Serial.printf("Camera capture failed size=%d\n", fb->len); if (_useLed)
// esp_camera_fb_return(fb); ledcWrite(LED_LEDC_CHANNEL, CONFIG_LED_MAX_INTENSITY); // Turn on the flash
// } else Serial.printf("Camera capture failed\n"); frame = esp_camera_fb_get();
// return; if (!frame)
// } {
SerialPrint("E", F("Esp-Cam to Telegram"), "Fail esp-cam initialization");
// // if (value.extBinInfoSize < fb->len) { return;
// // if (value.extBinInfo) free(value.extBinInfo); }
// // value.extBinInfo = (uint8_t*)malloc(sizeof(uint8_t) * fb->len); if (_useLed)
// // } ledcWrite(LED_LEDC_CHANNEL, 0);
// memcpy(value.extBinInfo, fb->buf, fb->len);
// value.extBinInfoSize = fb->len;
// Serial.printf("try send pic by size=%d", fb->len);
// if (_useLed) digitalWrite(4, LOW);
// if (_ticker) regEvent("shot", "EspCam");
// esp_camera_fb_return(fb);
(tlgrmItem)->editFoto((byte *)frame->buf, frame->len, "photo.jpg");
esp_camera_fb_return(frame);
SerialPrint("i", F("Esp-Cam to Telegram"), "esp_CAM edit foto");
}
}
void save_picture(String path = "")
{
// Save picture to microSD card // Save picture to microSD card
fs::FS &fs = SD_MMC; fs::FS &fs = SD_MMC;
if (path == "") { if (path == "")
{
path = "/photos/"; path = "/photos/";
path += getTodayDateDotFormated(); path += getTodayDateDotFormated();
path += "/"; // path += "/";
fs.mkdir(path.c_str()); fs.mkdir(path.c_str());
char buf[32]; char buf[32];
@@ -196,79 +271,78 @@ class EspCam : public IoTItem {
} }
Serial.println(path); Serial.println(path);
// Take Picture with Camera if (_useLed)
camera_fb_t * fb = esp_camera_fb_get(); ledcWrite(LED_LEDC_CHANNEL, CONFIG_LED_MAX_INTENSITY); // Turn on the flash
if(!fb) { // Take Picture with Camera
frame = esp_camera_fb_get();
if (_useLed)
ledcWrite(LED_LEDC_CHANNEL, 0); // Turn on the flash
if (!frame)
{
Serial.println("Camera capture failed"); Serial.println("Camera capture failed");
return; return;
} }
File file = fs.open(path.c_str(), FILE_WRITE); File file = fs.open(path.c_str(), FILE_WRITE);
if(!file){ if (!file)
{
Serial.println("Failed to open file in writing mode"); Serial.println("Failed to open file in writing mode");
} }
else { else
file.write(fb->buf, fb->len); // payload (image), payload length {
file.write(frame->buf, frame->len); // payload (image), payload length
Serial.printf("Saved file to path: %s\n", path.c_str()); Serial.printf("Saved file to path: %s\n", path.c_str());
} }
file.close(); file.close();
// return the frame buffer back to the driver for reuse // return the frame buffer back to the driver for reuse
esp_camera_fb_return(fb); esp_camera_fb_return(frame);
} }
void doByInterval() { ~EspCam()
//save_picture(); {
}
IoTValue execute(String command, std::vector<IoTValue> &param) {
if (command == "save") {
if (param.size() == 1)
save_picture(param[0].valS);
else
save_picture();
} else if (command == "ledOn" && param.size() == 1) {
ledcSetup(LED_LEDC_CHANNEL, 5000, 8);
ledcAttachPin(LED_GPIO_NUM, LED_LEDC_CHANNEL);
ledcWrite(LED_LEDC_CHANNEL, param[0].valD);
} else if (command == "ledOff") {
ledcWrite(LED_LEDC_CHANNEL, 0);
}
return {};
}
~EspCam() {
// free(value.extBinInfo); // free(value.extBinInfo);
globalItem = nullptr; _camItem = nullptr;
}; };
}; };
void handleGetPic() { void handleGetPic()
if (!globalItem) return; {
if (!_camItem)
return;
if (((EspCam*)globalItem)->isUsedLed()) ledcWrite(LED_LEDC_CHANNEL, CONFIG_LED_MAX_INTENSITY); //Turn on the flash if (((EspCam *)_camItem)->isUsedLed())
ledcWrite(LED_LEDC_CHANNEL, CONFIG_LED_MAX_INTENSITY); // Turn on the flash
camera_fb_t* fb = NULL; // camera_fb_t *fb = NULL;
fb = esp_camera_fb_get(); frame = esp_camera_fb_get();
if (!fb) {
if (((EspCam *)_camItem)->isUsedLed())
ledcWrite(LED_LEDC_CHANNEL, 0);
if (!frame)
{
HTTP.send(200, "text/json", F("Item EspCam not prepared yet or camera hasn't taken a picture yet")); HTTP.send(200, "text/json", F("Item EspCam not prepared yet or camera hasn't taken a picture yet"));
return; return;
} }
HTTP.send_P(200, "image/jpeg", (char *)fb->buf, fb->len); HTTP.send_P(200, "image/jpeg", (char *)frame->buf, frame->len);
if (((EspCam*)globalItem)->isUsedLed()) ledcWrite(LED_LEDC_CHANNEL, 0); if (((EspCam *)_camItem)->isWebTicker())
if (((EspCam*)globalItem)->isWebTicker()) globalItem->regEvent("webTakesPhoto", "EspCam"); _camItem->regEvent("webTakesPhoto", "EspCam");
esp_camera_fb_return(fb); esp_camera_fb_return(frame);
} }
void *getAPI_EspCam(String subtype, String param)
void* getAPI_EspCam(String subtype, String param) { {
if (subtype == F("EspCam")) { if (subtype == F("EspCam"))
{
return new EspCam(param); return new EspCam(param);
} else { }
else
{
return nullptr; return nullptr;
} }
} }

View File

@@ -11,7 +11,7 @@
"page": "", "page": "",
"descr": "", "descr": "",
"int": 60, "int": 60,
"useLed": 0, "flashOn": 0,
"ticker": 0, "ticker": 0,
"webTicker": 0 "webTicker": 0
} }
@@ -28,10 +28,10 @@
"esp8266_4mb": 15 "esp8266_4mb": 15
}, },
"title": "Camera OV2640 (ESPcam)", "title": "Camera OV2640 (ESPcam)",
"moduleDesc": "Предназначен для специальной платы esp32 со встроенной камерой. Добавляет в прошивку функцию создания фото и сохранения на SD при наличии. По адресу /getpic можно получить текущее фото (работает в том числе без SD карты).", "moduleDesc": "Предназначен для специальной платы esp32 со встроенной камерой. Добавляет в прошивку функцию создания фото и сохранения на SD при наличии. По адресу /getpic можно получить текущее фото (работает в том числе без SD карты). Отправка фото в телеграмм через модуль Telegram_v2",
"propInfo": { "propInfo": {
"int": "Пауза в секундах во время постоянной фотосъемки.", "int": "Пауза в секундах во время постоянной фотосъемки.",
"useLed": "использовать диод подсветки при съемке.", "flashOn": "использовать диод подсветки при съемке. используем = 1 или нет = 0 подсветку (вспышку)",
"ticker": "Генерировать(1) или нет(0) событие с интервалом int", "ticker": "Генерировать(1) или нет(0) событие с интервалом int",
"webTicker": "Генерировать(1) или нет(0) событие при обращении через веб-страницу по адресу /getpic." "webTicker": "Генерировать(1) или нет(0) событие при обращении через веб-страницу по адресу /getpic."
}, },
@@ -41,6 +41,16 @@
"descr": "Сохранить снимок на SD", "descr": "Сохранить снимок на SD",
"params": [] "params": []
}, },
{
"name": "sendFoto",
"descr": "Отправить фото с esp-CAM в телеграмм",
"params": [""]
},
{
"name": "editFoto",
"descr": "Отредактировать последнее отправленное фото в телеграмм",
"params": [""]
},
{ {
"name": "ledOn", "name": "ledOn",
"descr": "Включить подсветку", "descr": "Включить подсветку",
@@ -57,7 +67,7 @@
}, },
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [ "esp32cam_4mb": [
"espressif/esp32-camera @ ^2.0.0" "espressif/esp32-camera @ ^2.0.0"
] ]
} }

View File

@@ -35,6 +35,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -50,6 +50,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],

View File

@@ -51,6 +51,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/RoboticsBrno/ServoESP32#v1.0.3" "https://github.com/RoboticsBrno/ServoESP32#v1.0.3"
], ],
"esp32cam_4mb": [
"https://github.com/RoboticsBrno/ServoESP32#v1.0.3"
],
"esp8266_4mb": [] "esp8266_4mb": []
} }
} }

View File

@@ -40,6 +40,10 @@
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0", "adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0", "adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"

View File

@@ -40,6 +40,10 @@
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0", "adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0", "adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"

View File

@@ -92,6 +92,9 @@
"esp32_4mb": [ "esp32_4mb": [
"dfrobot/DFRobotDFPlayerMini @ ^1.0.5" "dfrobot/DFRobotDFPlayerMini @ ^1.0.5"
], ],
"esp32cam_4mb": [
"dfrobot/DFRobotDFPlayerMini @ ^1.0.5"
],
"esp8266_4mb": [ "esp8266_4mb": [
"dfrobot/DFRobotDFPlayerMini @ ^1.0.5" "dfrobot/DFRobotDFPlayerMini @ ^1.0.5"
] ]

View File

@@ -44,6 +44,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -49,6 +49,7 @@
}, },
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [] "esp32_4mb": [],
"esp32cam_4mb": []
} }
} }

View File

@@ -35,6 +35,9 @@
"esp32_4mb": [ "esp32_4mb": [
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit BusIO @ ^1.13.2"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit BusIO @ ^1.13.2" "adafruit/Adafruit BusIO @ ^1.13.2"
], ],

View File

@@ -44,6 +44,7 @@
}, },
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [] "esp32_4mb": [],
"esp32cam_4mb": []
} }
} }

View File

@@ -34,6 +34,9 @@
"usedLibs": { "usedLibs": {
"esp32_4mb": [ "esp32_4mb": [
"espressif/esp32-camera @ ^2.0.0" "espressif/esp32-camera @ ^2.0.0"
],
"esp32cam_4mb": [
"espressif/esp32-camera @ ^2.0.0"
] ]
} }
} }

View File

@@ -33,6 +33,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [] "esp8266_4mb": []
} }
} }

View File

@@ -58,6 +58,9 @@
"esp32_4mb": [ "esp32_4mb": [
"CTBot @2.1.9" "CTBot @2.1.9"
], ],
"esp32cam_4mb": [
"CTBot @2.1.9"
],
"esp32_16mb": [ "esp32_16mb": [
"CTBot @2.1.9" "CTBot @2.1.9"
], ],

View File

@@ -1,210 +0,0 @@
#include "Global.h"
#include "classes/IoTItem.h"
//#define FB_NO_UNICODE
//#define FB_NO_URLENCODE
//#define FB_NO_OTA
//#define FB_DYNAMIC
//#include <GyverGFX.h>
//#include <CharPlot.h>
#include <FastBot.h>
#include <vector>
// FastBot _myBot;
FastBot *_myBot = nullptr;
FastBot *instanceBot()
{
if (!_myBot)
{
_myBot = new FastBot();
// ot->begin();
}
return _myBot;
}
String _token;
String _chatID;
bool _autos;
class TelegramFast : public IoTItem
{
private:
bool _receiveMsg;
String _prevMsg = "";
public:
TelegramFast(String parameters) : IoTItem(parameters)
{
jsonRead(parameters, "token", _token);
jsonRead(parameters, "autos", _autos);
jsonRead(parameters, "receiveMsg", _receiveMsg);
jsonRead(parameters, "chatID", _chatID);
instanceBot();
_myBot->attach(telegramMsgParse);
#ifdef ESP32
// _myBot->useDNS(true);
#endif
_myBot->setToken(_token);
// _myBot->enableUTF8Encoding(true);
}
void loop()
{
if (_receiveMsg)
{
_myBot->tick();
}
// Далее вызов doByInterval для обработки комманд
if (enableDoByInt)
{
currentMillis = millis();
difference = currentMillis - prevMillis;
if (difference >= _interval)
{
prevMillis = millis();
this->doByInterval();
}
}
}
void doByInterval()
{
}
IoTValue execute(String command, std::vector<IoTValue> &param)
{
if (command == "sendMsg")
{
if (param.size())
{
String strTmp;
if (param[0].isDecimal)
strTmp = param[0].valD;
else
strTmp = param[0].valS;
sendTelegramMsg(false, strTmp);
}
}
else if (command == "sendOftenMsg")
{
if (param.size())
{
String strTmp;
if (param[0].isDecimal)
strTmp = param[0].valD;
else
strTmp = param[0].valS;
sendTelegramMsg(true, strTmp);
}
}
return {};
}
void static telegramMsgParse(FB_msg &msg)
{
// FB_msg msg;
SerialPrint("->", F("Telegram"), "chat ID: " + msg.chatID + ", msg: " + msg.text);
// _myBot->setChatID(_chatID);
if (_autos)
{
_chatID = msg.chatID;
}
if (msg.text.indexOf("set") != -1)
{
msg.text = deleteBeforeDelimiter(msg.text, "_");
generateOrder(selectToMarker(msg.text, "_"), selectToMarkerLast(msg.text, "_"));
_myBot->replyMessage("order done", msg.messageID, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
}
else if (msg.text.indexOf("get") != -1)
{
msg.text = deleteBeforeDelimiter(msg.text, "_");
IoTItem *item = findIoTItem(msg.text);
if (item)
{
_myBot->replyMessage(item->getValue(), msg.messageID, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
}
}
else if (msg.text.indexOf("all") != -1)
{
// String list = returnListOfParams();
String out;
std::vector<float> vctr;
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
{
if ((*it)->iAmLocal)
{
out = out + (*it)->getID() + ": " + (*it)->getValue() + "\n";
vctr.push_back(atoff((*it)->getValue().c_str()));
// _myBot->sendMessage((*it)->getID() + ": " + (*it)->getValue(), _chatID);
}
}
//_myBot->sendMessage(list, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + "\n" + out);
// _myBot->sendMessage(CharPlot<LINE_X2>(&vctr[0], vctr.size(), 5), _chatID);
// SerialPrint("<-", F("Telegram"), CharPlot<LINE_X2>(&vctr[0], vctr.size(), 10));
}
else if (msg.text.indexOf("help") != -1)
{
_myBot->sendMessage("ID: " + chipId, _chatID);
_myBot->sendMessage("chatID: " + _chatID, _chatID);
_myBot->sendMessage(F("Wrong order, use /all to get all values, /get_id to get value, or /set_id_value to set value"), _chatID);
}
else
{
// setValue(msg.text);
}
}
/*
String static returnListOfParams()
{
String out;
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
{
if ((*it)->iAmLocal)
out = out + (*it)->getID() + ": " + (*it)->getValue() + "\n";
}
return out;
}
*/
void sendTelegramMsg(bool often, String msg)
{
if (often)
{
_myBot->sendMessage(msg, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
}
else
{
if (_prevMsg != msg)
{
_prevMsg = msg;
_myBot->sendMessage(msg, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
}
}
}
~TelegramFast(){
};
};
void *getAPI_TelegramFast(String subtype, String param)
{
if (subtype == F("TelegramFast"))
{
return new TelegramFast(param);
}
else
{
return nullptr;
}
}

View File

@@ -1,72 +0,0 @@
{
"menuSection": "executive_devices",
"configItem": [{
"global": 0,
"name": "Телеграм-Бот v2",
"type": "Writing",
"subtype": "TelegramFast",
"id": "tg",
"widget": "",
"page": "",
"descr": "",
"int": 10,
"token": "",
"autos": 1,
"receiveMsg": 0,
"chatID": ""
}],
"about": {
"authorName": "Mikhail Bubnov",
"authorContact": "https://t.me/Mit4bmw",
"authorGit": "https://github.com/Mit4el",
"specialThanks": "",
"moduleName": "TelegramFast",
"moduleVersion": "1.0",
"usedRam": {
"esp32_4mb": 37,
"esp8266_4mb": 37
},
"title": "Телеграм-Бот",
"moduleDesc": "Добавляет возможность отправлять сообщения от имени бота контакту в Телеграм-чате и получать команды.",
"propInfo": {
"token": "Токен для авторизации бота в системе Telegram",
"autos": "Автоматически(1) или нет(0) запоминать ChatID по входящим сообщениям. Т.е. бот будет информировать тех, кто последний прислал сообщение.",
"receiveMsg": "Обрабатывать(1) или нет(0) входящие сообщения.",
"chatID": "ИД диалога с контактом. Необходим для отправки сообщений именно вам."
},
"funcInfo": [
{
"name": "sendMsg",
"descr": "Отправить сообщение без повторений.",
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
},
{
"name": "sendOftenMsg",
"descr": "Отправить сообщение в любом случае, даж если отправляли такое ранее.",
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
}
]
},
"defActive": false,
"usedLibs": {
"esp32_4mb": [
"gyverlibs/FastBot"
],
"esp32s2_4mb": [
"gyverlibs/GyverGFX",
"gyverlibs/CharDisplay",
"gyverlibs/FastBot"
],
"esp32_16mb": [
"gyverlibs/FastBot"
],
"esp8266_4mb": [
"gyverlibs/FastBot"
]
}
}

View File

@@ -52,6 +52,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -1,12 +1,13 @@
#include "Global.h" #include "Global.h"
#include "classes/IoTItem.h" #include "classes/IoTItem.h"
// #define FB_NO_UNICODE // #define FB_NO_UNICODE
// #define FB_NO_URLENCODE // #define FB_NO_URLENCODE
// #define FB_NO_OTA // #define FB_NO_OTA
// #define FB_DYNAMIC // #define FB_DYNAMIC
// #include <GyverGFX.h> // #include <GyverGFX.h>
// #include <CharPlot.h> // #include <CharPlot.h>
// #include "esp_camera.h"
#include <FastBot.h> #include <FastBot.h>
#include <vector> #include <vector>
@@ -25,12 +26,14 @@ FastBot *instanceBot()
String _token; String _token;
String _chatID; String _chatID;
bool _autos; bool _autos;
bool _initSD;
class Telegram_v2 : public IoTItem class Telegram_v2 : public IoTItem
{ {
private: private:
bool _receiveMsg; bool _receiveMsg;
String _prevMsg = ""; String _prevMsg = "";
bool _useLed = false;
public: public:
Telegram_v2(String parameters) : IoTItem(parameters) Telegram_v2(String parameters) : IoTItem(parameters)
@@ -243,13 +246,15 @@ public:
{ {
String path = '/' + msg.fileName; // вида /filename.xxx String path = '/' + msg.fileName; // вида /filename.xxx
auto file = FileFS.open(path, FILE_WRITE); // открываем для записи auto file = FileFS.open(path, FILE_WRITE); // открываем для записи
_myBot->sendMessage("Downloading from: " + _chatID + ", file: " + String(msg.fileName), _chatID);
if (!_myBot->downloadFile(file, msg.fileUrl)) if (!_myBot->downloadFile(file, msg.fileUrl))
{ {
SerialPrint("X", F("Telegram"), "download from: error write"); SerialPrint("X", F("Telegram"), "download from: error write");
_myBot->sendMessage("Download Fail", _chatID);
return; return;
} }
SerialPrint("<-", F("Telegram"), "download from: " + _chatID + ", file: " + String(msg.fileUrl)); SerialPrint("<-", F("Telegram"), "download from: " + _chatID + ", file: " + String(msg.fileUrl));
_myBot->sendMessage("download from: " + _chatID + ", file: " + String(msg.fileName), _chatID); _myBot->sendMessage("Download Ok", _chatID);
} }
} }
else if (msg.text.indexOf("help") != -1) else if (msg.text.indexOf("help") != -1)
@@ -293,8 +298,25 @@ public:
} }
} }
~Telegram_v2(){ void sendFoto(uint8_t *buf, uint32_t length, const String &name)
{
_myBot->sendFile(buf, length, FB_PHOTO, name, _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", send foto from esp-cam");
}
void editFoto(uint8_t *buf, uint32_t length, const String &name)
{
_myBot->editFile(buf, length, FB_PHOTO, name, _myBot->lastBotMsg(), _chatID);
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", edit foto from esp-cam");
}
IoTItem* getTlgrmDriver() {
return this;
}
~Telegram_v2(){
tlgrmItem = nullptr;
}; };
}; };

View File

@@ -68,7 +68,6 @@
"descr": "Отредактировать последний отправленный файл, с указанием типа файла: 0-фото, 1-аудио, 2-документ, 3-видео, 4-анимация, 5-голос", "descr": "Отредактировать последний отправленный файл, с указанием типа файла: 0-фото, 1-аудио, 2-документ, 3-видео, 4-анимация, 5-голос",
"params": ["Путь к файлу (/test.png)", "Тип файла/информации (число)"] "params": ["Путь к файлу (/test.png)", "Тип файла/информации (число)"]
} }
] ]
}, },
@@ -78,6 +77,9 @@
"esp32_4mb": [ "esp32_4mb": [
"gyverlibs/FastBot" "gyverlibs/FastBot"
], ],
"esp32cam_4mb": [
"gyverlibs/FastBot"
],
"esp32s2_4mb": [ "esp32s2_4mb": [
"gyverlibs/FastBot" "gyverlibs/FastBot"
], ],

View File

@@ -134,6 +134,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -42,6 +42,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],

View File

@@ -44,6 +44,9 @@
"esp32_4mb": [ "esp32_4mb": [
"adafruit/Adafruit ADS1X15 @ ^2.3.0" "adafruit/Adafruit ADS1X15 @ ^2.3.0"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit ADS1X15 @ ^2.3.0"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit ADS1X15 @ ^2.3.0" "adafruit/Adafruit ADS1X15 @ ^2.3.0"
] ]

View File

@@ -59,6 +59,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/enjoyneering/AHTxx.git" "https://github.com/enjoyneering/AHTxx.git"
], ],
"esp32cam_4mb": [
"https://github.com/enjoyneering/AHTxx.git"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/enjoyneering/AHTxx.git" "https://github.com/enjoyneering/AHTxx.git"
], ],

View File

@@ -42,6 +42,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -37,6 +37,9 @@
"esp32_4mb": [ "esp32_4mb": [
"BH1750" "BH1750"
], ],
"esp32cam_4mb": [
"BH1750"
],
"esp8266_4mb": [ "esp8266_4mb": [
"BH1750" "BH1750"
] ]

View File

@@ -62,6 +62,10 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/h2zero/NimBLE-Arduino.git", "https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git" "https://github.com/avaksru/decoder.git"
],
"esp32cam_4mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
] ]
} }
} }

View File

@@ -83,6 +83,9 @@
"esp32_4mb": [ "esp32_4mb": [
"adafruit/Adafruit BME280 Library" "adafruit/Adafruit BME280 Library"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit BME280 Library"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit BME280 Library" "adafruit/Adafruit BME280 Library"
], ],

View File

@@ -55,6 +55,9 @@
"esp32_4mb": [ "esp32_4mb": [
"adafruit/Adafruit BMP280 Library" "adafruit/Adafruit BMP280 Library"
], ],
"esp32cam_4mb": [
"adafruit/Adafruit BMP280 Library"
],
"esp8266_4mb": [ "esp8266_4mb": [
"adafruit/Adafruit BMP280 Library" "adafruit/Adafruit BMP280 Library"
], ],

View File

@@ -36,6 +36,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -55,6 +55,9 @@
"esp32_4mb": [ "esp32_4mb": [
"beegee-tokyo/DHT sensor library for ESPx" "beegee-tokyo/DHT sensor library for ESPx"
], ],
"esp32cam_4mb": [
"beegee-tokyo/DHT sensor library for ESPx"
],
"esp8266_4mb": [ "esp8266_4mb": [
"beegee-tokyo/DHT sensor library for ESPx" "beegee-tokyo/DHT sensor library for ESPx"
] ]

View File

@@ -42,6 +42,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/milesburton/Arduino-Temperature-Control-Library" "https://github.com/milesburton/Arduino-Temperature-Control-Library"
], ],
"esp32cam_4mb": [
"https://github.com/milesburton/Arduino-Temperature-Control-Library"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/milesburton/Arduino-Temperature-Control-Library" "https://github.com/milesburton/Arduino-Temperature-Control-Library"
], ],

View File

@@ -64,6 +64,10 @@
"https://github.com/jbechter/arduino-onewire-DS2423", "https://github.com/jbechter/arduino-onewire-DS2423",
"paulstoffregen/OneWire @ ^2.3.7" "paulstoffregen/OneWire @ ^2.3.7"
], ],
"esp32cam_4mb": [
"https://github.com/jbechter/arduino-onewire-DS2423",
"paulstoffregen/OneWire @ ^2.3.7"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/jbechter/arduino-onewire-DS2423", "https://github.com/jbechter/arduino-onewire-DS2423",
"paulstoffregen/OneWire @ ^2.3.7" "paulstoffregen/OneWire @ ^2.3.7"

View File

@@ -62,6 +62,9 @@
"esp32_4mb": [ "esp32_4mb": [
"openenergymonitor/EmonLib@1.1.0" "openenergymonitor/EmonLib@1.1.0"
], ],
"esp32cam_4mb": [
"openenergymonitor/EmonLib@1.1.0"
],
"esp8266_4mb": [ "esp8266_4mb": [
"openenergymonitor/EmonLib@1.1.0" "openenergymonitor/EmonLib@1.1.0"
] ]

View File

@@ -76,6 +76,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],

View File

@@ -45,6 +45,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -87,6 +87,9 @@
"esp32_4mb": [ "esp32_4mb": [
"kosme/arduinoFFT@^1.5.6" "kosme/arduinoFFT@^1.5.6"
], ],
"esp32cam_4mb": [
"kosme/arduinoFFT@^1.5.6"
],
"esp8266_4mb": [ "esp8266_4mb": [
"kosme/arduinoFFT@^1.5.6" "kosme/arduinoFFT@^1.5.6"
] ]

View File

@@ -52,6 +52,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/JonasGMorsch/GY-21.git" "https://github.com/JonasGMorsch/GY-21.git"
], ],
"esp32cam_4mb": [
"https://github.com/JonasGMorsch/GY-21.git"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/JonasGMorsch/GY-21.git" "https://github.com/JonasGMorsch/GY-21.git"
] ]

View File

@@ -55,6 +55,9 @@
"esp32_4mb": [ "esp32_4mb": [
"ClosedCube HDC1080" "ClosedCube HDC1080"
], ],
"esp32cam_4mb": [
"ClosedCube HDC1080"
],
"esp8266_4mb": [ "esp8266_4mb": [
"ClosedCube HDC1080" "ClosedCube HDC1080"
] ]

View File

@@ -49,6 +49,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/kurimawxx00/hx710B_pressure_sensor" "https://github.com/kurimawxx00/hx710B_pressure_sensor"
], ],
"esp32cam_4mb": [
"https://github.com/kurimawxx00/hx710B_pressure_sensor"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/kurimawxx00/hx710B_pressure_sensor" "https://github.com/kurimawxx00/hx710B_pressure_sensor"
] ]

View File

@@ -64,6 +64,9 @@
"esp32_4mb": [ "esp32_4mb": [
"GyverHX711@1.2" "GyverHX711@1.2"
], ],
"esp32cam_4mb": [
"GyverHX711@1.2"
],
"esp8266_4mb": [ "esp8266_4mb": [
"GyverHX711@1.2" "GyverHX711@1.2"
] ]

View File

@@ -41,6 +41,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -122,6 +122,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/GyverLibs/GyverINA" "https://github.com/GyverLibs/GyverINA"
], ],
"esp32cam_4mb": [
"https://github.com/GyverLibs/GyverINA"
],
"esp32s2_4mb": [ "esp32s2_4mb": [
"https://github.com/GyverLibs/GyverINA" "https://github.com/GyverLibs/GyverINA"
], ],

View File

@@ -122,6 +122,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/GyverLibs/GyverINA" "https://github.com/GyverLibs/GyverINA"
], ],
"esp32cam_4mb": [
"https://github.com/GyverLibs/GyverINA"
],
"esp32s2_4mb": [ "esp32s2_4mb": [
"https://github.com/GyverLibs/GyverINA" "https://github.com/GyverLibs/GyverINA"
], ],

View File

@@ -39,6 +39,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino" "https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino"
], ],
"esp32cam_4mb": [
"https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino" "https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino"
] ]

View File

@@ -82,6 +82,7 @@
"esp32s2_4mb": [ "esp32s2_4mb": [
"plerup/EspSoftwareSerial" "plerup/EspSoftwareSerial"
], ],
"esp32cam_4mb": [],
"esp8266_4mb": [] "esp8266_4mb": []
} }
} }

View File

@@ -51,6 +51,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -128,6 +128,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -64,6 +64,9 @@
"esp32_4mb": [ "esp32_4mb": [
"rc-switch @ ^2.6.4" "rc-switch @ ^2.6.4"
], ],
"esp32cam_4mb": [
"rc-switch @ ^2.6.4"
],
"esp8266_4mb": [ "esp8266_4mb": [
"rc-switch @ ^2.6.4" "rc-switch @ ^2.6.4"
], ],

View File

@@ -62,6 +62,9 @@
"esp32_4mb": [ "esp32_4mb": [
"https://github.com/tremaru/iarduino_RTC" "https://github.com/tremaru/iarduino_RTC"
], ],
"esp32cam_4mb": [
"https://github.com/tremaru/iarduino_RTC"
],
"esp8266_4mb": [ "esp8266_4mb": [
"https://github.com/tremaru/iarduino_RTC" "https://github.com/tremaru/iarduino_RTC"
], ],

View File

@@ -74,6 +74,10 @@
"Sensirion I2C SCD4x @0.4.0", "Sensirion I2C SCD4x @0.4.0",
"Sensirion Core @0.6.0" "Sensirion Core @0.6.0"
], ],
"esp32cam_4mb": [
"Sensirion I2C SCD4x @0.4.0",
"Sensirion Core @0.6.0"
],
"esp8266_4mb": [ "esp8266_4mb": [
"Sensirion I2C SCD4x @0.4.0", "Sensirion I2C SCD4x @0.4.0",
"Sensirion Core @0.6.0" "Sensirion Core @0.6.0"

View File

@@ -69,6 +69,9 @@
"esp32_4mb": [ "esp32_4mb": [
"Nova Fitness Sds dust sensors library@1.5.1" "Nova Fitness Sds dust sensors library@1.5.1"
], ],
"esp32cam_4mb": [
"Nova Fitness Sds dust sensors library@1.5.1"
],
"esp8266_4mb": [ "esp8266_4mb": [
"Nova Fitness Sds dust sensors library@1.5.1" "Nova Fitness Sds dust sensors library@1.5.1"
] ]

View File

@@ -51,6 +51,9 @@
"esp32_4mb": [ "esp32_4mb": [
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5" "sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
], ],
"esp32cam_4mb": [
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
],
"esp8266_4mb": [ "esp8266_4mb": [
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5" "sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
], ],

View File

@@ -52,6 +52,9 @@
"esp32_4mb": [ "esp32_4mb": [
"WEMOS SHT3x@1.0.0" "WEMOS SHT3x@1.0.0"
], ],
"esp32cam_4mb": [
"WEMOS SHT3x@1.0.0"
],
"esp8266_4mb": [ "esp8266_4mb": [
"WEMOS SHT3x@1.0.0" "WEMOS SHT3x@1.0.0"
], ],

View File

@@ -38,6 +38,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],
"esp8266_1mb": [], "esp8266_1mb": [],
"esp8266_1mb_ota": [], "esp8266_1mb_ota": [],

View File

@@ -77,6 +77,9 @@
"esp32_4mb": [ "esp32_4mb": [
"plerup/EspSoftwareSerial" "plerup/EspSoftwareSerial"
], ],
"esp32cam_4mb": [
"plerup/EspSoftwareSerial"
],
"esp8266_4mb": [ "esp8266_4mb": [
"plerup/EspSoftwareSerial" "plerup/EspSoftwareSerial"
], ],

View File

@@ -50,6 +50,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -59,6 +59,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [] "esp8266_4mb": []
} }

View File

@@ -51,6 +51,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -84,7 +84,7 @@ class LogingDaily : public IoTItem {
if (telegram == 1) { if (telegram == 1) {
String msg = descr + ": total " + String(currentValue) + ", consumed " + String(difference); String msg = descr + ": total " + String(currentValue) + ", consumed " + String(difference);
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) { for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getSubtype() == "TelegramLT" || "Telegram") { if ((*it)->getSubtype() == "TelegramLT" || "Telegram" || "Telegram_v2") {
(*it)->sendTelegramMsg(false, msg); (*it)->sendTelegramMsg(false, msg);
} }
} }

View File

@@ -44,6 +44,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -74,6 +74,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -36,6 +36,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -96,6 +96,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -35,6 +35,7 @@
"defActive": true, "defActive": true,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],

View File

@@ -40,6 +40,7 @@
"defActive": false, "defActive": false,
"usedLibs": { "usedLibs": {
"esp32_4mb": [], "esp32_4mb": [],
"esp32cam_4mb": [],
"esp32_16mb": [], "esp32_16mb": [],
"esp32s2_4mb": [], "esp32s2_4mb": [],
"esp8266_4mb": [], "esp8266_4mb": [],