mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 12:17:05 +00:00
Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e060c83cf8 | ||
|
|
5480af2d5d | ||
|
|
ff28605d39 | ||
|
|
fe0ca9b9a3 | ||
|
|
54ef70aee9 | ||
|
|
e24d077061 | ||
|
|
7ebf29d857 | ||
|
|
33c6925376 | ||
|
|
0b383a1f3b | ||
|
|
70d1b0807c | ||
|
|
8e1f4d628b | ||
|
|
ef29603f05 | ||
|
|
71b27d95fa | ||
|
|
787c1c6c39 | ||
|
|
74e4848edc | ||
|
|
9a7690473a | ||
|
|
3fc1ba27e5 | ||
|
|
b2212d2edb | ||
|
|
76f7dc82fc | ||
|
|
86233b65bc | ||
|
|
984cfe23a0 | ||
|
|
621087d48f | ||
|
|
9336697f1a | ||
|
|
ad06cbc835 | ||
|
|
f5b026e678 | ||
|
|
e29eb2eb3c | ||
|
|
10329f4351 | ||
|
|
ab4750d5fa | ||
|
|
b9f3f68335 | ||
|
|
777485077c | ||
|
|
3e3ef4253f | ||
|
|
0e78b1f8c4 | ||
|
|
e7764ca7e6 |
Vendored
+73
@@ -1,3 +1,76 @@
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180719 (since mega-20180716)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Thu Jul 19 04:00:14 CEST 2018
|
||||
|
||||
Benno Eigenmann (1):
|
||||
lib_archive already exists & Implicit dependency not found
|
||||
|
||||
TD-er (1):
|
||||
[sunrise/sunset] Allow offset from sunrise/sunset
|
||||
|
||||
denisfrench (1):
|
||||
When clientid = %sysname%, only add %unit% if non-zero
|
||||
|
||||
stefan (1):
|
||||
Fix for P077 crashes
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180716 (since mega-20180714)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Mon Jul 16 04:00:09 CEST 2018
|
||||
|
||||
TD-er (4):
|
||||
[WiFi] Reset wifi when IP is set to 0.0.0.0
|
||||
[Scheduler] Complete rewrite of time based scheduling
|
||||
[JSON] Fixed broken JSON output on /json URL
|
||||
[ESP32] Show partition table on sysinfo page
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180714 (since mega-20180712)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Sat Jul 14 04:00:13 CEST 2018
|
||||
|
||||
Gijs Noorlander (1):
|
||||
[#1567] Only check values set before sending
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180712 (since mega-20180710)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Thu Jul 12 04:00:12 CEST 2018
|
||||
|
||||
TD-er (2):
|
||||
[#1555] Fix TSL2591 values are not transferred to controller
|
||||
[#1542] Fix Domoticz IDX more than 4 characters
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180710 (since mega-20180708)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Tue Jul 10 04:00:12 CEST 2018
|
||||
|
||||
Grovkillen (1):
|
||||
P077: changed category to "energy"
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180708 (since mega-20180705)
|
||||
-------------------------------------------------
|
||||
|
||||
Release date: Sun Jul 8 04:00:08 CEST 2018
|
||||
|
||||
TD-er (1):
|
||||
[PIO build] Build issues caused by incorrect precompile processing
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
Changes in release mega-20180705 (since mega-20180625)
|
||||
-------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@ License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#include <Arduino.h>
|
||||
|
||||
// The Arduino standard GPIO routines are not enough,
|
||||
@@ -239,3 +239,4 @@ void ICACHE_RAM_ATTR ESPeasySoftwareSerial::rxRead() {
|
||||
// it gets set even when interrupts are disabled
|
||||
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, 1 << m_rxPin);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@ License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#ifndef ESPeasySoftwareSerial_h
|
||||
#define ESPeasySoftwareSerial_h
|
||||
|
||||
@@ -76,3 +76,4 @@ private:
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
License along with MechInputs. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#include "jkSDS011.h"
|
||||
|
||||
CjkSDS011::CjkSDS011(int16_t pinRX, int16_t pinTX)
|
||||
@@ -186,3 +186,4 @@ boolean CjkSDS011::ReadAverage(float &pm25, float &pm10)
|
||||
pm10 = NAN;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
License along with MechInputs. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#ifndef _jkSDS011_H_
|
||||
#define _jkSDS011_H_
|
||||
|
||||
@@ -79,3 +79,4 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+316
-281
@@ -1,51 +1,51 @@
|
||||
#
|
||||
# PlatformIO Project Configuration File
|
||||
#
|
||||
# Please make sure to read documentation with examples first
|
||||
# http://docs.platformio.org/en/stable/projectconf.html
|
||||
#
|
||||
;
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Please make sure to read documentation with examples first
|
||||
; http://docs.platformio.org/en/stable/projectconf.html
|
||||
;
|
||||
|
||||
###########################################################################################
|
||||
# You can uncomment or add here Your favorite environment you want to work on at the moment
|
||||
# (uncomment only one !)
|
||||
###########################################################################################
|
||||
; *********************************************************************;
|
||||
; You can uncomment or add here Your favorite environment you want to work on at the moment
|
||||
; (uncomment only one !)
|
||||
; *********************************************************************;
|
||||
|
||||
[platformio]
|
||||
#env_default = esp32dev
|
||||
#env_default = dev_ESP8266_4096
|
||||
#env_default = normal_ESP8266_1024
|
||||
#env_default = normal_ESP8266_4096
|
||||
# ..etc
|
||||
;env_default = esp32dev
|
||||
;env_default = dev_ESP8266_4096
|
||||
;env_default = normal_ESP8266_1024
|
||||
;env_default = normal_ESP8266_4096
|
||||
; ..etc
|
||||
|
||||
|
||||
|
||||
#minimal version for esps with 512K or less flash (only has minimal plugin set)
|
||||
;minimal version for esps with 512K or less flash (only has minimal plugin set)
|
||||
; [env:mini_512]
|
||||
; platform = ${common.platform}
|
||||
; framework = ${common.framework}
|
||||
; board = esp01
|
||||
; upload_speed = ${common.upload_speed}
|
||||
; build_flags = !echo -Wl,-Tesp8266.flash.512k64.ld -D BUILD_GIT=\'\"$(git describe)\"\'
|
||||
; # upload_port = /dev/ttyUSB0
|
||||
; ; upload_port = /dev/ttyUSB0
|
||||
|
||||
# add these:
|
||||
# -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op
|
||||
# -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel
|
||||
# -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option
|
||||
# thanks @chouffe103
|
||||
; add these:
|
||||
; -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op
|
||||
; -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel
|
||||
; -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option
|
||||
; thanks @chouffe103
|
||||
[compiler_warnings]
|
||||
build_flags =
|
||||
-Wall -Wno-parentheses -fdiagnostics-show-option
|
||||
|
||||
##########################################################################################
|
||||
; *********************************************************************
|
||||
|
||||
###### Definition cheat sheet:
|
||||
# board_build.flash_mode in terms of performance: QIO > QOUT > DIO > DOUT
|
||||
# for lib_ldf_mode, see http://docs.platformio.org/en/latest/librarymanager/ldf.html#ldf
|
||||
; **** Definition cheat sheet:
|
||||
; board_build.flash_mode in terms of performance: QIO > QOUT > DIO > DOUT
|
||||
; for lib_ldf_mode, see http://docs.platformio.org/en/latest/librarymanager/ldf.html;ldf
|
||||
|
||||
###### Frequently used build flags:
|
||||
# Use custom.h file to override default settings for ESPeasy: -D USE_CUSTOM_H
|
||||
# Set VCC mode to measure Vcc of ESP chip : -D FEATURE_ADC_VCC=true
|
||||
; **** Frequently used build flags:
|
||||
; Use custom.h file to override default settings for ESPeasy: -D USE_CUSTOM_H
|
||||
; Set VCC mode to measure Vcc of ESP chip : -D FEATURE_ADC_VCC=true
|
||||
|
||||
[core_2_3_0]
|
||||
platform = espressif8266@1.5.0
|
||||
@@ -70,16 +70,16 @@ platform = espressif32@1.1.1
|
||||
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
|
||||
|
||||
[core_esp32]
|
||||
platform = ${core_esp32_1_1_1.platform}
|
||||
platform = ${core_esp32_0_12_0.platform}
|
||||
build_flags = -D BUILD_GIT='"${sysenv.TRAVIS_TAG}"'
|
||||
-lstdc++ -lsupc++
|
||||
lib_ignore = ESPeasySoftwareSerial, EspESPeasySoftwareSerial, AS_BH1750, ESP8266WiFi, ESP8266Ping, ESP8266WebServer, ESP8266HTTPUpdateServer, ESP8266mDNS, IRremoteESP8266, ESPEasy_ESP8266Ping, SerialSensors
|
||||
-lstdc++ -lsupc++
|
||||
lib_ignore = AS_BH1750, ESP8266WiFi, ESP8266Ping, ESP8266WebServer, ESP8266HTTPUpdateServer, ESP8266mDNS, IRremoteESP8266, ESPEasy_ESP8266Ping, SerialSensors
|
||||
lib_deps = ESP32WebServer
|
||||
monitor_speed = 115200
|
||||
|
||||
|
||||
[common]
|
||||
build_flags = -D BUILD_GIT='"${sysenv.TRAVIS_TAG}"' ; ${compiler_warnings.build_flags}
|
||||
build_flags = -D BUILD_GIT='"${sysenv.TRAVIS_TAG}"'
|
||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
-D NDEBUG
|
||||
-D VTABLES_IN_FLASH
|
||||
@@ -87,6 +87,7 @@ build_flags = -D BUILD_GIT='"${sysenv.TRAVIS_TAG}"' ; ${compiler_
|
||||
lib_deps = ""
|
||||
lib_ignore = ESP32_ping, ESP32WebServer
|
||||
lib_ldf_mode = chain
|
||||
lib_archive = false
|
||||
upload_speed = 460800
|
||||
framework = arduino
|
||||
board = esp12e
|
||||
@@ -138,11 +139,11 @@ build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.2m.ld
|
||||
board_build.flash_mode = dio
|
||||
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.4m1m.ld
|
||||
|
||||
### ESP32 pre-alpha test build ###########################################################
|
||||
# Very limited build for ESP32, to start testing regular building for ESP32. #
|
||||
# Will probably not work, not tested and guaranteed to take a few hours time of some #
|
||||
# still trying to build the version without reading this warning. #
|
||||
##########################################################################################
|
||||
;;; ESP32 pre-alpha test build ; ****; ****; ****; ****; ****; ****; ****; ****; ****;;;;;
|
||||
; Very limited build for ESP32, to start testing regular building for ESP32. ;
|
||||
; Will probably not work, not tested and guaranteed to take a few hours time of some ;
|
||||
; still trying to build the version without reading this warning. ;
|
||||
; *********************************************************************
|
||||
[env:esp32dev]
|
||||
platform = ${core_esp32.platform}
|
||||
board = esp32dev
|
||||
@@ -150,21 +151,23 @@ build_flags = ${core_esp32.build_flags} -DPLUGIN_SET_GENERIC_ESP3
|
||||
lib_deps = ${core_esp32.lib_deps}
|
||||
lib_ignore = ${core_esp32.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
|
||||
### NORMAL (STABLE) ######################################################################
|
||||
# normal version with stable plugins #
|
||||
##########################################################################################
|
||||
;;; NORMAL (STABLE) ; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****;;;;
|
||||
; normal version with stable plugins ;
|
||||
; *********************************************************************
|
||||
|
||||
# NORMAL: 1024k version --------------------------
|
||||
; NORMAL: 1024k version --------------------------
|
||||
[env:normal_ESP8266_1024]
|
||||
platform = ${common.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -173,12 +176,13 @@ board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
build_flags = ${esp8266_1M.build_flags}
|
||||
|
||||
# NORMAL: 1024k for esp8285 ----------------------
|
||||
; NORMAL: 1024k for esp8285 ----------------------
|
||||
[env:normal_ESP8285_1024]
|
||||
platform = ${common.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -187,25 +191,27 @@ board_upload.maximum_size = ${esp8285_1M.board_upload.maximum_size}
|
||||
board_build.flash_mode = ${esp8285_1M.board_build.flash_mode}
|
||||
build_flags = ${esp8285_1M.build_flags}
|
||||
|
||||
# NORMAL: 2048k version --------------------------
|
||||
; NORMAL: 2048k version --------------------------
|
||||
[env:normal_WROOM02_2048]
|
||||
platform = ${common.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
board = ${espWroom2M.board}
|
||||
board_build.flash_mode = ${espWroom2M.board_build.flash_mode}
|
||||
build_flags = ${espWroom2M.build_flags}
|
||||
|
||||
# NORMAL: 4096k version --------------------------
|
||||
; NORMAL: 4096k version --------------------------
|
||||
[env:normal_ESP8266_4096]
|
||||
platform = ${common.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -215,16 +221,17 @@ build_flags = ${esp8266_4M.build_flags}
|
||||
|
||||
|
||||
|
||||
### TESTING ##############################################################################
|
||||
# additional plugins (and dependend code) that are in test-stadium #
|
||||
##########################################################################################
|
||||
;;; TESTING ; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****
|
||||
; additional plugins (and dependend code) that are in test-stadium ;
|
||||
; *********************************************************************
|
||||
|
||||
# TEST: 1024k version ----------------------------
|
||||
; TEST: 1024k version ----------------------------
|
||||
[env:test_ESP8266_1024]
|
||||
platform = ${testing.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -233,12 +240,13 @@ board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
build_flags = ${esp8266_1M.build_flags} -D PLUGIN_BUILD_TESTING
|
||||
|
||||
# TEST: 1024k for esp8285 ------------------------
|
||||
; TEST: 1024k for esp8285 ------------------------
|
||||
[env:test_ESP8285_1024]
|
||||
platform = ${testing.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -247,12 +255,13 @@ board_build.flash_mode = ${esp8285_1M.board_build.flash_mode}
|
||||
board = ${esp8285_1M.board}
|
||||
build_flags = ${esp8285_1M.build_flags} -D PLUGIN_BUILD_TESTING
|
||||
|
||||
# TEST: 2048k version ----------------------------
|
||||
; TEST: 2048k version ----------------------------
|
||||
[env:test_WROOM02_2048]
|
||||
platform = ${testing.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -260,12 +269,13 @@ board_build.flash_mode = ${espWroom2M.board_build.flash_mode}
|
||||
board = ${espWroom2M.board}
|
||||
build_flags = ${espWroom2M.build_flags} -D PLUGIN_BUILD_TESTING
|
||||
|
||||
# TEST: 4096k version ----------------------------
|
||||
; TEST: 4096k version ----------------------------
|
||||
[env:test_ESP8266_4096]
|
||||
platform = ${testing.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
board = ${common.board}
|
||||
upload_speed = ${common.upload_speed}
|
||||
@@ -273,12 +283,13 @@ monitor_speed = ${common.monitor_speed}
|
||||
board_build.flash_mode = ${esp8266_4M.board_build.flash_mode}
|
||||
build_flags = ${esp8266_4M.build_flags} -D PLUGIN_BUILD_TESTING
|
||||
|
||||
# TEST: 4096k version + FEATURE_ADC_VCC ----------
|
||||
; TEST: 4096k version + FEATURE_ADC_VCC ----------
|
||||
[env:test_ESP8266_4096_VCC]
|
||||
platform = ${testing.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
board = ${common.board}
|
||||
upload_speed = ${common.upload_speed}
|
||||
@@ -288,16 +299,17 @@ build_flags = ${esp8266_4M.build_flags} -D PLUGIN_BUILD_TESTING -D
|
||||
|
||||
|
||||
|
||||
### DEV ##################################################################################
|
||||
# additional plugins (and dependend code) that is in development (probably broken or incomplete)
|
||||
##########################################################################################
|
||||
;;; DEV ; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****;;;;
|
||||
; additional plugins (and dependend code) that is in development (probably broken or incomplete)
|
||||
; *********************************************************************
|
||||
|
||||
# DEV : 1024k version ----------------------------
|
||||
; DEV : 1024k version ----------------------------
|
||||
[env:dev_ESP8266_1024]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -306,12 +318,13 @@ board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
board = ${common.board}
|
||||
build_flags = ${esp8266_1M.build_flags} -D PLUGIN_BUILD_DEV
|
||||
|
||||
# DEV: 1024k for esp8285 -------------------------
|
||||
; DEV: 1024k for esp8285 -------------------------
|
||||
[env:dev_ESP8285_1024]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -320,12 +333,13 @@ board_build.flash_mode = ${esp8285_1M.board_build.flash_mode}
|
||||
board = ${esp8285_1M.board}
|
||||
build_flags = ${esp8285_1M.build_flags} -D PLUGIN_BUILD_DEV
|
||||
|
||||
# DEV: 2048k version -----------------------------
|
||||
; DEV: 2048k version -----------------------------
|
||||
[env:dev_WROOM02_2048]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -333,12 +347,13 @@ board_build.flash_mode = ${espWroom2M.board_build.flash_mode}
|
||||
board = ${espWroom2M.board}
|
||||
build_flags = ${espWroom2M.build_flags} -D PLUGIN_BUILD_DEV
|
||||
|
||||
# DEV : 4096k version ----------------------------
|
||||
; DEV : 4096k version ----------------------------
|
||||
[env:dev_ESP8266_4096]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
board = ${common.board}
|
||||
upload_speed = ${common.upload_speed}
|
||||
@@ -348,16 +363,17 @@ build_flags = ${esp8266_4M.build_flags} -D PLUGIN_BUILD_DEV
|
||||
|
||||
|
||||
|
||||
### DEV + PUYA ###########################################################################
|
||||
# special patched version for PUYA flash chips, see issue #650 at Github #
|
||||
##########################################################################################
|
||||
;;; DEV + PUYA ; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****;;;
|
||||
; special patched version for PUYA flash chips, see issue ;650 at Github ;
|
||||
; *********************************************************************
|
||||
|
||||
# DEV+PUYA : 1024k version -----------------------
|
||||
; DEV+PUYA : 1024k version -----------------------
|
||||
[env:dev_ESP8266PUYA_1024]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
board = ${common.board}
|
||||
upload_speed = ${common.upload_speed}
|
||||
@@ -366,12 +382,13 @@ board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
build_flags = ${esp8266_1M.build_flags} -D PLUGIN_BUILD_DEV -D FLASH_QUIRK_WRITE_0_TO_1
|
||||
|
||||
# DEV+PUYA : 1024k version + FEATURE_ADC_VCC -----
|
||||
; DEV+PUYA : 1024k version + FEATURE_ADC_VCC -----
|
||||
[env:dev_ESP8266PUYA_1024_VCC]
|
||||
platform = ${dev.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
board = ${common.board}
|
||||
upload_speed = ${common.upload_speed}
|
||||
@@ -383,59 +400,62 @@ build_flags = ${esp8266_1M.build_flags} -D PLUGIN_BUILD_DEV -D FLA
|
||||
|
||||
|
||||
|
||||
### HARDWARE SPECIFIC VERSIONS ###########################################################
|
||||
# versions specially designed to fit, and contents only needed plugins for each hardware #
|
||||
##########################################################################################
|
||||
;;; HARDWARE SPECIFIC VERSIONS ; ****; ****; ****; ****; ****; ****; ****; ****; ****;;;;;
|
||||
; versions specially designed to fit, and contents only needed plugins for each hardware ;
|
||||
; *********************************************************************
|
||||
|
||||
# ITEAD Products ################################
|
||||
; ITEAD Products ; ****; ****; ****; ****; ****;;
|
||||
|
||||
# ITEAD / SONOFF BASIC version ------------------
|
||||
#[env:hard_SONOFF_BASIC]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_BASIC
|
||||
; ITEAD / SONOFF BASIC version ------------------
|
||||
;[env:hard_SONOFF_BASIC]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_BASIC
|
||||
|
||||
# ITEAD / SONOFF TH10 version -------------------
|
||||
#[env:hard_SONOFF_TH10]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TH10
|
||||
; ITEAD / SONOFF TH10 version -------------------
|
||||
;[env:hard_SONOFF_TH10]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TH10
|
||||
|
||||
# ITEAD / SONOFF TH16 version -------------------
|
||||
#[env:hard_SONOFF_TH16]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TH16
|
||||
; ITEAD / SONOFF TH16 version -------------------
|
||||
;[env:hard_SONOFF_TH16]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TH16
|
||||
|
||||
# ITEAD / SONOFF POW version --------------------
|
||||
# Sonoff Pow (ESP8266 - HLW8012)
|
||||
# GPIO00 Button
|
||||
# GPIO05 HLW8012 Sel output
|
||||
# GPIO12 Red Led and Relay (0 = Off, 1 = On)
|
||||
# GPIO13 HLW8012 CF1 voltage / current
|
||||
# GPIO14 HLW8012 CF power
|
||||
# GPIO15 Blue Led (0 = On, 1 = Off)
|
||||
; ITEAD / SONOFF POW version --------------------
|
||||
; Sonoff Pow (ESP8266 - HLW8012)
|
||||
; GPIO00 Button
|
||||
; GPIO05 HLW8012 Sel output
|
||||
; GPIO12 Red Led and Relay (0 = Off, 1 = On)
|
||||
; GPIO13 HLW8012 CF1 voltage / current
|
||||
; GPIO14 HLW8012 CF power
|
||||
; GPIO15 Blue Led (0 = On, 1 = Off)
|
||||
[env:hard_SONOFF_POW]
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -444,16 +464,17 @@ platform = ${Sonoff.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
board = ${Sonoff.board}
|
||||
build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_POW
|
||||
|
||||
# Sonoff Pow R2 (ESP8266 - CSE7766)
|
||||
# GPIO00 Button
|
||||
# GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
# GPIO03 Serial TXD
|
||||
# GPIO12 Red Led and Relay (0 = Off, 1 = On)
|
||||
# GPIO13 Blue Led (0 = On, 1 = Off)
|
||||
; Sonoff Pow R2 (ESP8266 - CSE7766)
|
||||
; GPIO00 Button
|
||||
; GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
; GPIO03 Serial TXD
|
||||
; GPIO12 Red Led and Relay (0 = Off, 1 = On)
|
||||
; GPIO13 Blue Led (0 = On, 1 = Off)
|
||||
[env:hard_SONOFF_POW_R2]
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
@@ -462,197 +483,211 @@ platform = ${Sonoff.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
board = ${Sonoff.board}
|
||||
build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_POW_R2
|
||||
|
||||
# ITEAD / SONOFF S20 version --------------------
|
||||
#[env:hard_SONOFF_S20]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_S20
|
||||
; ITEAD / SONOFF S20 version --------------------
|
||||
;[env:hard_SONOFF_S20]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_S20
|
||||
|
||||
# ITEAD / SONOFF 4CH version --------------------
|
||||
#[env:hard_SONOFF_4CH]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_4CH
|
||||
; ITEAD / SONOFF 4CH version --------------------
|
||||
;[env:hard_SONOFF_4CH]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_4CH
|
||||
|
||||
# ITEAD / SONOFF TOUCH version ------------------
|
||||
#[env:hard_SONOFF_TOUCH]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${Sonoff.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
#board = ${Sonoff.board}
|
||||
#build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TOUCH
|
||||
; ITEAD / SONOFF TOUCH version ------------------
|
||||
;[env:hard_SONOFF_TOUCH]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${Sonoff.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_build.flash_mode = ${Sonoff.board_build.flash_mode}
|
||||
;board = ${Sonoff.board}
|
||||
;build_flags = ${Sonoff.build_flags} -D PLUGIN_SET_SONOFF_TOUCH
|
||||
|
||||
|
||||
|
||||
# LED Strips #####################################
|
||||
; LED Strips ; ****; ****; ****; ****; ****; ****;
|
||||
|
||||
# Huacanxing / H801 ------------------------------
|
||||
#[env:hard_HUACANXING_H801]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_H801
|
||||
; Huacanxing / H801 ------------------------------
|
||||
;[env:hard_HUACANXING_H801]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_H801
|
||||
|
||||
# MagicHome / Led Controller ---------------------
|
||||
#[env:hard_MAGICHOME]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_MAGICHOME
|
||||
; MagicHome / Led Controller ---------------------
|
||||
;[env:hard_MAGICHOME]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_MAGICHOME
|
||||
|
||||
# MagicHome / Led Controller with IR -------------
|
||||
#[env:hard_MAGICHOME_IR]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_MAGICHOME_IR
|
||||
; MagicHome / Led Controller with IR -------------
|
||||
;[env:hard_MAGICHOME_IR]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_MAGICHOME_IR
|
||||
|
||||
|
||||
|
||||
|
||||
### EASY VERSIONS ########################################################################
|
||||
# versions specially designed to be small and cover a specific usage #
|
||||
##########################################################################################
|
||||
;;; EASY VERSIONS ; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****; ****
|
||||
; versions specially designed to be small and cover a specific usage ;
|
||||
; *********************************************************************
|
||||
|
||||
# Easy Temperature Sensor ------------------------
|
||||
#[env:easy_TEMP]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_TEMP
|
||||
; Easy Temperature Sensor ------------------------
|
||||
;[env:easy_TEMP]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_TEMP
|
||||
|
||||
|
||||
# Easy Carbon Sensor -----------------------------
|
||||
#[env:easy_CARBON]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_CARBON
|
||||
; Easy Carbon Sensor -----------------------------
|
||||
;[env:easy_CARBON]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_CARBON
|
||||
|
||||
## Easy Nextion ----------------------------------
|
||||
##PLUGIN_SET_EASY_NEXTION
|
||||
;; Easy Nextion ----------------------------------
|
||||
;;PLUGIN_SET_EASY_NEXTION
|
||||
|
||||
# Easy OLED Display v1 ---------------------------
|
||||
#[env:easy_OLED_V1]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_OLED1
|
||||
; Easy OLED Display v1 ---------------------------
|
||||
;[env:easy_OLED_V1]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_OLED1
|
||||
|
||||
# Easy OLED Display v2 ---------------------------
|
||||
#[env:easy_OLED_V2]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_OLED2
|
||||
; Easy OLED Display v2 ---------------------------
|
||||
;[env:easy_OLED_V2]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_OLED2
|
||||
|
||||
# Easy Relay Switch ------------------------------
|
||||
#[env:easy_OLED_V2]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_RELAY
|
||||
; Easy Relay Switch ------------------------------
|
||||
;[env:easy_OLED_V2]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_EASY_RELAY
|
||||
|
||||
# Easy Generic (1M) device ----------------------
|
||||
#[env:easy_GENERIC_1M]
|
||||
#upload_speed = ${common.upload_speed}
|
||||
#monitor_speed = ${common.monitor_speed}
|
||||
#framework = ${common.framework}
|
||||
#platform = ${common.platform}
|
||||
#lib_deps = ${common.lib_deps}
|
||||
#lib_ignore = ${common.lib_ignore}
|
||||
#lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
#board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
#board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
#board = esp01_1m
|
||||
#build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_GENERIC_1M
|
||||
; Easy Generic (1M) device ----------------------
|
||||
;[env:easy_GENERIC_1M]
|
||||
;upload_speed = ${common.upload_speed}
|
||||
;monitor_speed = ${common.monitor_speed}
|
||||
;framework = ${common.framework}
|
||||
;platform = ${common.platform}
|
||||
;lib_deps = ${common.lib_deps}
|
||||
;lib_ignore = ${common.lib_ignore}
|
||||
;lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
;lib_archive = ${common.lib_archive}
|
||||
;board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
|
||||
;board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
|
||||
;board = esp01_1m
|
||||
;build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_GENERIC_1M
|
||||
|
||||
# Ventus W266 weather station
|
||||
# https://www.letscontrolit.com/wiki/index.php/VentusW266
|
||||
; Ventus W266 weather station
|
||||
; https://www.letscontrolit.com/wiki/index.php/VentusW266
|
||||
[env:hard_Ventus_W266]
|
||||
platform = ${normal.platform}
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
lib_ldf_mode = ${common.lib_ldf_mode}
|
||||
lib_archive = ${common.lib_archive}
|
||||
framework = ${common.framework}
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
+7
-4
@@ -60,7 +60,8 @@ void sendData(struct EventStruct *event)
|
||||
}
|
||||
|
||||
boolean validUserVar(struct EventStruct *event) {
|
||||
for (int i = 0; i < VARS_PER_TASK; ++i) {
|
||||
byte valueCount = getValueCountFromSensorType(event->sensorType);
|
||||
for (int i = 0; i < valueCount; ++i) {
|
||||
const float f(UserVar[event->BaseVarIndex + i]);
|
||||
if (!isValidFloat(f)) return false;
|
||||
}
|
||||
@@ -141,8 +142,10 @@ bool MQTTConnect(int controller_idx)
|
||||
String clientid;
|
||||
if(Settings.MQTTUseUnitNameAsClientId){
|
||||
clientid = Settings.Name;
|
||||
clientid += F("_");
|
||||
clientid += Settings.Unit;
|
||||
if (Settings.Unit != 0) { // only append non-zero unit number
|
||||
clientid += F("_");
|
||||
clientid += Settings.Unit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
clientid = F("ESPClient_");
|
||||
@@ -259,7 +262,7 @@ void SendStatus(byte source, String status)
|
||||
boolean MQTTpublish(int controller_idx, const char* topic, const char* payload, boolean retained)
|
||||
{
|
||||
if (MQTTclient.publish(topic, payload, retained)) {
|
||||
timermqtt = millis() + 10; // Make sure the MQTT is being processed as soon as possible.
|
||||
setIntervalTimerOverride(TIMER_MQTT, 10); // Make sure the MQTT is being processed as soon as possible.
|
||||
return true;
|
||||
}
|
||||
addLog(LOG_LEVEL_DEBUG, F("MQTT : publish failed"));
|
||||
|
||||
+14
-9
@@ -188,7 +188,7 @@
|
||||
#endif
|
||||
|
||||
#define MAX_FLASHWRITES_PER_DAY 100 // per 24 hour window
|
||||
#define INPUT_COMMAND_SIZE 80
|
||||
#define INPUT_COMMAND_SIZE 80
|
||||
|
||||
#define NODE_TYPE_ID_ESP_EASY_STD 1
|
||||
#define NODE_TYPE_ID_ESP_EASYM_STD 17
|
||||
@@ -196,6 +196,13 @@
|
||||
#define NODE_TYPE_ID_ARDUINO_EASY_STD 65
|
||||
#define NODE_TYPE_ID_NANO_EASY_STD 81
|
||||
|
||||
#define TIMER_20MSEC 1
|
||||
#define TIMER_100MSEC 2
|
||||
#define TIMER_1SEC 3
|
||||
#define TIMER_30SEC 4
|
||||
#define TIMER_MQTT 5
|
||||
#define TIMER_STATISTICS 6
|
||||
|
||||
#define PLUGIN_INIT_ALL 1
|
||||
#define PLUGIN_INIT 2
|
||||
#define PLUGIN_READ 3
|
||||
@@ -392,7 +399,7 @@
|
||||
#include <lwip/tcp_impl.h>
|
||||
#endif
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266Ping.h>
|
||||
//#include <ESP8266Ping.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
ESP8266WebServer WebServer(80);
|
||||
#include <DNSServer.h>
|
||||
@@ -1157,19 +1164,16 @@ String printWebString = "";
|
||||
boolean printToWebJSON = false;
|
||||
|
||||
float UserVar[VARS_PER_TASK * TASKS_MAX];
|
||||
struct rulesTiemerStatus
|
||||
struct rulesTimerStatus
|
||||
{
|
||||
unsigned long timestamp;
|
||||
unsigned int interval; //interval in millisencond
|
||||
unsigned int interval; //interval in milliseconds
|
||||
boolean paused;
|
||||
} RulesTimer[RULES_TIMER_MAX];
|
||||
|
||||
msecTimerHandlerStruct msecTimerHandler;
|
||||
|
||||
unsigned long timerSensor[TASKS_MAX];
|
||||
unsigned long timer100ms;
|
||||
unsigned long timer20ms;
|
||||
unsigned long timer1s;
|
||||
unsigned long timerwd;
|
||||
unsigned long timermqtt;
|
||||
unsigned long timermqtt_interval;
|
||||
unsigned long lastSend;
|
||||
unsigned long lastWeb;
|
||||
@@ -1293,6 +1297,7 @@ bool processedScanDone = true;
|
||||
bool webserver_state = false;
|
||||
bool webserver_init = false;
|
||||
|
||||
unsigned long idle_msec_per_sec = 0;
|
||||
unsigned long elapsed10ps = 0;
|
||||
unsigned long elapsed10psU = 0;
|
||||
unsigned long elapsed50ps = 0;
|
||||
|
||||
+56
-59
@@ -5,6 +5,14 @@
|
||||
#pragma GCC diagnostic warning "-Wall"
|
||||
#endif
|
||||
|
||||
// Needed due to preprocessor issues.
|
||||
#ifdef PLUGIN_SET_GENERIC_ESP32
|
||||
#ifndef ESP32
|
||||
#define ESP32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************************************************\
|
||||
* Arduino project "ESP Easy" © Copyright www.letscontrolit.com
|
||||
*
|
||||
@@ -232,10 +240,6 @@ void setup()
|
||||
if (Settings.TaskDeviceTimer[x] !=0)
|
||||
timerSensor[x] = millis() + (x * Settings.MessageDelay);
|
||||
|
||||
timer100ms = 0; // timer for periodic actions 10 x per/sec
|
||||
timer1s = 0; // timer for periodic actions once per/sec
|
||||
timerwd = 0; // timer for watchdog once per 30 sec
|
||||
timermqtt = 10000; // Timer for the MQTT keep alive loop, initial value can be high, since it will be set as soon as IP is set.
|
||||
timermqtt_interval = 250; // Interval for checking MQTT
|
||||
timerAwakeFromDeepSleep = millis();
|
||||
|
||||
@@ -316,9 +320,12 @@ void setup()
|
||||
// #ifndef ESP32
|
||||
// connectionCheck.attach(30, connectionCheckHandler);
|
||||
// #endif
|
||||
timer20ms = millis();
|
||||
timer100ms = millis();
|
||||
timer1s = millis();
|
||||
setIntervalTimer(TIMER_20MSEC); // timer for periodic actions 50 x per/sec
|
||||
setIntervalTimer(TIMER_100MSEC); // timer for periodic actions 10 x per/sec
|
||||
setIntervalTimer(TIMER_1SEC); // timer for periodic actions once per/sec
|
||||
setIntervalTimer(TIMER_30SEC); // timer for watchdog once per 30 sec
|
||||
setIntervalTimer(TIMER_MQTT); // timer for interaction with MQTT
|
||||
setIntervalTimer(TIMER_STATISTICS);
|
||||
}
|
||||
|
||||
#ifdef USE_RTOS_MULTITASKING
|
||||
@@ -377,7 +384,7 @@ void updateLoopStats() {
|
||||
const long usecSince = usecPassedSince(lastLoopStart);
|
||||
loop_usec_duration_total += usecSince;
|
||||
lastLoopStart = micros();
|
||||
if (usecSince <= 0 || usecSince > 10000000)
|
||||
if (usecSince <= 0 || usecSince > 10000000)
|
||||
return; // No loop should take > 10 sec.
|
||||
if (shortestLoop > static_cast<unsigned long>(usecSince)) {
|
||||
shortestLoop = usecSince;
|
||||
@@ -387,29 +394,33 @@ void updateLoopStats() {
|
||||
longestLoop = usecSince;
|
||||
}
|
||||
|
||||
void updateLoopStats_30sec() {
|
||||
void updateLoopStats_30sec(byte loglevel) {
|
||||
loopCounterLast = loopCounter;
|
||||
loopCounter = 0;
|
||||
if (loopCounterLast > loopCounterMax)
|
||||
loopCounterMax = loopCounterLast;
|
||||
|
||||
String log = F("LoopStats: shortestLoop: ");
|
||||
log += shortestLoop;
|
||||
log += F(" longestLoop: ");
|
||||
log += longestLoop;
|
||||
log += F(" avgLoopDuration: ");
|
||||
log += loop_usec_duration_total / loopCounter_full;
|
||||
log += F(" systemTimerDuration: ");
|
||||
log += systemTimerDurationTotal / systemTimerCalls;
|
||||
log += F(" systemTimerCalls: ");
|
||||
log += systemTimerCalls;
|
||||
log += F(" loopCounterMax: ");
|
||||
log += loopCounterMax;
|
||||
log += F(" loopCounterLast: ");
|
||||
log += loopCounterLast;
|
||||
log += F(" countFindPluginId: ");
|
||||
log += countFindPluginId;
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
msecTimerHandler.updateIdleTimeStats();
|
||||
|
||||
{
|
||||
String log = F("LoopStats: shortestLoop: ");
|
||||
log += shortestLoop;
|
||||
log += F(" longestLoop: ");
|
||||
log += longestLoop;
|
||||
log += F(" avgLoopDuration: ");
|
||||
log += loop_usec_duration_total / loopCounter_full;
|
||||
log += F(" systemTimerDuration: ");
|
||||
log += systemTimerDurationTotal / systemTimerCalls;
|
||||
log += F(" systemTimerCalls: ");
|
||||
log += systemTimerCalls;
|
||||
log += F(" loopCounterMax: ");
|
||||
log += loopCounterMax;
|
||||
log += F(" loopCounterLast: ");
|
||||
log += loopCounterLast;
|
||||
log += F(" countFindPluginId: ");
|
||||
log += countFindPluginId;
|
||||
addLog(loglevel, log);
|
||||
}
|
||||
countFindPluginId = 0;
|
||||
loop_usec_duration_total = 0;
|
||||
loopCounter_full = 1;
|
||||
@@ -417,8 +428,8 @@ void updateLoopStats_30sec() {
|
||||
systemTimerCalls = 1;
|
||||
}
|
||||
|
||||
int getCPUload() {
|
||||
return 100 - (100 * loopCounterLast / loopCounterMax);
|
||||
float getCPUload() {
|
||||
return 100.0 - msecTimerHandler.getIdleTimePct();
|
||||
}
|
||||
|
||||
int getLoopCountPerSec() {
|
||||
@@ -427,6 +438,7 @@ int getLoopCountPerSec() {
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* MAIN LOOP
|
||||
\*********************************************************************************************/
|
||||
@@ -476,23 +488,7 @@ void loop()
|
||||
//normal mode, run each task when its time
|
||||
else
|
||||
{
|
||||
|
||||
if (timeOutReached(timer20ms))
|
||||
run50TimesPerSecond();
|
||||
|
||||
if (timeOutReached(timer100ms))
|
||||
if(!UseRTOSMultitasking)
|
||||
run10TimesPerSecond();
|
||||
|
||||
if (timeOutReached(timerwd))
|
||||
runEach30Seconds();
|
||||
|
||||
if (timeOutReached(timer1s))
|
||||
runOncePerSecond();
|
||||
|
||||
if (timeOutReached(timermqtt)) {
|
||||
runPeriodicalMQTT();
|
||||
}
|
||||
handle_schedule();
|
||||
}
|
||||
|
||||
backgroundtasks();
|
||||
@@ -553,16 +549,14 @@ void updateMQTTclient_connected() {
|
||||
} else {
|
||||
timermqtt_interval = 250;
|
||||
}
|
||||
timermqtt = millis() + timermqtt_interval;
|
||||
setIntervalTimer(TIMER_MQTT);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Tasks that run 50 times per second
|
||||
\*********************************************************************************************/
|
||||
|
||||
void run50TimesPerSecond()
|
||||
{
|
||||
setNextTimeInterval(timer20ms, 20);
|
||||
void run50TimesPerSecond() {
|
||||
START_TIMER;
|
||||
PluginCall(PLUGIN_FIFTY_PER_SECOND, 0, dummyString);
|
||||
STOP_TIMER(PLUGIN_CALL_50PS);
|
||||
@@ -571,9 +565,7 @@ void run50TimesPerSecond()
|
||||
/*********************************************************************************************\
|
||||
* Tasks that run 10 times per second
|
||||
\*********************************************************************************************/
|
||||
void run10TimesPerSecond()
|
||||
{
|
||||
setNextTimeInterval(timer100ms, 100);
|
||||
void run10TimesPerSecond() {
|
||||
{
|
||||
START_TIMER;
|
||||
PluginCall(PLUGIN_TEN_PER_SECOND, 0, dummyString);
|
||||
@@ -601,7 +593,6 @@ void run10TimesPerSecond()
|
||||
void runOncePerSecond()
|
||||
{
|
||||
START_TIMER;
|
||||
setNextTimeInterval(timer1s, 1000);
|
||||
dailyResetCounter++;
|
||||
if (dailyResetCounter > 86400) // 1 day elapsed... //86400
|
||||
{
|
||||
@@ -693,6 +684,15 @@ void runOncePerSecond()
|
||||
STOP_TIMER(PLUGIN_CALL_1PS);
|
||||
}
|
||||
|
||||
void logTimerStatistics() {
|
||||
byte loglevel = LOG_LEVEL_DEBUG;
|
||||
updateLoopStats_30sec(loglevel);
|
||||
logStatistics(loglevel, true);
|
||||
String queueLog = F("Scheduler stats: (called/tasks/max_length/idle_msec) ");
|
||||
queueLog += msecTimerHandler.getQueueStats();
|
||||
addLog(loglevel, queueLog);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Tasks each 30 seconds
|
||||
\*********************************************************************************************/
|
||||
@@ -700,10 +700,7 @@ void runEach30Seconds()
|
||||
{
|
||||
extern void checkRAMtoLog();
|
||||
checkRAMtoLog();
|
||||
updateLoopStats_30sec();
|
||||
logStatistics(true);
|
||||
wdcounter++;
|
||||
timerwd = millis() + 30000;
|
||||
String log;
|
||||
log.reserve(60);
|
||||
log = F("WD : Uptime ");
|
||||
@@ -918,8 +915,8 @@ void checkSystemTimers()
|
||||
TempEvent.Par4 = systemTimers[x].Par4;
|
||||
TempEvent.Par5 = systemTimers[x].Par5;
|
||||
systemTimers[x].timer = 0;
|
||||
const int y = getPluginId(systemTimers[x].TaskIndex);
|
||||
if (y >= 0) {
|
||||
const int y = getPluginId(systemTimers[x].TaskIndex);
|
||||
if (y >= 0) {
|
||||
Plugin_ptr[y](PLUGIN_TIMER_IN, &TempEvent, dummyString);
|
||||
}
|
||||
}
|
||||
@@ -995,4 +992,4 @@ void backgroundtasks()
|
||||
statusLED(false);
|
||||
|
||||
runningBackgroundTasks=false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
void logStatistics(bool clearLog) {
|
||||
void logStatistics(byte loglevel, bool clearLog) {
|
||||
String log;
|
||||
log.reserve(80);
|
||||
for (auto& x: pluginStats) {
|
||||
if (!x.second.isEmpty()) {
|
||||
const int pluginId = x.first/32;
|
||||
String P_name = "";
|
||||
String P_name = "";
|
||||
Plugin_ptr[pluginId](PLUGIN_GET_DEVICENAME, NULL, P_name);
|
||||
log = F("PluginStats P_");
|
||||
log += pluginId + 1;
|
||||
@@ -14,7 +14,7 @@ void logStatistics(bool clearLog) {
|
||||
log += getPluginFunctionName(x.first%32);
|
||||
log += ' ';
|
||||
log += getLogLine(x.second);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
addLog(loglevel, log);
|
||||
if (clearLog) x.second.reset();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ void logStatistics(bool clearLog) {
|
||||
log = getMiscStatsName(x.first);
|
||||
log += F(" stats: ");
|
||||
log += getLogLine(x.second);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
addLog(loglevel, log);
|
||||
if (clearLog) x.second.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define ESPEASY_TIMETYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <list>
|
||||
|
||||
struct timeStruct {
|
||||
timeStruct() : Second(0), Minute(0), Hour(0), Wday(0), Day(0), Month(0), Year(0) {}
|
||||
@@ -65,6 +66,144 @@ uint32_t calcTimeChangeForRule(const TimeChangeRule& r, int yr);
|
||||
String getTimeString(char delimiter, bool show_seconds=true);
|
||||
String getTimeString_ampm(char delimiter, bool show_seconds=true);
|
||||
long timeDiff(unsigned long prev, unsigned long next);
|
||||
long timePassedSince(unsigned long timestamp);
|
||||
boolean timeOutReached(unsigned long timer);
|
||||
long usecPassedSince(unsigned long timestamp);
|
||||
boolean usecTimeOutReached(unsigned long timer);
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* TimerHandler Used by the Scheduler
|
||||
\*********************************************************************************************/
|
||||
|
||||
struct timer_id_couple {
|
||||
timer_id_couple(unsigned long id, unsigned long newtimer) : _id(id), _timer(newtimer) {}
|
||||
|
||||
timer_id_couple(unsigned long id) : _id(id) {
|
||||
_timer = millis();
|
||||
}
|
||||
|
||||
bool operator<(const timer_id_couple& other) {
|
||||
const unsigned long now(millis());
|
||||
// timediff > 0, means timer has already passed
|
||||
return (timeDiff(_timer, now) > timeDiff(other._timer, now));
|
||||
}
|
||||
|
||||
unsigned long _id;
|
||||
unsigned long _timer;
|
||||
};
|
||||
|
||||
struct msecTimerHandlerStruct {
|
||||
|
||||
msecTimerHandlerStruct() : get_called(0), get_called_ret_id(0), max_queue_length(0),
|
||||
last_exec_time_usec(0), total_idle_time_usec(0), is_idle(false), idle_time_pct(0.0)
|
||||
{
|
||||
last_log_start_time = millis();
|
||||
}
|
||||
|
||||
void registerAt(unsigned long id, unsigned long timer) {
|
||||
timer_id_couple item(id, timer);
|
||||
insert(item);
|
||||
}
|
||||
|
||||
void registerFromNow(unsigned long id, unsigned long msecFromNow) {
|
||||
registerAt(id, millis() + msecFromNow);
|
||||
}
|
||||
|
||||
// Check if timeout has been reached and also return its set timer.
|
||||
// Return 0 if no item has reached timeout moment.
|
||||
unsigned long getNextId(unsigned long& timer) {
|
||||
++get_called;
|
||||
if (_timer_ids.empty()) {
|
||||
recordIdle();
|
||||
return 0;
|
||||
}
|
||||
timer_id_couple item = _timer_ids.front();
|
||||
if (!timeOutReached(item._timer)) {
|
||||
recordIdle();
|
||||
return 0;
|
||||
}
|
||||
recordRunning();
|
||||
unsigned long size = _timer_ids.size();
|
||||
if (size > max_queue_length) max_queue_length = size;
|
||||
_timer_ids.pop_front();
|
||||
timer = item._timer;
|
||||
++get_called_ret_id;
|
||||
return item._id;
|
||||
}
|
||||
|
||||
String getQueueStats() {
|
||||
|
||||
String result;
|
||||
result += get_called;
|
||||
result += '/';
|
||||
result += get_called_ret_id;
|
||||
result += '/';
|
||||
result += max_queue_length;
|
||||
result += '/';
|
||||
result += idle_time_pct;
|
||||
get_called = 0;
|
||||
get_called_ret_id = 0;
|
||||
//max_queue_length = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void updateIdleTimeStats() {
|
||||
const long duration = timePassedSince(last_log_start_time);
|
||||
last_log_start_time = millis();
|
||||
idle_time_pct = total_idle_time_usec / duration / 10.0;
|
||||
total_idle_time_usec = 0;
|
||||
}
|
||||
|
||||
float getIdleTimePct() {
|
||||
return idle_time_pct;
|
||||
}
|
||||
|
||||
private:
|
||||
struct match_id {
|
||||
match_id(unsigned long id) : _id(id) {}
|
||||
bool operator() (const timer_id_couple& item) { return _id == item._id; }
|
||||
unsigned long _id;
|
||||
};
|
||||
|
||||
void insert(const timer_id_couple& item) {
|
||||
if (item._id == 0) return;
|
||||
|
||||
// Make sure only one is present with the same id.
|
||||
_timer_ids.remove_if(match_id(item._id));
|
||||
_timer_ids.push_front(item);
|
||||
if (_timer_ids.empty()) {
|
||||
return;
|
||||
}
|
||||
_timer_ids.sort();
|
||||
}
|
||||
|
||||
void recordIdle() {
|
||||
if (is_idle) return;
|
||||
last_exec_time_usec = micros();
|
||||
is_idle = true;
|
||||
}
|
||||
|
||||
void recordRunning() {
|
||||
if (!is_idle) return;
|
||||
is_idle = false;
|
||||
total_idle_time_usec += usecPassedSince(last_exec_time_usec);
|
||||
}
|
||||
|
||||
|
||||
unsigned long get_called;
|
||||
unsigned long get_called_ret_id;
|
||||
unsigned long max_queue_length;
|
||||
unsigned long last_exec_time_usec;
|
||||
unsigned long total_idle_time_usec;
|
||||
unsigned long last_log_start_time;
|
||||
bool is_idle;
|
||||
float idle_time_pct;
|
||||
std::list<timer_id_couple> _timer_ids;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* ESPEASY_TIMETYPES_H_ */
|
||||
|
||||
+11
-1
@@ -118,7 +118,7 @@ void processGotIP() {
|
||||
}
|
||||
mqtt_reconnect_count = 0;
|
||||
timermqtt_interval = 100;
|
||||
timermqtt = millis() + timermqtt_interval;
|
||||
setIntervalTimer(TIMER_MQTT);
|
||||
if (Settings.UseRules)
|
||||
{
|
||||
String event = F("WiFi#Connected");
|
||||
@@ -752,6 +752,16 @@ void WifiCheck()
|
||||
return;
|
||||
|
||||
processDisableAPmode();
|
||||
IPAddress ip = WiFi.localIP();
|
||||
if (!useStaticIP()) {
|
||||
if (ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] == 0) {
|
||||
if (WiFiConnected()) {
|
||||
// Some strange situation where the DHCP renew probably has failed and erased the config.
|
||||
resetWiFi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wifiStatus != ESPEASY_WIFI_SERVICES_INITIALIZED) {
|
||||
if (timeOutReached(last_wifi_connect_attempt_moment + (1000 + wifi_connect_attempt * 200))) {
|
||||
WiFiConnectRelaxed();
|
||||
|
||||
+39
-11
@@ -1421,13 +1421,14 @@ String getLWIPversion() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
/********************************************************************************************\
|
||||
Get partition table information
|
||||
\*********************************************************************************************/
|
||||
|
||||
String getPartitionType(esp_partition_type_t partitionType, esp_partition_subtype_t partitionSubType) {
|
||||
#ifdef ESP32
|
||||
String getPartitionType(byte pType, byte pSubType) {
|
||||
esp_partition_type_t partitionType = static_cast<esp_partition_type_t>(pType);
|
||||
esp_partition_subtype_t partitionSubType = static_cast<esp_partition_subtype_t>(pSubType);
|
||||
if (partitionType == ESP_PARTITION_TYPE_APP) {
|
||||
if (partitionSubType >= ESP_PARTITION_SUBTYPE_APP_OTA_MIN &&
|
||||
partitionSubType < ESP_PARTITION_SUBTYPE_APP_OTA_MAX) {
|
||||
@@ -1437,8 +1438,8 @@ String getPartitionType(esp_partition_type_t partitionType, esp_partition_subtyp
|
||||
}
|
||||
|
||||
switch (partitionSubType) {
|
||||
case ESP_PARTITION_SUBTYPE_APP_FACTORY: return F("Factory application");
|
||||
case ESP_PARTITION_SUBTYPE_APP_TEST: return F("Test application");
|
||||
case ESP_PARTITION_SUBTYPE_APP_FACTORY: return F("Factory app");
|
||||
case ESP_PARTITION_SUBTYPE_APP_TEST: return F("Test app");
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -1475,7 +1476,8 @@ String getPartitionTableHeader(const String& itemSep, const String& lineEnd) {
|
||||
return result;
|
||||
}
|
||||
|
||||
String getPartitionTable(esp_partition_type_t partitionType, const String& itemSep, const String& lineEnd) {
|
||||
String getPartitionTable(byte pType, const String& itemSep, const String& lineEnd) {
|
||||
esp_partition_type_t partitionType = static_cast<esp_partition_type_t>(pType);
|
||||
String result;
|
||||
const esp_partition_t * _mypart;
|
||||
esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||
@@ -1492,12 +1494,11 @@ String getPartitionTable(esp_partition_type_t partitionType, const String& itemS
|
||||
result += itemSep;
|
||||
result += (_mypart->encrypted ? F("Yes") : F("-"));
|
||||
result += lineEnd;
|
||||
} while (_mypartiterator = esp_partition_next(_mypartiterator));
|
||||
} while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
|
||||
}
|
||||
esp_partition_iterator_release(_mypartiterator);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1521,21 +1522,48 @@ boolean isInt(const String& tBuf) {
|
||||
return isNumerical(tBuf, true);
|
||||
}
|
||||
|
||||
String getNumerical(const String& tBuf, bool mustBeInteger) {
|
||||
String result = "";
|
||||
const unsigned int bufLength = tBuf.length();
|
||||
if (bufLength == 0) return result;
|
||||
boolean decPt = false;
|
||||
int firstDec = 0;
|
||||
char c = tBuf.charAt(0);
|
||||
if(c == '+' || c == '-') {
|
||||
result += c;
|
||||
firstDec = 1;
|
||||
}
|
||||
for(unsigned int x=firstDec; x < bufLength; ++x) {
|
||||
c = tBuf.charAt(x);
|
||||
if(c == '.') {
|
||||
if (mustBeInteger) return result;
|
||||
// Only one decimal point allowed
|
||||
if(decPt) return result;
|
||||
else decPt = true;
|
||||
}
|
||||
else if(c < '0' || c > '9') return result;
|
||||
result += c;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean isNumerical(const String& tBuf, bool mustBeInteger) {
|
||||
const unsigned int bufLength = tBuf.length();
|
||||
if (bufLength == 0) return false;
|
||||
boolean decPt = false;
|
||||
int firstDec = 0;
|
||||
if(tBuf.charAt(0) == '+' || tBuf.charAt(0) == '-')
|
||||
char c = tBuf.charAt(0);
|
||||
if(c == '+' || c == '-')
|
||||
firstDec = 1;
|
||||
for(unsigned int x=firstDec; x < bufLength; ++x) {
|
||||
if(tBuf.charAt(x) == '.') {
|
||||
c = tBuf.charAt(x);
|
||||
if(c == '.') {
|
||||
if (mustBeInteger) return false;
|
||||
// Only one decimal point allowed
|
||||
if(decPt) return false;
|
||||
else decPt = true;
|
||||
}
|
||||
else if(tBuf.charAt(x) < '0' || tBuf.charAt(x) > '9') return false;
|
||||
else if(c < '0' || c > '9') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#define TIMER_ID_SHIFT 16
|
||||
|
||||
#define CONST_INTERVAL_TIMER 1
|
||||
#define GENERIC_TIMER 2
|
||||
|
||||
void setTimer(unsigned long id) {
|
||||
setTimer(GENERIC_TIMER, id, 0);
|
||||
}
|
||||
|
||||
void setIntervalTimer(unsigned long id) {
|
||||
setIntervalTimer(id, millis());
|
||||
}
|
||||
|
||||
void setIntervalTimerOverride(unsigned long id, unsigned long msecFromNow) {
|
||||
unsigned long timer = millis();
|
||||
setNextTimeInterval(timer, msecFromNow);
|
||||
msecTimerHandler.registerAt(getMixedId(CONST_INTERVAL_TIMER, id), timer);
|
||||
}
|
||||
|
||||
void setIntervalTimer(unsigned long id, unsigned long lasttimer) {
|
||||
// Set the initial timers for the regular runs
|
||||
unsigned long interval = 0;
|
||||
switch (id) {
|
||||
case TIMER_20MSEC: interval = 20; break;
|
||||
case TIMER_100MSEC: interval = 100; break;
|
||||
case TIMER_1SEC: interval = 1000; break;
|
||||
case TIMER_30SEC: interval = 30000; break;
|
||||
case TIMER_MQTT: interval = timermqtt_interval; break;
|
||||
case TIMER_STATISTICS: interval = 30000; break;
|
||||
}
|
||||
unsigned long timer = lasttimer;
|
||||
setNextTimeInterval(timer, interval);
|
||||
msecTimerHandler.registerAt(getMixedId(CONST_INTERVAL_TIMER, id), timer);
|
||||
}
|
||||
|
||||
void setTimer(unsigned long timerType, unsigned long id, unsigned long msecFromNow) {
|
||||
msecTimerHandler.registerFromNow(getMixedId(timerType, id), msecFromNow);
|
||||
}
|
||||
|
||||
unsigned long getMixedId(unsigned long timerType, unsigned long id) {
|
||||
return (timerType << TIMER_ID_SHIFT) + id;
|
||||
}
|
||||
|
||||
void handle_schedule() {
|
||||
unsigned long timer;
|
||||
const unsigned long mixed_id = msecTimerHandler.getNextId(timer);
|
||||
if (mixed_id == 0) return;
|
||||
const unsigned long timerType = (mixed_id >> TIMER_ID_SHIFT);
|
||||
const unsigned long mask = (1 << TIMER_ID_SHIFT) -1;
|
||||
const unsigned long id = mixed_id & mask;
|
||||
|
||||
switch (timerType) {
|
||||
case CONST_INTERVAL_TIMER:
|
||||
setIntervalTimer(id, timer);
|
||||
process_interval_timer(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void process_interval_timer(unsigned long id) {
|
||||
switch (id) {
|
||||
case TIMER_20MSEC:
|
||||
run50TimesPerSecond();
|
||||
break;
|
||||
case TIMER_100MSEC:
|
||||
if(!UseRTOSMultitasking)
|
||||
run10TimesPerSecond();
|
||||
break;
|
||||
case TIMER_1SEC:
|
||||
runOncePerSecond();
|
||||
break;
|
||||
case TIMER_30SEC:
|
||||
runEach30Seconds();
|
||||
break;
|
||||
case TIMER_MQTT:
|
||||
runPeriodicalMQTT();
|
||||
break;
|
||||
case TIMER_STATISTICS:
|
||||
logTimerStatistics();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
+35
-7
@@ -60,14 +60,18 @@ String formatMAC(const uint8_t* mac) {
|
||||
return String(str);
|
||||
}
|
||||
|
||||
String formatToHex(unsigned long value) {
|
||||
String result = F("0x");
|
||||
String formatToHex(unsigned long value, const String& prefix) {
|
||||
String result = prefix;
|
||||
String hex(value, HEX);
|
||||
hex.toUpperCase();
|
||||
result += hex;
|
||||
return result;
|
||||
}
|
||||
|
||||
String formatToHex(unsigned long value) {
|
||||
return formatToHex(value, F("0x"));
|
||||
}
|
||||
|
||||
String formatHumanReadable(unsigned long value, unsigned long factor) {
|
||||
float floatValue(value);
|
||||
byte steps = 0;
|
||||
@@ -83,7 +87,7 @@ String formatHumanReadable(unsigned long value, unsigned long factor) {
|
||||
case 2: result += 'M'; break;
|
||||
case 3: result += 'G'; break;
|
||||
case 4: result += 'T'; break;
|
||||
default:
|
||||
default:
|
||||
result += '*';
|
||||
result += factor;
|
||||
result += '^';
|
||||
@@ -135,10 +139,10 @@ String toString(WiFiMode_t mode)
|
||||
break;
|
||||
case WIFI_AP_STA:
|
||||
result = F("AP+STA");
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -386,6 +390,7 @@ void parseSpecialCharacters(String& s, boolean useURLencode)
|
||||
|
||||
// Simple macro to create the replacement string only when needed.
|
||||
#define SMART_REPL(T,S) if (s.indexOf(T) != -1) { repl((T), (S), s, useURLencode);}
|
||||
#define SMART_REPL_T(T,S) if (s.indexOf(T) != -1) { (S((T), s, useURLencode));}
|
||||
void parseSystemVariables(String& s, boolean useURLencode)
|
||||
{
|
||||
parseSpecialCharacters(s, useURLencode);
|
||||
@@ -438,8 +443,8 @@ void parseSystemVariables(String& s, boolean useURLencode)
|
||||
SMART_REPL(F("%lcltime_am%"), getDateTimeString_ampm('-',':',' '))
|
||||
SMART_REPL(F("%uptime%"), String(wdcounter / 2))
|
||||
SMART_REPL(F("%unixtime%"), String(getUnixTime()))
|
||||
SMART_REPL(F("%sunrise%"), getSunriseTimeString(':'))
|
||||
SMART_REPL(F("%sunset%"), getSunsetTimeString(':'))
|
||||
SMART_REPL_T(F("%sunset"), replSunSetTimeString)
|
||||
SMART_REPL_T(F("%sunrise"), replSunRiseTimeString)
|
||||
|
||||
repl(F("%tskname%"), ExtraTaskSettings.TaskDeviceName, s, useURLencode);
|
||||
if (s.indexOf(F("%vname")) != -1) {
|
||||
@@ -450,6 +455,28 @@ void parseSystemVariables(String& s, boolean useURLencode)
|
||||
}
|
||||
}
|
||||
|
||||
String getReplacementString(const String& format, String& s) {
|
||||
int startpos = s.indexOf(format);
|
||||
int endpos = s.indexOf('%', startpos + 1);
|
||||
String R = s.substring(startpos, endpos + 1);
|
||||
String log = F("ReplacementString SunTime: ");
|
||||
log += R;
|
||||
log += F(" offset: ");
|
||||
log += getSecOffset(R);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
return R;
|
||||
}
|
||||
|
||||
void replSunRiseTimeString(const String& format, String& s, boolean useURLencode) {
|
||||
String R = getReplacementString(format, s);
|
||||
repl(R, getSunriseTimeString(':', getSecOffset(R)), s, useURLencode);
|
||||
}
|
||||
|
||||
void replSunSetTimeString(const String& format, String& s, boolean useURLencode) {
|
||||
String R = getReplacementString(format, s);
|
||||
repl(R, getSunsetTimeString(':', getSecOffset(R)), s, useURLencode);
|
||||
}
|
||||
|
||||
void parseEventVariables(String& s, struct EventStruct *event, boolean useURLencode)
|
||||
{
|
||||
SMART_REPL(F("%id%"), String(event->idx))
|
||||
@@ -464,6 +491,7 @@ void parseEventVariables(String& s, struct EventStruct *event, boolean useURLenc
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef SMART_REPL_T
|
||||
#undef SMART_REPL
|
||||
|
||||
bool getConvertArgument(const String& marker, const String& s, float& argument, int& startIndex, int& endIndex) {
|
||||
|
||||
+57
-1
@@ -17,6 +17,7 @@ uint32_t syncInterval = 3600; // time sync will be attempted after this many se
|
||||
uint32_t sysTime = 0;
|
||||
uint32_t prevMillis = 0;
|
||||
uint32_t nextSyncTime = 0;
|
||||
timeStruct tsRise, tsSet;
|
||||
timeStruct sunRise;
|
||||
timeStruct sunSet;
|
||||
|
||||
@@ -62,7 +63,6 @@ void calcSunRiseAndSet() {
|
||||
float da = diurnalArc(dec, Settings.Latitude);
|
||||
float rise = 12 - da - eqt - Settings.Longitude / 15.0;
|
||||
float set = 12 + da - eqt - Settings.Longitude / 15.0;
|
||||
timeStruct tsRise, tsSet;
|
||||
tsRise.Hour = (int)rise;
|
||||
tsRise.Minute = (rise - (int)rise) * 60.0;
|
||||
tsSet.Hour = (int)set;
|
||||
@@ -74,6 +74,25 @@ void calcSunRiseAndSet() {
|
||||
breakTime(toLocal(makeTime(tsSet)), sunSet);
|
||||
}
|
||||
|
||||
timeStruct getSunRise(int secOffset) {
|
||||
return addSeconds(tsRise, secOffset, true);
|
||||
}
|
||||
|
||||
timeStruct getSunSet(int secOffset) {
|
||||
return addSeconds(tsSet, secOffset, true);
|
||||
}
|
||||
|
||||
timeStruct addSeconds(const timeStruct& ts, int seconds, bool toLocalTime) {
|
||||
unsigned long time = makeTime(ts);
|
||||
time += seconds;
|
||||
if (toLocalTime) {
|
||||
time = toLocal(time);
|
||||
}
|
||||
timeStruct result;
|
||||
breakTime(time, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void breakTime(unsigned long timeInput, struct timeStruct &tm) {
|
||||
uint8_t year;
|
||||
uint8_t month, monthLength;
|
||||
@@ -142,6 +161,30 @@ uint32_t getUnixTime() {
|
||||
return sysTime;
|
||||
}
|
||||
|
||||
int getSecOffset(const String& format) {
|
||||
int position_minus = format.indexOf('-');
|
||||
int position_plus = format.indexOf('+');
|
||||
if (position_minus == -1 && position_plus == -1)
|
||||
return 0;
|
||||
int sign_position = _max(position_minus, position_plus);
|
||||
int position_percent = format.indexOf('%', sign_position);
|
||||
if (position_percent == -1) {
|
||||
return 0;
|
||||
}
|
||||
String valueStr = getNumerical(format.substring(sign_position, position_percent), true);
|
||||
if (!isInt(valueStr)) return 0;
|
||||
int value = valueStr.toInt();
|
||||
switch (format.charAt(position_percent - 1)) {
|
||||
case 'm':
|
||||
case 'M':
|
||||
return value * 60;
|
||||
case 'h':
|
||||
case 'H':
|
||||
return value * 3600;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
String getSunriseTimeString(char delimiter) {
|
||||
return getTimeString(sunRise, delimiter, false, false);
|
||||
}
|
||||
@@ -150,6 +193,19 @@ String getSunsetTimeString(char delimiter) {
|
||||
return getTimeString(sunSet, delimiter, false, false);
|
||||
}
|
||||
|
||||
String getSunriseTimeString(char delimiter, int secOffset) {
|
||||
if (secOffset == 0)
|
||||
return getSunriseTimeString(delimiter);
|
||||
return getTimeString(getSunRise(secOffset), delimiter, false, false);
|
||||
}
|
||||
|
||||
String getSunsetTimeString(char delimiter, int secOffset) {
|
||||
if (secOffset == 0)
|
||||
return getSunsetTimeString(delimiter);
|
||||
return getTimeString(getSunSet(secOffset), delimiter, false, false);
|
||||
}
|
||||
|
||||
|
||||
unsigned long now() {
|
||||
// calculate number of seconds passed since last call to now()
|
||||
bool timeSynced = false;
|
||||
|
||||
+100
-14
@@ -2193,7 +2193,7 @@ void handle_devices() {
|
||||
TXBuffer += F("<TR><TD>IDX:<TD>");
|
||||
id = F("TDID"); //="taskdeviceid"
|
||||
id += controllerNr + 1;
|
||||
addNumericBox(id, Settings.TaskDeviceID[controllerNr][taskIndex], 0, 9999);
|
||||
addNumericBox(id, Settings.TaskDeviceID[controllerNr][taskIndex], 0, 999999999); // Looks like it is an unsigned int, so could be up to 4 bln.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3607,6 +3607,7 @@ void stream_last_json_object_value(const String& object, const String& value) {
|
||||
void handle_json()
|
||||
{
|
||||
const int taskNr = getFormItemInt(F("tasknr"), -1);
|
||||
const bool showSpecificTask = taskNr > 0;
|
||||
bool showSystem = true;
|
||||
bool showWifi = true;
|
||||
bool showDataAcquisition = true;
|
||||
@@ -3623,7 +3624,7 @@ void handle_json()
|
||||
}
|
||||
}
|
||||
TXBuffer.startJsonStream();
|
||||
if (taskNr == -1)
|
||||
if (!showSpecificTask)
|
||||
{
|
||||
TXBuffer += '{';
|
||||
if (showSystem) {
|
||||
@@ -3675,7 +3676,7 @@ void handle_json()
|
||||
|
||||
byte firstTaskIndex = 0;
|
||||
byte lastTaskIndex = TASKS_MAX - 1;
|
||||
if (taskNr > 0 )
|
||||
if (showSpecificTask)
|
||||
{
|
||||
firstTaskIndex = taskNr - 1;
|
||||
lastTaskIndex = taskNr - 1;
|
||||
@@ -3686,7 +3687,7 @@ void handle_json()
|
||||
lastActiveTaskIndex = TaskIndex;
|
||||
}
|
||||
|
||||
if (taskNr == 0 ) TXBuffer += F("\"Sensors\":[\n");
|
||||
if (!showSpecificTask) TXBuffer += F("\"Sensors\":[\n");
|
||||
unsigned long ttl_json = 60; // The shortest interval per enabled task (with output values) in seconds
|
||||
for (byte TaskIndex = firstTaskIndex; TaskIndex <= lastActiveTaskIndex; TaskIndex++)
|
||||
{
|
||||
@@ -3714,7 +3715,7 @@ void handle_json()
|
||||
}
|
||||
TXBuffer += F("],\n");
|
||||
}
|
||||
if (taskNr != 0) {
|
||||
if (showSpecificTask) {
|
||||
stream_next_json_object_value(F("TTL"), String(ttl_json * 1000));
|
||||
}
|
||||
if (showDataAcquisition) {
|
||||
@@ -3742,7 +3743,7 @@ void handle_json()
|
||||
TXBuffer += F("\n");
|
||||
}
|
||||
}
|
||||
if (taskNr == 0) {
|
||||
if (!showSpecificTask) {
|
||||
TXBuffer += F("],\n");
|
||||
stream_last_json_object_value(F("TTL"), String(ttl_json * 1000));
|
||||
}
|
||||
@@ -5222,15 +5223,15 @@ void handle_sysinfo() {
|
||||
addHelpButton(F("https://dl.espressif.com/doc/esp-idf/latest/api-guides/partition-tables.html"));
|
||||
TXBuffer += F("</H3></TD></TR>");
|
||||
|
||||
TXBuffer += F("<TR><TD>Data Partition Table<TD><tt>");
|
||||
TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
|
||||
TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_DATA, F(" - "), F("<BR>"));
|
||||
TXBuffer += F("</tt>");
|
||||
TXBuffer += F("<TR><TD>Data Partition Table<TD>");
|
||||
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
|
||||
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_DATA, F(" - "), F("<BR>"));
|
||||
getPartitionTableSVG(ESP_PARTITION_TYPE_DATA, 0x5856e6);
|
||||
|
||||
TXBuffer += F("<TR><TD>App Partition Table<TD><tt>");
|
||||
TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
|
||||
TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_APP , F(" - "), F("<BR>"));
|
||||
TXBuffer += F("</tt>");
|
||||
TXBuffer += F("<TR><TD>App Partition Table<TD>");
|
||||
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
|
||||
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_APP , F(" - "), F("<BR>"));
|
||||
getPartitionTableSVG(ESP_PARTITION_TYPE_APP, 0xab56e6);
|
||||
#endif
|
||||
|
||||
TXBuffer += F("</table></form>");
|
||||
@@ -5286,3 +5287,88 @@ void handle_favicon() {
|
||||
checkRAM(F("handle_favicon"));
|
||||
WebServer.send_P(200, PSTR("image/x-icon"), favicon_8b_ico, favicon_8b_ico_len);
|
||||
}
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
void createSvgRectPath(unsigned int color, int xoffset, int yoffset, int size, int height, int range, float svgBarWidth) {
|
||||
float width = svgBarWidth * size / range;
|
||||
if (width < 2) width = 2;
|
||||
TXBuffer += formatToHex(color, F("<path fill=\"#"));
|
||||
TXBuffer += F("\" d=\"M");
|
||||
TXBuffer += toString(svgBarWidth * xoffset / range, 2);
|
||||
TXBuffer += ' ';
|
||||
TXBuffer += yoffset;
|
||||
TXBuffer += 'h';
|
||||
TXBuffer += toString(width, 2);
|
||||
TXBuffer += 'v';
|
||||
TXBuffer += height;
|
||||
TXBuffer += 'H';
|
||||
TXBuffer += toString(svgBarWidth * xoffset / range, 2);
|
||||
TXBuffer += F("z\"/>\n");
|
||||
}
|
||||
|
||||
int getPartionCount(byte pType) {
|
||||
esp_partition_type_t partitionType = static_cast<esp_partition_type_t>(pType);
|
||||
esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||
int nrPartitions = 0;
|
||||
if (_mypartiterator) {
|
||||
do {
|
||||
++nrPartitions;
|
||||
} while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
|
||||
}
|
||||
esp_partition_iterator_release(_mypartiterator);
|
||||
return nrPartitions;
|
||||
}
|
||||
|
||||
void createSvgTextElement(const String& text, float textXoffset, float textYoffset) {
|
||||
TXBuffer += F("<text style=\"line-height:1.25\" x=\"");
|
||||
TXBuffer += toString(textXoffset, 2);
|
||||
TXBuffer += F("\" y=\"");
|
||||
TXBuffer += toString(textYoffset, 2);
|
||||
TXBuffer += F("\" stroke-width=\".3\" font-family=\"sans-serif\" font-size=\"8\" letter-spacing=\"0\" word-spacing=\"0\">\n");
|
||||
TXBuffer += F("<tspan x=\"");
|
||||
TXBuffer += toString(textXoffset, 2);
|
||||
TXBuffer += F("\" y=\"");
|
||||
TXBuffer += toString(textYoffset, 2);
|
||||
TXBuffer += F("\">");
|
||||
TXBuffer += text;
|
||||
TXBuffer += F("</tspan>\n</text>");
|
||||
}
|
||||
|
||||
void getPartitionTableSVG(byte pType, unsigned int partitionColor) {
|
||||
int nrPartitions = getPartionCount(pType);
|
||||
if (nrPartitions == 0) return;
|
||||
|
||||
const int barHeight = 16;
|
||||
const int svgBarWidth = 200;
|
||||
const int shiftY = 2;
|
||||
|
||||
uint32_t realSize = getFlashRealSizeInBytes();
|
||||
esp_partition_type_t partitionType = static_cast<esp_partition_type_t>(pType);
|
||||
const esp_partition_t * _mypart;
|
||||
esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||
TXBuffer += F("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"500\" height=\"");
|
||||
TXBuffer += nrPartitions * barHeight + shiftY;
|
||||
TXBuffer += F("\">");
|
||||
int partNr = 0;
|
||||
if (_mypartiterator) {
|
||||
do {
|
||||
_mypart = esp_partition_get(_mypartiterator);
|
||||
float yOffset = partNr * barHeight + shiftY;
|
||||
createSvgRectPath(0xcdcdcd, 0, yOffset, realSize, barHeight - 2, realSize, svgBarWidth);
|
||||
createSvgRectPath(partitionColor, _mypart->address, yOffset, _mypart->size, barHeight - 2, realSize, svgBarWidth);
|
||||
float textXoffset = svgBarWidth + 2;
|
||||
float textYoffset = yOffset + 0.9 * barHeight;
|
||||
createSvgTextElement(formatHumanReadable(_mypart->size, 1024), textXoffset, textYoffset);
|
||||
textXoffset = svgBarWidth + 60;
|
||||
createSvgTextElement(_mypart->label, textXoffset, textYoffset);
|
||||
textXoffset = svgBarWidth + 130;
|
||||
createSvgTextElement(getPartitionType(_mypart->type, _mypart->subtype), textXoffset, textYoffset);
|
||||
++partNr;
|
||||
} while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
|
||||
}
|
||||
TXBuffer += F("</svg>\n");
|
||||
esp_partition_iterator_release(_mypartiterator);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
//#######################################################################################################
|
||||
//#################################### Plugin-010: LuxRead ############################################
|
||||
//#######################################################################################################
|
||||
|
||||
#include <AS_BH1750.h>
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#include "AS_BH1750.h"
|
||||
#endif
|
||||
|
||||
#define PLUGIN_010
|
||||
#define PLUGIN_ID_010 10
|
||||
|
||||
+3
-1
@@ -4,8 +4,10 @@
|
||||
//#######################################################################################################
|
||||
|
||||
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#include <IRremoteESP8266.h>
|
||||
#endif
|
||||
|
||||
IRrecv *irReceiver;
|
||||
decode_results results;
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
//#################################### Plugin 035: Output IR ############################################
|
||||
//#######################################################################################################
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
#include <IRremoteESP8266.h>
|
||||
#endif
|
||||
IRsend *Plugin_035_irSender;
|
||||
|
||||
#define PLUGIN_035
|
||||
|
||||
@@ -359,6 +359,7 @@ boolean Plugin_042(byte function, struct EventStruct *event, String& string)
|
||||
UserVar[event->BaseVarIndex + 2] = Candle_type;
|
||||
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_WRITE:
|
||||
|
||||
+31
-31
@@ -14,14 +14,14 @@
|
||||
#define PLUGIN_NAME_044 "Communication - P1 Wifi Gateway"
|
||||
#define PLUGIN_VALUENAME1_044 "P1WifiGateway"
|
||||
|
||||
#define STATUS_LED 12
|
||||
#define P044_STATUS_LED 12
|
||||
#define P044_BUFFER_SIZE 1024
|
||||
#define NETBUF_SIZE 600
|
||||
#define DISABLED 0
|
||||
#define WAITING 1
|
||||
#define READING 2
|
||||
#define CHECKSUM 3
|
||||
#define DONE 4
|
||||
#define P044_NETBUF_SIZE 600
|
||||
#define P044_DISABLED 0
|
||||
#define P044_WAITING 1
|
||||
#define P044_READING 2
|
||||
#define P044_CHECKSUM 3
|
||||
#define P044_DONE 4
|
||||
|
||||
boolean Plugin_044_init = false;
|
||||
boolean serialdebug = false;
|
||||
@@ -38,7 +38,7 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
{
|
||||
boolean success = false;
|
||||
static byte connectionState = 0;
|
||||
static int state = DISABLED;
|
||||
static int state = P044_DISABLED;
|
||||
|
||||
switch (function)
|
||||
{
|
||||
@@ -103,8 +103,8 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
|
||||
case PLUGIN_INIT:
|
||||
{
|
||||
pinMode(STATUS_LED, OUTPUT);
|
||||
digitalWrite(STATUS_LED, 0);
|
||||
pinMode(P044_STATUS_LED, OUTPUT);
|
||||
digitalWrite(P044_STATUS_LED, 0);
|
||||
|
||||
LoadTaskSettings(event->TaskIndex);
|
||||
if ((ExtraTaskSettings.TaskDevicePluginConfigLong[0] != 0) && (ExtraTaskSettings.TaskDevicePluginConfigLong[1] != 0))
|
||||
@@ -155,7 +155,7 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
}
|
||||
|
||||
|
||||
state = WAITING;
|
||||
state = P044_WAITING;
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
@@ -237,26 +237,26 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
int timeOut = RXWait;
|
||||
while (timeOut > 0)
|
||||
{
|
||||
while (Serial.available() && state != DONE) {
|
||||
while (Serial.available() && state != P044_DONE) {
|
||||
if (bytes_read < P044_BUFFER_SIZE - 5) {
|
||||
char ch = Serial.read();
|
||||
digitalWrite(STATUS_LED, 1);
|
||||
digitalWrite(P044_STATUS_LED, 1);
|
||||
switch (state) {
|
||||
case DISABLED: //ignore incoming data
|
||||
case P044_DISABLED: //ignore incoming data
|
||||
break;
|
||||
case WAITING:
|
||||
case P044_WAITING:
|
||||
if (ch == '/') {
|
||||
Plugin_044_serial_buf[0] = ch;
|
||||
bytes_read=1;
|
||||
state = READING;
|
||||
state = P044_READING;
|
||||
} // else ignore data
|
||||
break;
|
||||
case READING:
|
||||
case P044_READING:
|
||||
if (ch == '!') {
|
||||
if (CRCcheck) {
|
||||
state = CHECKSUM;
|
||||
state = P044_CHECKSUM;
|
||||
} else {
|
||||
state = DONE;
|
||||
state = P044_DONE;
|
||||
}
|
||||
}
|
||||
if (validP1char(ch)) {
|
||||
@@ -270,19 +270,19 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
addLog(LOG_LEVEL_DEBUG, F("P1 : Error: DATA corrupt, discarded input."));
|
||||
Serial.flush();
|
||||
bytes_read = 0;
|
||||
state = WAITING;
|
||||
state = P044_WAITING;
|
||||
}
|
||||
break;
|
||||
case CHECKSUM:
|
||||
case P044_CHECKSUM:
|
||||
checkI ++;
|
||||
if (checkI == 4) {
|
||||
checkI = 0;
|
||||
state = DONE;
|
||||
state = P044_DONE;
|
||||
}
|
||||
Plugin_044_serial_buf[bytes_read] = ch;
|
||||
bytes_read++;
|
||||
break;
|
||||
case DONE:
|
||||
case P044_DONE:
|
||||
// Plugin_044_serial_buf[bytes_read]= '\n';
|
||||
// bytes_read++;
|
||||
// Plugin_044_serial_buf[bytes_read] = 0;
|
||||
@@ -293,16 +293,16 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
{
|
||||
Serial.read(); // when the buffer is full, just read remaining input, but do not store...
|
||||
bytes_read = 0;
|
||||
state = WAITING; // reset
|
||||
state = P044_WAITING; // reset
|
||||
}
|
||||
digitalWrite(STATUS_LED, 0);
|
||||
digitalWrite(P044_STATUS_LED, 0);
|
||||
timeOut = RXWait; // if serial received, reset timeout counter
|
||||
}
|
||||
delay(1);
|
||||
timeOut--;
|
||||
}
|
||||
|
||||
if (state == DONE) {
|
||||
if (state == P044_DONE) {
|
||||
if (checkDatagram(bytes_read)) {
|
||||
Plugin_044_serial_buf[bytes_read] = '\r';
|
||||
bytes_read++;
|
||||
@@ -327,8 +327,8 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
}
|
||||
|
||||
bytes_read = 0;
|
||||
state = WAITING;
|
||||
} // state == DONE
|
||||
state = P044_WAITING;
|
||||
} // state == P044_DONE
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
@@ -339,9 +339,9 @@ boolean Plugin_044(byte function, struct EventStruct *event, String& string)
|
||||
return success;
|
||||
}
|
||||
void blinkLED() {
|
||||
digitalWrite(STATUS_LED, 1);
|
||||
digitalWrite(P044_STATUS_LED, 1);
|
||||
delay(500);
|
||||
digitalWrite(STATUS_LED, 0);
|
||||
digitalWrite(P044_STATUS_LED, 0);
|
||||
}
|
||||
/*
|
||||
validP1char
|
||||
@@ -396,7 +396,7 @@ unsigned int CRC16(unsigned int crc, unsigned char *buf, int len)
|
||||
}
|
||||
|
||||
/* checkDatagram
|
||||
checks whether the checksum of the data received from P1 matches the checksum attached to the
|
||||
checks whether the P044_CHECKSUM of the data received from P1 matches the P044_CHECKSUM attached to the
|
||||
telegram
|
||||
based on code written by Jan ten Hove
|
||||
https://github.com/jantenhove/P1-Meter-ESP8266
|
||||
|
||||
@@ -81,6 +81,7 @@ boolean Plugin_051(byte function, struct EventStruct *event, String& string)
|
||||
addLog(LOG_LEVEL_ERROR, F("AM2320: Sensor offline"));
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
UserVar[event->BaseVarIndex] = th.t;
|
||||
UserVar[event->BaseVarIndex + 1] = th.h;
|
||||
|
||||
@@ -92,6 +93,7 @@ boolean Plugin_051(byte function, struct EventStruct *event, String& string)
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ boolean Plugin_053(byte function, struct EventStruct *event, String& string)
|
||||
// When new data is available, return true
|
||||
success = values_received;
|
||||
values_received = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
This plugin reads the particle concentration from SDS011 Sensor
|
||||
DevicePin1 - RX on ESP, TX on SDS
|
||||
*/
|
||||
|
||||
#ifdef ESP8266 // Needed for precompile issues.
|
||||
|
||||
#define PLUGIN_056
|
||||
#define PLUGIN_ID_056 56
|
||||
@@ -204,3 +204,4 @@ void Plugin_056_setWorkingPeriod(int minutes) {
|
||||
}
|
||||
|
||||
#endif // USES_P056
|
||||
#endif
|
||||
|
||||
@@ -252,11 +252,12 @@ boolean Plugin_074(byte function, struct EventStruct *event, String& string)
|
||||
log += F(" IR: ");
|
||||
log += String(ir);
|
||||
addLog(LOG_LEVEL_INFO,log);
|
||||
success = true;
|
||||
}
|
||||
else {
|
||||
addLog(LOG_LEVEL_ERROR,F("TSL2591: Sensor not initialized!?"));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@ boolean Plugin_076(byte function, struct EventStruct *event, String& string)
|
||||
UserVar[event->BaseVarIndex + 2] = hpower;
|
||||
UserVar[event->BaseVarIndex + 3] = hpowfact;
|
||||
//Plugin_076_hlw->toggleMode();
|
||||
success = true;
|
||||
}
|
||||
success = true;
|
||||
break;
|
||||
|
||||
case PLUGIN_INIT:
|
||||
|
||||
+245
-240
@@ -7,7 +7,7 @@
|
||||
|
||||
#define PLUGIN_077
|
||||
#define PLUGIN_ID_077 77
|
||||
#define PLUGIN_NAME_077 "Voltage & Current (AC) - CSE7766 [TESTING]"
|
||||
#define PLUGIN_NAME_077 "Energy (AC) - CSE7766 [TESTING]"
|
||||
#define PLUGIN_VALUENAME1_077 "Voltage"
|
||||
#define PLUGIN_VALUENAME2_077 "Power"
|
||||
#define PLUGIN_VALUENAME3_077 "Current"
|
||||
@@ -27,7 +27,7 @@ boolean Plugin_077_init = false;
|
||||
unsigned long energy_power_calibration = HLW_PREF_PULSE;
|
||||
unsigned long energy_voltage_calibration = HLW_UREF_PULSE;
|
||||
unsigned long energy_current_calibration = HLW_IREF_PULSE;
|
||||
*/
|
||||
*/
|
||||
|
||||
uint8_t cse_receive_flag = 0;
|
||||
|
||||
@@ -48,272 +48,277 @@ float energy_power = 0; // 123.1 W
|
||||
|
||||
boolean Plugin_077(byte function, struct EventStruct *event, String& string)
|
||||
{
|
||||
boolean success = false;
|
||||
boolean success = false;
|
||||
|
||||
switch (function) {
|
||||
case PLUGIN_DEVICE_ADD:
|
||||
{
|
||||
Device[++deviceCount].Number = PLUGIN_ID_077;
|
||||
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
|
||||
Device[deviceCount].Ports = 0;
|
||||
Device[deviceCount].PullUpOption = false;
|
||||
Device[deviceCount].InverseLogicOption = false;
|
||||
Device[deviceCount].FormulaOption = true;
|
||||
Device[deviceCount].ValueCount = 4;
|
||||
Device[deviceCount].SendDataOption = true;
|
||||
Device[deviceCount].TimerOption = true;
|
||||
Device[deviceCount].TimerOptional = true;
|
||||
Device[deviceCount].GlobalSyncOption = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_GET_DEVICENAME:
|
||||
{
|
||||
string = F(PLUGIN_NAME_077);
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_GET_DEVICEVALUENAMES:
|
||||
{
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[2], PSTR(PLUGIN_VALUENAME3_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[3], PSTR(PLUGIN_VALUENAME4_077));
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_WEBFORM_LOAD:
|
||||
{
|
||||
addFormNumericBox(F("U Ref"), F("plugin_077_URef"), Settings.TaskDevicePluginConfig[event->TaskIndex][0]);
|
||||
addUnit(F("uSec"));
|
||||
|
||||
addFormNumericBox(F("I Ref"), F("plugin_077_IRef"), Settings.TaskDevicePluginConfig[event->TaskIndex][1]);
|
||||
addUnit(F("uSec"));
|
||||
|
||||
addFormNumericBox(F("P Ref"), F("plugin_077_PRef"), Settings.TaskDevicePluginConfig[event->TaskIndex][2]);
|
||||
addUnit(F("uSec"));
|
||||
addFormNote(F("Use 0 to read values stored on chip / default values"));
|
||||
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_WEBFORM_SAVE:
|
||||
{
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_077_URef"));;
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_077_IRef"));
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = getFormItemInt(F("plugin_077_PRef"));
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_INIT:
|
||||
{
|
||||
Plugin_077_init = true;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][0] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][0] = HLW_UREF_PULSE;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][1] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][1] = HLW_IREF_PULSE;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][2] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][2] = HLW_PREF_PULSE;
|
||||
|
||||
Settings.UseSerial = true; // Enable Serial port
|
||||
Settings.SerialLogLevel = 0; // disable logging on serial port (used for CSE7766 communication)
|
||||
Settings.BaudRate = 4800; // set BaudRate for CSE7766
|
||||
Serial.flush();
|
||||
Serial.begin(Settings.BaudRate);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* currently not needed!
|
||||
case PLUGIN_TEN_PER_SECOND:
|
||||
switch (function) {
|
||||
case PLUGIN_DEVICE_ADD:
|
||||
{
|
||||
Device[++deviceCount].Number = PLUGIN_ID_077;
|
||||
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
|
||||
Device[deviceCount].Ports = 0;
|
||||
Device[deviceCount].PullUpOption = false;
|
||||
Device[deviceCount].InverseLogicOption = false;
|
||||
Device[deviceCount].FormulaOption = true;
|
||||
Device[deviceCount].ValueCount = 4;
|
||||
Device[deviceCount].SendDataOption = true;
|
||||
Device[deviceCount].TimerOption = true;
|
||||
Device[deviceCount].TimerOptional = true;
|
||||
Device[deviceCount].GlobalSyncOption = true;
|
||||
break;
|
||||
}
|
||||
|
||||
long cf_frequency = 0;
|
||||
case PLUGIN_GET_DEVICENAME:
|
||||
{
|
||||
string = F(PLUGIN_NAME_077);
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_GET_DEVICEVALUENAMES:
|
||||
{
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[2], PSTR(PLUGIN_VALUENAME3_077));
|
||||
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[3], PSTR(PLUGIN_VALUENAME4_077));
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_WEBFORM_LOAD:
|
||||
{
|
||||
addFormNumericBox(F("U Ref"), F("plugin_077_URef"), Settings.TaskDevicePluginConfig[event->TaskIndex][0]);
|
||||
addUnit(F("uSec"));
|
||||
|
||||
addFormNumericBox(F("I Ref"), F("plugin_077_IRef"), Settings.TaskDevicePluginConfig[event->TaskIndex][1]);
|
||||
addUnit(F("uSec"));
|
||||
|
||||
addFormNumericBox(F("P Ref"), F("plugin_077_PRef"), Settings.TaskDevicePluginConfig[event->TaskIndex][2]);
|
||||
addUnit(F("uSec"));
|
||||
addFormNote(F("Use 0 to read values stored on chip / default values"));
|
||||
|
||||
if (CSE_PULSES_NOT_INITIALIZED == cf_pulses_last_time) {
|
||||
cf_pulses_last_time = cf_pulses; // Init after restart
|
||||
} else {
|
||||
if (cf_pulses < cf_pulses_last_time) { // Rolled over after 65535 pulses
|
||||
cf_frequency = (65536 - cf_pulses_last_time) + cf_pulses;
|
||||
} else {
|
||||
cf_frequency = cf_pulses - cf_pulses_last_time;
|
||||
}
|
||||
if (cf_frequency) {
|
||||
cf_pulses_last_time = cf_pulses;
|
||||
// energy_kWhtoday_delta += (cf_frequency * energy_power_calibration) / 36;
|
||||
// EnergyUpdateToday();
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
case PLUGIN_READ:
|
||||
{
|
||||
// We do not actually read as this is already done by reading the serial output
|
||||
// Instead we just send the last known state stored in Uservar
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: plugin read"));
|
||||
case PLUGIN_WEBFORM_SAVE:
|
||||
{
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_077_URef"));;
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_077_IRef"));
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = getFormItemInt(F("plugin_077_PRef"));
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_INIT:
|
||||
{
|
||||
Plugin_077_init = true;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][0] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][0] = HLW_UREF_PULSE;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][1] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][1] = HLW_IREF_PULSE;
|
||||
if (Settings.TaskDevicePluginConfig[event->TaskIndex][2] == 0) Settings.TaskDevicePluginConfig[event->TaskIndex][2] = HLW_PREF_PULSE;
|
||||
|
||||
Settings.UseSerial = true; // Enable Serial port
|
||||
Settings.SerialLogLevel = 0; // disable logging on serial port (used for CSE7766 communication)
|
||||
Settings.BaudRate = 4800; // set BaudRate for CSE7766
|
||||
Serial.flush();
|
||||
Serial.begin(Settings.BaudRate);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* currently not needed!
|
||||
case PLUGIN_TEN_PER_SECOND:
|
||||
{
|
||||
|
||||
long cf_frequency = 0;
|
||||
|
||||
if (CSE_PULSES_NOT_INITIALIZED == cf_pulses_last_time) {
|
||||
cf_pulses_last_time = cf_pulses; // Init after restart
|
||||
} else {
|
||||
if (cf_pulses < cf_pulses_last_time) { // Rolled over after 65535 pulses
|
||||
cf_frequency = (65536 - cf_pulses_last_time) + cf_pulses;
|
||||
} else {
|
||||
cf_frequency = cf_pulses - cf_pulses_last_time;
|
||||
}
|
||||
if (cf_frequency) {
|
||||
cf_pulses_last_time = cf_pulses;
|
||||
// energy_kWhtoday_delta += (cf_frequency * energy_power_calibration) / 36;
|
||||
// EnergyUpdateToday();
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
case PLUGIN_READ:
|
||||
{
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: plugin read"));
|
||||
// sendData(event);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
// Variables set in PLUGIN_SERIAL_IN as soon as there are new values!
|
||||
// UserVar[event->BaseVarIndex] = energy_voltage;
|
||||
// UserVar[event->BaseVarIndex + 1] = energy_power;
|
||||
// UserVar[event->BaseVarIndex + 2] = energy_current;
|
||||
// UserVar[event->BaseVarIndex + 3] = cf_pulses;
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case PLUGIN_SERIAL_IN:
|
||||
{
|
||||
if (Plugin_077_init) {
|
||||
if (Serial.available() > 0) {
|
||||
serial_in_byte = Serial.read();
|
||||
success = true;
|
||||
}
|
||||
case PLUGIN_SERIAL_IN:
|
||||
{
|
||||
if (Plugin_077_init) {
|
||||
if (Serial.available() > 0) {
|
||||
serial_in_byte = Serial.read();
|
||||
success = true;
|
||||
|
||||
if (cse_receive_flag) {
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
if (24 == serial_in_byte_counter) {
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: packet received"));
|
||||
CseReceived(event);
|
||||
cse_receive_flag = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (0x5A == serial_in_byte) { // 0x5A - Packet header 2
|
||||
cse_receive_flag = 1;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: Header received"));
|
||||
} else {
|
||||
serial_in_byte_counter = 0;
|
||||
}
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
}
|
||||
serial_in_byte = 0; // Discard
|
||||
if (cse_receive_flag) {
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
if (24 == serial_in_byte_counter) {
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: packet received"));
|
||||
CseReceived(event);
|
||||
cse_receive_flag = 0;
|
||||
serial_in_byte_counter = 0;
|
||||
// new packet received, update values
|
||||
UserVar[event->BaseVarIndex] = energy_voltage;
|
||||
UserVar[event->BaseVarIndex + 1] = energy_power;
|
||||
UserVar[event->BaseVarIndex + 2] = energy_current;
|
||||
UserVar[event->BaseVarIndex + 3] = cf_pulses;
|
||||
// break;
|
||||
}
|
||||
} else {
|
||||
if (0x5A == serial_in_byte) { // 0x5A - Packet header 2
|
||||
cse_receive_flag = 1;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, F("CSE: Header received"));
|
||||
} else {
|
||||
serial_in_byte_counter = 0;
|
||||
}
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
}
|
||||
serial_in_byte = 0; // Discard
|
||||
|
||||
UserVar[event->BaseVarIndex] = energy_voltage;
|
||||
UserVar[event->BaseVarIndex + 1] = energy_power;
|
||||
UserVar[event->BaseVarIndex + 2] = energy_current;
|
||||
UserVar[event->BaseVarIndex + 3] = cf_pulses;
|
||||
|
||||
// String log = F("Variable: Tag: ");
|
||||
// log += key;
|
||||
// addLog(LOG_LEVEL_INFO, log);
|
||||
// success = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
// String log = F("Variable: Tag: ");
|
||||
// log += key;
|
||||
// addLog(LOG_LEVEL_INFO, log);
|
||||
// success = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
void CseReceived(struct EventStruct *event)
|
||||
{
|
||||
String log;
|
||||
uint8_t header = serial_in_buffer[0];
|
||||
if ((header & 0xFC) == 0xFC) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("CSE: Abnormal hardware"));
|
||||
return;
|
||||
}
|
||||
String log;
|
||||
uint8_t header = serial_in_buffer[0];
|
||||
if ((header & 0xFC) == 0xFC) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("CSE: Abnormal hardware"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate checksum
|
||||
uint8_t checksum = 0;
|
||||
for (byte i = 2; i < 23; i++) checksum += serial_in_buffer[i];
|
||||
if (checksum != serial_in_buffer[23]) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("CSE: Checksum Failure"));
|
||||
return;
|
||||
}
|
||||
// Calculate checksum
|
||||
uint8_t checksum = 0;
|
||||
for (byte i = 2; i < 23; i++) checksum += serial_in_buffer[i];
|
||||
if (checksum != serial_in_buffer[23]) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("CSE: Checksum Failure"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get chip calibration data (coefficients) and use as initial defaults
|
||||
if (HLW_UREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][0]) {
|
||||
long voltage_coefficient = 191200; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
voltage_coefficient = serial_in_buffer[2] << 16 | serial_in_buffer[3] << 8 | serial_in_buffer[4];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = voltage_coefficient / CSE_UREF;
|
||||
}
|
||||
if (HLW_IREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][1]) {
|
||||
long current_coefficient = 16140; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
current_coefficient = serial_in_buffer[8] << 16 | serial_in_buffer[9] << 8 | serial_in_buffer[10];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = current_coefficient;
|
||||
}
|
||||
if (HLW_PREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][2]) {
|
||||
long power_coefficient = 5364000; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
power_coefficient = serial_in_buffer[14] << 16 | serial_in_buffer[15] << 8 | serial_in_buffer[16];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = power_coefficient / CSE_PREF;
|
||||
}
|
||||
// Get chip calibration data (coefficients) and use as initial defaults
|
||||
if (HLW_UREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][0]) {
|
||||
long voltage_coefficient = 191200; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
voltage_coefficient = serial_in_buffer[2] << 16 | serial_in_buffer[3] << 8 | serial_in_buffer[4];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = voltage_coefficient / CSE_UREF;
|
||||
}
|
||||
if (HLW_IREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][1]) {
|
||||
long current_coefficient = 16140; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
current_coefficient = serial_in_buffer[8] << 16 | serial_in_buffer[9] << 8 | serial_in_buffer[10];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = current_coefficient;
|
||||
}
|
||||
if (HLW_PREF_PULSE == Settings.TaskDevicePluginConfig[event->TaskIndex][2]) {
|
||||
long power_coefficient = 5364000; // uSec
|
||||
if (CSE_NOT_CALIBRATED != header) {
|
||||
power_coefficient = serial_in_buffer[14] << 16 | serial_in_buffer[15] << 8 | serial_in_buffer[16];
|
||||
}
|
||||
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = power_coefficient / CSE_PREF;
|
||||
}
|
||||
|
||||
|
||||
uint8_t adjustement = serial_in_buffer[20];
|
||||
voltage_cycle = serial_in_buffer[5] << 16 | serial_in_buffer[6] << 8 | serial_in_buffer[7];
|
||||
current_cycle = serial_in_buffer[11] << 16 | serial_in_buffer[12] << 8 | serial_in_buffer[13];
|
||||
power_cycle = serial_in_buffer[17] << 16 | serial_in_buffer[18] << 8 | serial_in_buffer[19];
|
||||
cf_pulses = serial_in_buffer[21] << 8 | serial_in_buffer[22];
|
||||
uint8_t adjustement = serial_in_buffer[20];
|
||||
voltage_cycle = serial_in_buffer[5] << 16 | serial_in_buffer[6] << 8 | serial_in_buffer[7];
|
||||
current_cycle = serial_in_buffer[11] << 16 | serial_in_buffer[12] << 8 | serial_in_buffer[13];
|
||||
power_cycle = serial_in_buffer[17] << 16 | serial_in_buffer[18] << 8 | serial_in_buffer[19];
|
||||
cf_pulses = serial_in_buffer[21] << 8 | serial_in_buffer[22];
|
||||
|
||||
log = F("CSE: adjustement ");
|
||||
log += adjustement;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: voltage_cycle ");
|
||||
log += voltage_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: current_cycle ");
|
||||
log += current_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: power_cycle ");
|
||||
log += power_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: cf_pulses ");
|
||||
log += cf_pulses;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: adjustement ");
|
||||
log += adjustement;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: voltage_cycle ");
|
||||
log += voltage_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: current_cycle ");
|
||||
log += current_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: power_cycle ");
|
||||
log += power_cycle;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
log = F("CSE: cf_pulses ");
|
||||
log += cf_pulses;
|
||||
addLog(LOG_LEVEL_DEBUG_DEV, log);
|
||||
|
||||
// if (energy_power_on) { // Powered on
|
||||
// if (energy_power_on) { // Powered on
|
||||
|
||||
if (adjustement & 0x40) { // Voltage valid
|
||||
energy_voltage = (float)(Settings.TaskDevicePluginConfig[event->TaskIndex][0] * CSE_UREF) / (float)voltage_cycle;
|
||||
}
|
||||
if (adjustement & 0x10) { // Power valid
|
||||
if ((header & 0xF2) == 0xF2) { // Power cycle exceeds range
|
||||
energy_power = 0;
|
||||
} else {
|
||||
if (0 == power_cycle_first) power_cycle_first = power_cycle; // Skip first incomplete power_cycle
|
||||
if (power_cycle_first != power_cycle) {
|
||||
power_cycle_first = -1;
|
||||
energy_power = (float)(Settings.TaskDevicePluginConfig[event->TaskIndex][2] * CSE_PREF) / (float)power_cycle;
|
||||
} else {
|
||||
energy_power = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
power_cycle_first = 0;
|
||||
energy_power = 0; // Powered on but no load
|
||||
}
|
||||
if (adjustement & 0x20) { // Current valid
|
||||
if (0 == energy_power) {
|
||||
energy_current = 0;
|
||||
} else {
|
||||
energy_current = (float)Settings.TaskDevicePluginConfig[event->TaskIndex][1] / (float)current_cycle;
|
||||
}
|
||||
}
|
||||
if (adjustement & 0x40) { // Voltage valid
|
||||
energy_voltage = (float)(Settings.TaskDevicePluginConfig[event->TaskIndex][0] * CSE_UREF) / (float)voltage_cycle;
|
||||
}
|
||||
if (adjustement & 0x10) { // Power valid
|
||||
if ((header & 0xF2) == 0xF2) { // Power cycle exceeds range
|
||||
energy_power = 0;
|
||||
} else {
|
||||
if (0 == power_cycle_first) power_cycle_first = power_cycle; // Skip first incomplete power_cycle
|
||||
if (power_cycle_first != power_cycle) {
|
||||
power_cycle_first = -1;
|
||||
energy_power = (float)(Settings.TaskDevicePluginConfig[event->TaskIndex][2] * CSE_PREF) / (float)power_cycle;
|
||||
} else {
|
||||
energy_power = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
power_cycle_first = 0;
|
||||
energy_power = 0; // Powered on but no load
|
||||
}
|
||||
if (adjustement & 0x20) { // Current valid
|
||||
if (0 == energy_power) {
|
||||
energy_current = 0;
|
||||
} else {
|
||||
energy_current = (float)Settings.TaskDevicePluginConfig[event->TaskIndex][1] / (float)current_cycle;
|
||||
}
|
||||
}
|
||||
|
||||
// } else { // Powered off
|
||||
// power_cycle_first = 0;
|
||||
// energy_voltage = 0;
|
||||
// energy_power = 0;
|
||||
// energy_current = 0;
|
||||
// }
|
||||
// } else { // Powered off
|
||||
// power_cycle_first = 0;
|
||||
// energy_voltage = 0;
|
||||
// energy_power = 0;
|
||||
// energy_current = 0;
|
||||
// }
|
||||
|
||||
log = F("CSE voltage: ");
|
||||
log += energy_voltage;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE power: ");
|
||||
log += energy_power;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE current: ");
|
||||
log += energy_current;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE piulses: ");
|
||||
log += cf_pulses;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE voltage: ");
|
||||
log += energy_voltage;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE power: ");
|
||||
log += energy_power;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE current: ");
|
||||
log += energy_current;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
log = F("CSE piulses: ");
|
||||
log += cf_pulses;
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
}
|
||||
|
||||
#endif // USES_P077
|
||||
|
||||
Reference in New Issue
Block a user