mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-04-02 05:19:27 +03:00
Merge pull request #4 from Mit4el/ver4dev
Оптимизация Pzem, плата 8266_2mb, исправили графики
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
# esp8266_1mb_ota
|
||||
# esp8285_1mb
|
||||
# esp8285_1mb_ota
|
||||
# esp8266_2mb
|
||||
# esp8266_2mb_ota
|
||||
|
||||
import configparser
|
||||
import os, json, sys, getopt
|
||||
@@ -119,7 +121,7 @@ deviceName = profJson['projectProp']['platformio']['default_envs']
|
||||
|
||||
# назначаем папку с файлами прошивки в зависимости от устройства и запоминаем в профиле
|
||||
dataDir = 'data_svelte'
|
||||
if deviceName == 'esp8266_1mb_ota' or deviceName == 'esp8285_1mb_ota':
|
||||
if deviceName == 'esp8266_1mb_ota' or deviceName == 'esp8285_1mb_ota' or deviceName == 'esp8266_2mb_ota':
|
||||
dataDir = 'data_svelte_lite'
|
||||
profJson['projectProp'] = {
|
||||
'platformio': {
|
||||
|
||||
@@ -11,6 +11,14 @@
|
||||
#define FIRMWARE_NAME "esp8266_1mb"
|
||||
#endif
|
||||
|
||||
#ifdef esp8266_2mb
|
||||
#define FIRMWARE_NAME "esp8266_2mb"
|
||||
#endif
|
||||
|
||||
#ifdef esp8266_2mb_ota
|
||||
#define FIRMWARE_NAME "esp8266_2mb_ota"
|
||||
#endif
|
||||
|
||||
#ifdef esp8266_4mb
|
||||
#define FIRMWARE_NAME "esp8266_4mb"
|
||||
#endif
|
||||
|
||||
190
platformio.ini
190
platformio.ini
@@ -1,6 +1,6 @@
|
||||
[platformio]
|
||||
default_envs = esp8266_4mb
|
||||
data_dir = data_svelte
|
||||
default_envs = esp8266_2mb_ota
|
||||
data_dir = data_svelte_lite
|
||||
|
||||
[common_env_data]
|
||||
lib_deps_external =
|
||||
@@ -70,6 +70,48 @@ build_src_filter =
|
||||
+<modules/*.cpp>
|
||||
${env:esp8285_1mb_ota_fromitems.build_src_filter}
|
||||
|
||||
[env:esp8266_2mb]
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${env:esp8266_2mb_fromitems.lib_deps}
|
||||
ESPAsyncUDP
|
||||
build_flags = -Desp8266_2mb="esp8266_2mb"
|
||||
framework = arduino
|
||||
board = d1_wroom_02
|
||||
board_build.ldscript = eagle.flash.2m1m.ld
|
||||
platform = espressif8266
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
build_src_filter =
|
||||
+<*.cpp>
|
||||
+<classes/*.cpp>
|
||||
+<utils/*.cpp>
|
||||
+<modules/*.cpp>
|
||||
${env:esp8266_2mb_fromitems.build_src_filter}
|
||||
|
||||
[env:esp8266_2mb_ota]
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${env:esp8266_2mb_fromitems.lib_deps}
|
||||
ESPAsyncUDP
|
||||
build_flags = -Desp8266_2mb_ota="esp8266_2mb_ota"
|
||||
framework = arduino
|
||||
board = d1_wroom_02
|
||||
board_build.ldscript = eagle.flash.2m256.ld
|
||||
platform = espressif8266
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
build_src_filter =
|
||||
+<*.cpp>
|
||||
+<classes/*.cpp>
|
||||
+<utils/*.cpp>
|
||||
+<modules/*.cpp>
|
||||
${env:esp8266_2mb_fromitems.build_src_filter}
|
||||
|
||||
[env:esp8285_1mb]
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
@@ -134,69 +176,74 @@ build_src_filter =
|
||||
|
||||
[env:esp8266_1mb_ota_fromitems]
|
||||
lib_deps =
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||
https://github.com/tremaru/iarduino_RTC
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
plerup/espsoftwareserial
|
||||
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/sensors/AnalogAdc>
|
||||
|
||||
+<modules/sensors/Bme280>
|
||||
+<modules/sensors/Bmp280>
|
||||
+<modules/sensors/Ds18b20>
|
||||
+<modules/sensors/RTC>
|
||||
+<modules/sensors/Sht20>
|
||||
+<modules/sensors/Sht30>
|
||||
+<modules/sensors/Sonar>
|
||||
+<modules/exec/ButtonIn>
|
||||
+<modules/exec/ButtonOut>
|
||||
+<modules/exec/Mcp23017>
|
||||
+<modules/exec/Multitouch>
|
||||
+<modules/exec/Pcf8574>
|
||||
+<modules/exec/Pwm8266>
|
||||
+<modules/sensors/Pzem004t>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/Lcd2004>
|
||||
|
||||
[env:esp8266_1mb_fromitems]
|
||||
lib_deps =
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
milesburton/DallasTemperature@^3.9.1
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
plerup/espsoftwareserial
|
||||
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/sensors/AnalogAdc>
|
||||
+<modules/sensors/Bme280>
|
||||
+<modules/sensors/Bmp280>
|
||||
+<modules/sensors/Ds18b20>
|
||||
+<modules/sensors/Sht20>
|
||||
+<modules/sensors/Sht30>
|
||||
+<modules/sensors/Sonar>
|
||||
+<modules/sensors/Pzem004t>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/ButtonIn>
|
||||
+<modules/exec/ButtonOut>
|
||||
+<modules/exec/Mcp23017>
|
||||
+<modules/exec/Multitouch>
|
||||
+<modules/exec/Pcf8574>
|
||||
+<modules/exec/Pwm8266>
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/Lcd2004>
|
||||
|
||||
[env:esp8266_2mb_fromitems]
|
||||
lib_deps =
|
||||
plerup/EspSoftwareSerial
|
||||
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/sensors/Pzem004t>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/TelegramLT>
|
||||
|
||||
[env:esp8266_2mb_ota_fromitems]
|
||||
lib_deps =
|
||||
plerup/EspSoftwareSerial
|
||||
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/sensors/Pzem004t>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/TelegramLT>
|
||||
|
||||
[env:esp8285_1mb_ota_fromitems]
|
||||
lib_deps =
|
||||
@@ -255,21 +302,7 @@ build_src_filter =
|
||||
|
||||
[env:esp8266_4mb_fromitems]
|
||||
lib_deps =
|
||||
https://github.com/enjoyneering/AHTxx.git
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
beegee-tokyo/DHT sensor library for ESPx
|
||||
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||
https://github.com/tremaru/iarduino_RTC
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
plerup/EspSoftwareSerial
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
build_src_filter =
|
||||
+<modules/virtual/Cron>
|
||||
+<modules/virtual/Loging>
|
||||
@@ -278,48 +311,16 @@ build_src_filter =
|
||||
+<modules/virtual/Variable>
|
||||
+<modules/virtual/VariableColor>
|
||||
+<modules/virtual/VButton>
|
||||
+<modules/sensors/Acs712>
|
||||
+<modules/sensors/AhtXX>
|
||||
+<modules/sensors/AnalogAdc>
|
||||
+<modules/sensors/Bme280>
|
||||
+<modules/sensors/Bmp280>
|
||||
+<modules/sensors/Dht1122>
|
||||
+<modules/sensors/Ds18b20>
|
||||
+<modules/sensors/Pzem004t>
|
||||
+<modules/sensors/RTC>
|
||||
+<modules/sensors/Sht20>
|
||||
+<modules/sensors/Sht30>
|
||||
+<modules/sensors/Sonar>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/ButtonIn>
|
||||
+<modules/exec/ButtonOut>
|
||||
+<modules/exec/IoTServo>
|
||||
+<modules/exec/Mcp23017>
|
||||
+<modules/exec/Mp3>
|
||||
+<modules/exec/Multitouch>
|
||||
+<modules/exec/Pcf8574>
|
||||
+<modules/exec/Pwm8266>
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/Lcd2004>
|
||||
|
||||
[env:esp32_4mb_fromitems]
|
||||
lib_deps =
|
||||
https://github.com/enjoyneering/AHTxx.git
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
beegee-tokyo/DHT sensor library for ESPx
|
||||
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||
https://github.com/tremaru/iarduino_RTC
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
plerup/EspSoftwareSerial
|
||||
https://github.com/RoboticsBrno/ServoESP32
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
build_src_filter =
|
||||
+<modules/virtual/Cron>
|
||||
+<modules/virtual/Loging>
|
||||
@@ -328,27 +329,12 @@ build_src_filter =
|
||||
+<modules/virtual/Variable>
|
||||
+<modules/virtual/VariableColor>
|
||||
+<modules/virtual/VButton>
|
||||
+<modules/sensors/Acs712>
|
||||
+<modules/sensors/AhtXX>
|
||||
+<modules/sensors/AnalogAdc>
|
||||
+<modules/sensors/Bme280>
|
||||
+<modules/sensors/Bmp280>
|
||||
+<modules/sensors/Dht1122>
|
||||
+<modules/sensors/Ds18b20>
|
||||
+<modules/sensors/Pzem004t>
|
||||
+<modules/sensors/RTC>
|
||||
+<modules/sensors/Sht20>
|
||||
+<modules/sensors/Sht30>
|
||||
+<modules/sensors/Sonar>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/ButtonIn>
|
||||
+<modules/exec/ButtonOut>
|
||||
+<modules/exec/IoTServo>
|
||||
+<modules/exec/Mcp23017>
|
||||
+<modules/exec/Mp3>
|
||||
+<modules/exec/Multitouch>
|
||||
+<modules/exec/Pcf8574>
|
||||
+<modules/exec/Pwm32>
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/Lcd2004>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void ntpInit() {
|
||||
}
|
||||
|
||||
void synchTime() {
|
||||
configTime(0, 0, "pool.ntp.org", "ru.pool.ntp.org", "pool.ntp.org");
|
||||
configTime(0, 0, "pool.ntp.org", "ru.pool.ntp.org", jsonReadStr(settingsFlashJson, F("ntp")).c_str());
|
||||
}
|
||||
|
||||
//событие смены даты
|
||||
|
||||
@@ -72,7 +72,7 @@ bool upgradeBuild() {
|
||||
handleUpdateStatus(true, PATH_ERROR);
|
||||
return ret;
|
||||
}
|
||||
#if defined (esp8266_4mb) || defined (esp8266_1mb) || defined (esp8266_1mb_ota)
|
||||
#if defined (esp8266_4mb) || defined (esp8266_1mb) || defined (esp8266_1mb_ota) || defined (esp8266_2mb) || defined (esp8266_2mb_ota)
|
||||
ESPhttpUpdate.rebootOnUpdate(false);
|
||||
t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, getBinPath("firmware.bin"));
|
||||
#endif
|
||||
|
||||
@@ -127,6 +127,14 @@
|
||||
"esp8285_1mb_ota": [
|
||||
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
|
||||
"marcoschwartz/LiquidCrystal_I2C@^1.1.4"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
|
||||
"marcoschwartz/LiquidCrystal_I2C@^1.1.4"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"https://github.com/robotclass/RobotClass_LiquidCrystal_I2C",
|
||||
"marcoschwartz/LiquidCrystal_I2C@^1.1.4"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,14 @@
|
||||
"esp8285_1mb_ota": [
|
||||
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"adafruit/Adafruit Mcp23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,14 @@
|
||||
"esp8285_1mb_ota": [
|
||||
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"adafruit/Adafruit MCP23017 Arduino Library@^2.1.0",
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,24 @@
|
||||
],
|
||||
"esp8266_4mb": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8266_1mb": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8266_1mb_ota": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8285_1mb": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"adafruit/Adafruit BME280 Library"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,20 @@
|
||||
"esp8266_1mb_ota": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
],
|
||||
"esp8285_1mb": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"adafruit/Adafruit BMP280 Library"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -35,17 +35,13 @@
|
||||
},
|
||||
"defActive": false,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [
|
||||
],
|
||||
"esp8266_4mb": [
|
||||
],
|
||||
"esp8266_1mb": [
|
||||
],
|
||||
"esp8266_1mb_ota": [
|
||||
],
|
||||
"esp8285_1mb": [
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
]
|
||||
"esp32_4mb": [],
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"https://github.com/milesburton/Arduino-Temperature-Control-Library"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"https://github.com/milesburton/Arduino-Temperature-Control-Library"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"https://github.com/milesburton/Arduino-Temperature-Control-Library"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,10 @@ class PZEMSensor {
|
||||
bool search();
|
||||
// Get most up to date values from device registers and cache them
|
||||
bool refresh();
|
||||
void updateSerial(Stream *serial) {_serial = serial;}
|
||||
|
||||
private:
|
||||
void init(void);
|
||||
void init(void);
|
||||
|
||||
private:
|
||||
PZEM_Info _values; // Measured values
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
|
||||
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include "PZEMSensor.h"
|
||||
#include "modules/sensors/UART/Uart.h"
|
||||
#include <map>
|
||||
|
||||
// глобальные списки необходимы для хранения объектов об экземплярах Pzem . Ключ - адрес
|
||||
std::map<String, PZEMSensor*> pzemSensorArray;
|
||||
//PZEMContainer _pzemCntr;
|
||||
|
||||
|
||||
|
||||
class Pzem004v : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004v(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
// раскомментируйте эту строку если нужно поменять адрес pzem
|
||||
// SerialPrint("i", "Pzem", String(pzem->setAddress(0x03)));
|
||||
}
|
||||
Pzem004v(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -30,6 +32,9 @@ class Pzem004v : public IoTItem {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,14 +44,11 @@ class Pzem004v : public IoTItem {
|
||||
class Pzem004a : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004a(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
Pzem004a(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -59,6 +61,9 @@ class Pzem004a : public IoTItem {
|
||||
regEvent(NAN, "Pzem A");
|
||||
SerialPrint("E", "Pzem", "A error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,14 +73,11 @@ class Pzem004a : public IoTItem {
|
||||
class Pzem004w : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004w(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
Pzem004w(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -88,6 +90,9 @@ class Pzem004w : public IoTItem {
|
||||
regEvent(NAN, "Pzem W");
|
||||
SerialPrint("E", "Pzem", "W error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +102,11 @@ class Pzem004w : public IoTItem {
|
||||
class Pzem004wh : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004wh(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
Pzem004wh(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -117,6 +119,9 @@ class Pzem004wh : public IoTItem {
|
||||
regEvent(NAN, "Pzem Wh");
|
||||
SerialPrint("E", "Pzem", "Wh error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,14 +131,11 @@ class Pzem004wh : public IoTItem {
|
||||
class Pzem004hz : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004hz(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
Pzem004hz(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -146,6 +148,9 @@ class Pzem004hz : public IoTItem {
|
||||
regEvent(NAN, "Pzem Hz");
|
||||
SerialPrint("E", "Pzem", "Hz error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,14 +160,11 @@ class Pzem004hz : public IoTItem {
|
||||
class Pzem004pf : public IoTItem {
|
||||
private:
|
||||
String addr;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004pf(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
Pzem004pf(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
pzem = _pzem;
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -175,6 +177,9 @@ class Pzem004pf : public IoTItem {
|
||||
regEvent(NAN, "Pzem Pf");
|
||||
SerialPrint("E", "Pzem", "Pf error", _id);
|
||||
}
|
||||
} else {
|
||||
regEvent(NAN, "Pzem V");
|
||||
SerialPrint("E", "Pzem", "V error", _id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,17 +192,17 @@ class Pzem004cmd : public IoTItem {
|
||||
int changeaddr;
|
||||
String setaddr;
|
||||
int reset;
|
||||
PZEMSensor* pzem;
|
||||
PZEMSensor* pzem = nullptr;
|
||||
|
||||
public:
|
||||
Pzem004cmd(String parameters) : IoTItem(parameters) {
|
||||
Pzem004cmd(PZEMSensor* _pzem, String parameters) : IoTItem(parameters) {
|
||||
jsonRead(parameters, F("addr"), addr);
|
||||
jsonRead(parameters, F("changeaddr"), changeaddr);
|
||||
jsonRead(parameters, F("setaddr"), setaddr);
|
||||
jsonRead(parameters, F("reset"), reset);
|
||||
|
||||
if (myUART) {
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
pzem = _pzem;
|
||||
if (pzem && myUART) {
|
||||
if (changeaddr == 1) {
|
||||
if (pzem->setAddress(hexStringToUint8(setaddr))) {
|
||||
SerialPrint("i", "Pzem", "address set: " + setaddr);
|
||||
@@ -212,7 +217,7 @@ class Pzem004cmd : public IoTItem {
|
||||
SerialPrint("i", "Pzem", "reset error");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else SerialPrint("i", "Pzem", "Pzem command error");
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
@@ -224,20 +229,37 @@ class Pzem004cmd : public IoTItem {
|
||||
};
|
||||
|
||||
void* getAPI_Pzem004(String subtype, String param) {
|
||||
PZEMSensor *pzem = nullptr;
|
||||
if (myUART) {
|
||||
if (subtype == F("Pzem004v") || subtype == F("Pzem004a") || subtype == F("Pzem004w")
|
||||
|| subtype == F("Pzem004wh") || subtype == F("Pzem004hz") || subtype == F("Pzem004pf")
|
||||
|| subtype == F("Pzem004cmd") ) {
|
||||
String addr;
|
||||
jsonRead(param, "addr", addr);
|
||||
if (pzemSensorArray.find(addr) == pzemSensorArray.end()) {
|
||||
// pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
pzemSensorArray[addr] = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
} else {
|
||||
pzemSensorArray[addr]->updateSerial(myUART);
|
||||
}
|
||||
pzem = pzemSensorArray[addr];
|
||||
}
|
||||
}
|
||||
|
||||
if (subtype == F("Pzem004v")) {
|
||||
return new Pzem004v(param);
|
||||
return new Pzem004v(pzem, param);
|
||||
} else if (subtype == F("Pzem004a")) {
|
||||
return new Pzem004a(param);
|
||||
return new Pzem004a(pzem, param);
|
||||
} else if (subtype == F("Pzem004w")) {
|
||||
return new Pzem004w(param);
|
||||
return new Pzem004w(pzem, param);
|
||||
} else if (subtype == F("Pzem004wh")) {
|
||||
return new Pzem004wh(param);
|
||||
return new Pzem004wh(pzem, param);
|
||||
} else if (subtype == F("Pzem004hz")) {
|
||||
return new Pzem004hz(param);
|
||||
return new Pzem004hz(pzem, param);
|
||||
} else if (subtype == F("Pzem004pf")) {
|
||||
return new Pzem004pf(param);
|
||||
return new Pzem004pf(pzem, param);
|
||||
} else if (subtype == F("Pzem004cmd")) {
|
||||
return new Pzem004cmd(param);
|
||||
return new Pzem004cmd(pzem, param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,12 @@
|
||||
"defActive": true,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp8266_4mb": []
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"rc-switch @ ^2.6.4"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"rc-switch @ ^2.6.4"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"rc-switch @ ^2.6.4"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,8 @@
|
||||
"esp8266_1mb": ["https://github.com/tremaru/iarduino_RTC"],
|
||||
"esp8266_1mb_ota": ["https://github.com/tremaru/iarduino_RTC"],
|
||||
"esp8285_1mb": ["https://github.com/tremaru/iarduino_RTC"],
|
||||
"esp8285_1mb_ota": ["https://github.com/tremaru/iarduino_RTC"]
|
||||
"esp8285_1mb_ota": ["https://github.com/tremaru/iarduino_RTC"],
|
||||
"esp8266_2mb": ["https://github.com/tremaru/iarduino_RTC"],
|
||||
"esp8266_2mb_ota": ["https://github.com/tremaru/iarduino_RTC"]
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"sparkfun/SparkFun SGP30 Arduino Library@^1.0.5"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"robtillaart/SHT2x@^0.1.1"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"robtillaart/SHT2x@^0.1.1"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"robtillaart/SHT2x@^0.1.1"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,12 @@
|
||||
],
|
||||
"esp8285_1mb_ota": [
|
||||
"WEMOS SHT3x@1.0.0"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"WEMOS SHT3x@1.0.0"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"WEMOS SHT3x@1.0.0"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@
|
||||
"descr": "",
|
||||
"widget": "nil",
|
||||
"id": "u",
|
||||
"tx": 12,
|
||||
"rx": 13,
|
||||
"tx": 4,
|
||||
"rx": 5,
|
||||
"line": 2,
|
||||
"speed": 9600,
|
||||
"eventFormat": 0
|
||||
@@ -70,6 +70,19 @@
|
||||
],
|
||||
"esp8266_4mb": [
|
||||
"plerup/EspSoftwareSerial"
|
||||
],
|
||||
"esp8266_1mb": [
|
||||
"plerup/EspSoftwareSerial"
|
||||
],
|
||||
"esp8266_1mb_ota": [
|
||||
"plerup/EspSoftwareSerial"
|
||||
],
|
||||
"esp8266_2mb": [
|
||||
"plerup/EspSoftwareSerial"
|
||||
],
|
||||
"esp8266_2mb_ota": [
|
||||
"plerup/EspSoftwareSerial"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,8 @@ class Loging : public IoTItem {
|
||||
|
||||
String logData;
|
||||
|
||||
jsonWriteInt(logData, "x", unixTime);
|
||||
jsonWriteFloat(logData, "y1", value.toFloat());
|
||||
jsonWriteInt(logData, "x", unixTime, false);
|
||||
jsonWriteFloat(logData, "y1", value.toFloat(), false);
|
||||
|
||||
// прочитаем путь к файлу последнего сохранения
|
||||
String filePath = readDataDB(id);
|
||||
@@ -119,8 +119,8 @@ class Loging : public IoTItem {
|
||||
}
|
||||
regEvent(value, F("LogingEvent"));
|
||||
String logData;
|
||||
jsonWriteInt(logData, "x", unixTime);
|
||||
jsonWriteFloat(logData, "y1", value.toFloat());
|
||||
jsonWriteInt(logData, "x", unixTime, false);
|
||||
jsonWriteFloat(logData, "y1", value.toFloat(), false);
|
||||
// прочитаем путь к файлу последнего сохранения
|
||||
String filePath = readDataDB(id);
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
"defActive": true,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp8266_4mb": []
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class LogingDaily : public IoTItem {
|
||||
if (!firstTimeInit) {
|
||||
if (prevDate != currentDate) {
|
||||
changed = true;
|
||||
SerialPrint("i", F("NTP"), "Change day event");
|
||||
SerialPrint("i", F("NTP"), F("Change day event"));
|
||||
#if defined(ESP8266)
|
||||
FileFS.gc();
|
||||
#endif
|
||||
@@ -164,7 +164,7 @@ class LogingDaily : public IoTItem {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
firstTimeInit = false;
|
||||
if (isTimeSynch) firstTimeInit = false;
|
||||
prevDate = currentDate;
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
"defActive": true,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp8266_4mb": []
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,8 @@
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp8285_1mb_ota": [],
|
||||
"esp8266_2mb": [],
|
||||
"esp8266_2mb_ota": []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user