mirror of https://github.com/arendst/Tasmota.git
Merge branch 'development' into sm16716
This commit is contained in:
commit
9b3a204ae5
|
@ -2,7 +2,8 @@
|
|||
* Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name
|
||||
* Add Resolution property to Status 3 report providing previous SetOption second value property
|
||||
* Fix IR local echo
|
||||
* Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring
|
||||
* Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff S31, Pow Ra and many Tuya based devices
|
||||
* Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2
|
||||
*
|
||||
* 6.4.1.13 20190130
|
||||
* Add command SetOption36 to control boot loop default restoration (#4645, #5063)
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -549,6 +549,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -549,6 +549,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -549,6 +549,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -548,6 +548,11 @@
|
|||
#define D_SENSOR_NRG_CF1 "HLWBL CF1"
|
||||
#define D_SENSOR_HLW_CF "HLW8012 CF"
|
||||
#define D_SENSOR_HJL_CF "BL0937 CF"
|
||||
#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx"
|
||||
#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx"
|
||||
#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst"
|
||||
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
|
||||
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
|
||||
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
|
||||
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
|
||||
#define D_SENSOR_SM16716_SEL "SM16716 SEL"
|
||||
|
|
|
@ -159,6 +159,9 @@ enum UserSelectablePins {
|
|||
GPIO_NRG_CF1, // HLW8012/HLJ-01 CF1 voltage / current
|
||||
GPIO_HLW_CF, // HLW8012 CF power
|
||||
GPIO_HJL_CF, // HJL-01/BL0937 CF power
|
||||
GPIO_MCP39F5_TX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RST, // MCP39F501 Reset (Shelly2)
|
||||
GPIO_SM16716_CLK, // SM16716 CLOCK
|
||||
GPIO_SM16716_DAT, // SM16716 DATA
|
||||
GPIO_SM16716_SEL, // SM16716 SELECT
|
||||
|
@ -176,6 +179,8 @@ enum ProgramSelectablePins {
|
|||
GPIO_ARIRFRCV, // AliLux RF Receive input
|
||||
GPIO_ROT_A, // Rotary switch A Pin
|
||||
GPIO_ROT_B, // Rotary switch B Pin
|
||||
GPIO_CSE7766_TX, // CSE7766 Serial interface (S31 and Pow R2)
|
||||
GPIO_CSE7766_RX, // CSE7766 Serial interface (S31 and Pow R2)
|
||||
GPIO_USER, // User configurable
|
||||
GPIO_MAX };
|
||||
|
||||
|
@ -224,6 +229,7 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_BUTTON "1i|" D_SENSOR_BUTTON "2i|" D_SENSOR_BUTTON "3i|" D_SENSOR_BUTTON "4i|"
|
||||
D_SENSOR_BUTTON "1in|" D_SENSOR_BUTTON "2in|" D_SENSOR_BUTTON "3in|" D_SENSOR_BUTTON "4in|"
|
||||
D_SENSOR_NRG_SEL "|" D_SENSOR_NRG_SEL "i|" D_SENSOR_NRG_CF1 "|" D_SENSOR_HLW_CF "|" D_SENSOR_HJL_CF "|"
|
||||
D_SENSOR_MCP39F5_TX "|" D_SENSOR_MCP39F5_RX "|" D_SENSOR_MCP39F5_RST "|"
|
||||
D_SENSOR_SM16716_CLK "|" D_SENSOR_SM16716_DAT "|" D_SENSOR_SM16716_SEL
|
||||
;
|
||||
|
||||
|
@ -471,21 +477,17 @@ const uint8_t kGpioNiceList[] PROGMEM = {
|
|||
GPIO_HX711_SCK, // HX711 Load Cell clock
|
||||
GPIO_HX711_DAT, // HX711 Load Cell data
|
||||
#endif
|
||||
#ifdef USE_SERIAL_BRIDGE
|
||||
GPIO_SBR_TX, // Serial Bridge Serial interface
|
||||
GPIO_SBR_RX, // Serial Bridge Serial interface
|
||||
#if defined(USE_ENERGY_SENSOR) && defined(USE_HLW8012)
|
||||
GPIO_NRG_SEL, // HLW8012/HLJ-01 Sel output (1 = Voltage)
|
||||
GPIO_NRG_SEL_INV, // HLW8012/HLJ-01 Sel output (0 = Voltage)
|
||||
GPIO_NRG_CF1, // HLW8012/HLJ-01 CF1 voltage / current
|
||||
GPIO_HLW_CF, // HLW8012 CF power
|
||||
GPIO_HJL_CF, // HJL-01/BL0937 CF power
|
||||
#endif
|
||||
#ifdef USE_MHZ19
|
||||
GPIO_MHZ_TXD, // MH-Z19 Serial interface
|
||||
GPIO_MHZ_RXD, // MH-Z19 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SENSEAIR
|
||||
GPIO_SAIR_TX, // SenseAir Serial interface
|
||||
GPIO_SAIR_RX, // SenseAir Serial interface
|
||||
#endif
|
||||
#ifdef USE_NOVA_SDS
|
||||
GPIO_SDS0X1_TX, // Nova Fitness SDS011 Serial interface
|
||||
GPIO_SDS0X1_RX, // Nova Fitness SDS011 Serial interface
|
||||
#if defined(USE_ENERGY_SENSOR) && defined(USE_MCP39F501)
|
||||
GPIO_MCP39F5_TX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RST, // MCP39F501 Reset (Shelly2)
|
||||
#endif
|
||||
#if defined(USE_PZEM004T) || defined(USE_PZEM_AC) || defined(USE_PZEM_DC)
|
||||
GPIO_PZEM0XX_TX, // PZEM0XX Serial interface
|
||||
|
@ -507,6 +509,22 @@ const uint8_t kGpioNiceList[] PROGMEM = {
|
|||
GPIO_SDM630_TX, // SDM630 Serial interface
|
||||
GPIO_SDM630_RX, // SDM630 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SERIAL_BRIDGE
|
||||
GPIO_SBR_TX, // Serial Bridge Serial interface
|
||||
GPIO_SBR_RX, // Serial Bridge Serial interface
|
||||
#endif
|
||||
#ifdef USE_MHZ19
|
||||
GPIO_MHZ_TXD, // MH-Z19 Serial interface
|
||||
GPIO_MHZ_RXD, // MH-Z19 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SENSEAIR
|
||||
GPIO_SAIR_TX, // SenseAir Serial interface
|
||||
GPIO_SAIR_RX, // SenseAir Serial interface
|
||||
#endif
|
||||
#ifdef USE_NOVA_SDS
|
||||
GPIO_SDS0X1_TX, // Nova Fitness SDS011 Serial interface
|
||||
GPIO_SDS0X1_RX, // Nova Fitness SDS011 Serial interface
|
||||
#endif
|
||||
#ifdef USE_PMS5003
|
||||
GPIO_PMS5003, // Plantower PMS5003 Serial interface
|
||||
#endif
|
||||
|
@ -533,6 +551,11 @@ const uint8_t kGpioNiceList[] PROGMEM = {
|
|||
GPIO_MAX31855CLK, // MAX31855 Serial interface
|
||||
GPIO_MAX31855DO, // MAX31855 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SM16716
|
||||
GPIO_SM16716_CLK, // SM16716 CLOCK
|
||||
GPIO_SM16716_DAT, // SM16716 DATA
|
||||
GPIO_SM16716_SEL, // SM16716 SELECT
|
||||
#endif // USE_SM16716
|
||||
#if defined(USE_ENERGY_SENSOR) && defined(USE_HLW8012)
|
||||
GPIO_NRG_SEL, // HLW8012/HLJ-01 Sel output (1 = Voltage)
|
||||
GPIO_NRG_SEL_INV, // HLW8012/HLJ-01 Sel output (0 = Voltage)
|
||||
|
@ -540,11 +563,6 @@ const uint8_t kGpioNiceList[] PROGMEM = {
|
|||
GPIO_HLW_CF, // HLW8012 CF power
|
||||
GPIO_HJL_CF, // HJL-01/BL0937 CF power
|
||||
#endif
|
||||
#ifdef USE_SM16716
|
||||
GPIO_SM16716_CLK, // SM16716 CLOCK
|
||||
GPIO_SM16716_DAT, // SM16716 DATA
|
||||
GPIO_SM16716_SEL, // SM16716 SELECT
|
||||
#endif // USE_SM16716
|
||||
};
|
||||
|
||||
const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
|
||||
|
@ -1340,9 +1358,9 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
},
|
||||
{ "Sonoff S31", // Sonoff S31 (ESP8266 - CSE7766)
|
||||
GPIO_KEY1, // GPIO00 Button
|
||||
0, // GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
GPIO_CSE7766_TX, // GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
0,
|
||||
0, // GPIO03 Serial TXD
|
||||
GPIO_CSE7766_RX, // GPIO03 Serial TXD
|
||||
0, 0,
|
||||
// GPIO06 (SD_CLK Flash)
|
||||
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
|
||||
|
@ -1375,9 +1393,9 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
},
|
||||
{ "Sonoff Pow R2", // Sonoff Pow R2 (ESP8285 - CSE7766)
|
||||
GPIO_KEY1, // GPIO00 Button
|
||||
0, // GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
GPIO_CSE7766_TX, // GPIO01 Serial RXD 4800 baud 8E1 CSE7766 energy sensor
|
||||
0,
|
||||
0, // GPIO03 Serial TXD
|
||||
GPIO_CSE7766_RX, // GPIO03 Serial TXD
|
||||
0, 0,
|
||||
// GPIO06 (SD_CLK Flash)
|
||||
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
|
||||
|
@ -1448,9 +1466,9 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
},
|
||||
{ "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/
|
||||
0,
|
||||
GPIO_TXD, // GPIO01 MCP39F501 Serial input
|
||||
GPIO_MCP39F5_TX, // GPIO01 MCP39F501 Serial input
|
||||
0,
|
||||
GPIO_RXD, // GPIO03 MCP39F501 Serial output
|
||||
GPIO_MCP39F5_RX, // GPIO03 MCP39F501 Serial output
|
||||
GPIO_REL1, // GPIO04
|
||||
GPIO_REL2, // GPIO05
|
||||
// GPIO06 (SD_CLK Flash)
|
||||
|
@ -1462,7 +1480,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
GPIO_SWT1, // GPIO12
|
||||
0,
|
||||
GPIO_SWT2, // GPIO14
|
||||
0, // GPIO15 MCP39F501 Reset
|
||||
GPIO_MCP39F5_RST, // GPIO15 MCP39F501 Reset
|
||||
0,
|
||||
GPIO_FLAG_PULLUP // Allow input pull-up control
|
||||
},
|
||||
|
|
|
@ -864,7 +864,7 @@ void HandleModuleConfiguration(void)
|
|||
for (uint8_t i = 0; i < sizeof(cmodule); i++) {
|
||||
if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
|
||||
snprintf_P(stemp, 3, PINS_WEMOS +i*2);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:160px'><select id='g%d' name='g%d'></select></td></tr>"),
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:176px'><select id='g%d' name='g%d'></select></td></tr>"),
|
||||
(WEMOS==Settings.module)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :(9==i)? "<font color='red'>ESP8285</font>" :(10==i)? "<font color='red'>ESP8285</font>" :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i);
|
||||
page += mqtt_data;
|
||||
}
|
||||
|
|
|
@ -695,6 +695,9 @@ bool Xdrv03(uint8_t function)
|
|||
case FUNC_SET_POWER:
|
||||
EnergySetPowerSteadyCounter();
|
||||
break;
|
||||
case FUNC_LOOP:
|
||||
XnrgCall(FUNC_LOOP);
|
||||
break;
|
||||
case FUNC_SERIAL:
|
||||
result = XnrgCall(FUNC_SERIAL);
|
||||
break;
|
||||
|
|
|
@ -499,8 +499,8 @@ void KNX_INIT(void)
|
|||
if (GetUsedInModule(GPIO_DHT22, my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; }
|
||||
if (GetUsedInModule(GPIO_SI7021, my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; }
|
||||
|
||||
// Sonoff 31 or Sonoff Pow or any HLW8012 based device or Sonoff POW R2 or Any device with a Pzem004T
|
||||
if ( ( SONOFF_S31 == Settings.module ) || ( SONOFF_POW_R2 == Settings.module ) || ( energy_flg != ENERGY_NONE ) ) {
|
||||
// Any device with a Power Monitoring
|
||||
if ( energy_flg != ENERGY_NONE ) {
|
||||
device_param[KNX_ENERGY_POWER-1].show = true;
|
||||
device_param[KNX_ENERGY_DAILY-1].show = true;
|
||||
device_param[KNX_ENERGY_START-1].show = true;
|
||||
|
|
|
@ -191,7 +191,7 @@ void CseEverySecond(void)
|
|||
void CseDrvInit(void)
|
||||
{
|
||||
if (!energy_flg) {
|
||||
if ((SONOFF_S31 == Settings.module) || (SONOFF_POW_R2 == Settings.module)) { // Sonoff S31 or Sonoff Pow R2
|
||||
if ((3 == pin[GPIO_CSE7766_RX]) && (1 == pin[GPIO_CSE7766_TX])) { // As it uses 8E1 currently only hardware serial is supported
|
||||
baudrate = 4800;
|
||||
serial_config = SERIAL_8E1;
|
||||
energy_flg = XNRG_02;
|
||||
|
|
|
@ -63,6 +63,11 @@
|
|||
#define MCP_FREQUENCY_GAIN_BASE 0x00AE
|
||||
#define MCP_FREQUENCY_LEN 4
|
||||
|
||||
#define MCP_BUFFER_SIZE 60
|
||||
|
||||
#include <TasmotaSerial.h>
|
||||
TasmotaSerial *McpSerial;
|
||||
|
||||
typedef struct mcp_cal_registers_type {
|
||||
uint16_t gain_current_rms;
|
||||
uint16_t gain_voltage_rms;
|
||||
|
@ -86,6 +91,9 @@ typedef struct mcp_cal_registers_type {
|
|||
uint16_t accumulation_interval;
|
||||
} mcp_cal_registers_type;
|
||||
|
||||
char *mcp_buffer = NULL; // Serial receive buffer
|
||||
int mcp_byte_counter = 0; // Index in serial receive buffer
|
||||
|
||||
unsigned long mcp_kWhcounter = 0;
|
||||
uint32_t mcp_system_configuration = 0x03000000;
|
||||
uint32_t mcp_active_power;
|
||||
|
@ -146,7 +154,7 @@ void McpSend(uint8_t *data)
|
|||
// AddLogBuffer(LOG_LEVEL_DEBUG_MORE, data, data[1]);
|
||||
|
||||
for (uint8_t i = 0; i < data[1]; i++) {
|
||||
Serial.write(data[i]);
|
||||
McpSerial->write(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +170,7 @@ void McpGetAddress(void)
|
|||
void McpAddressReceive(void)
|
||||
{
|
||||
// 06 05 004D 58
|
||||
mcp_address = serial_in_buffer[3];
|
||||
mcp_address = mcp_buffer[3];
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -183,26 +191,26 @@ void McpParseCalibration(void)
|
|||
mcp_cal_registers_type cal_registers;
|
||||
|
||||
// 06 37 C882 B6AD 0781 9273 06000000 00000000 00000000 0000 D3FF 0300 00000003 9204 120C1300 204E0000 9808 E0AB0000 D9940000 0200 24
|
||||
cal_registers.gain_current_rms = McpExtractInt(serial_in_buffer, 2, 2);
|
||||
cal_registers.gain_voltage_rms = McpExtractInt(serial_in_buffer, 4, 2);
|
||||
cal_registers.gain_active_power = McpExtractInt(serial_in_buffer, 6, 2);
|
||||
cal_registers.gain_reactive_power = McpExtractInt(serial_in_buffer, 8, 2);
|
||||
cal_registers.offset_current_rms = McpExtractInt(serial_in_buffer, 10, 4);
|
||||
cal_registers.offset_active_power = McpExtractInt(serial_in_buffer, 14, 4);
|
||||
cal_registers.offset_reactive_power = McpExtractInt(serial_in_buffer, 18, 4);
|
||||
cal_registers.dc_offset_current = McpExtractInt(serial_in_buffer, 22, 2);
|
||||
cal_registers.phase_compensation = McpExtractInt(serial_in_buffer, 24, 2);
|
||||
cal_registers.apparent_power_divisor = McpExtractInt(serial_in_buffer, 26, 2);
|
||||
cal_registers.gain_current_rms = McpExtractInt(mcp_buffer, 2, 2);
|
||||
cal_registers.gain_voltage_rms = McpExtractInt(mcp_buffer, 4, 2);
|
||||
cal_registers.gain_active_power = McpExtractInt(mcp_buffer, 6, 2);
|
||||
cal_registers.gain_reactive_power = McpExtractInt(mcp_buffer, 8, 2);
|
||||
cal_registers.offset_current_rms = McpExtractInt(mcp_buffer, 10, 4);
|
||||
cal_registers.offset_active_power = McpExtractInt(mcp_buffer, 14, 4);
|
||||
cal_registers.offset_reactive_power = McpExtractInt(mcp_buffer, 18, 4);
|
||||
cal_registers.dc_offset_current = McpExtractInt(mcp_buffer, 22, 2);
|
||||
cal_registers.phase_compensation = McpExtractInt(mcp_buffer, 24, 2);
|
||||
cal_registers.apparent_power_divisor = McpExtractInt(mcp_buffer, 26, 2);
|
||||
|
||||
cal_registers.system_configuration = McpExtractInt(serial_in_buffer, 28, 4);
|
||||
cal_registers.dio_configuration = McpExtractInt(serial_in_buffer, 32, 2);
|
||||
cal_registers.range = McpExtractInt(serial_in_buffer, 34, 4);
|
||||
cal_registers.system_configuration = McpExtractInt(mcp_buffer, 28, 4);
|
||||
cal_registers.dio_configuration = McpExtractInt(mcp_buffer, 32, 2);
|
||||
cal_registers.range = McpExtractInt(mcp_buffer, 34, 4);
|
||||
|
||||
cal_registers.calibration_current = McpExtractInt(serial_in_buffer, 38, 4);
|
||||
cal_registers.calibration_voltage = McpExtractInt(serial_in_buffer, 42, 2);
|
||||
cal_registers.calibration_active_power = McpExtractInt(serial_in_buffer, 44, 4);
|
||||
cal_registers.calibration_reactive_power = McpExtractInt(serial_in_buffer, 48, 4);
|
||||
cal_registers.accumulation_interval = McpExtractInt(serial_in_buffer, 52, 2);
|
||||
cal_registers.calibration_current = McpExtractInt(mcp_buffer, 38, 4);
|
||||
cal_registers.calibration_voltage = McpExtractInt(mcp_buffer, 42, 2);
|
||||
cal_registers.calibration_active_power = McpExtractInt(mcp_buffer, 44, 4);
|
||||
cal_registers.calibration_reactive_power = McpExtractInt(mcp_buffer, 48, 4);
|
||||
cal_registers.accumulation_interval = McpExtractInt(mcp_buffer, 52, 2);
|
||||
|
||||
if (mcp_calibrate & MCP_CALIBRATE_POWER) {
|
||||
cal_registers.calibration_active_power = Settings.energy_power_calibration;
|
||||
|
@ -373,8 +381,8 @@ void McpGetFrequency(void)
|
|||
void McpParseFrequency(void)
|
||||
{
|
||||
// 06 07 C350 8000 A0
|
||||
uint16_t line_frequency_ref = serial_in_buffer[2] * 256 + serial_in_buffer[3];
|
||||
uint16_t gain_line_frequency = serial_in_buffer[4] * 256 + serial_in_buffer[5];
|
||||
uint16_t line_frequency_ref = mcp_buffer[2] * 256 + mcp_buffer[3];
|
||||
uint16_t gain_line_frequency = mcp_buffer[4] * 256 + mcp_buffer[5];
|
||||
|
||||
if (mcp_calibrate & MCP_CALIBRATE_FREQUENCY) {
|
||||
line_frequency_ref = Settings.energy_frequency_calibration;
|
||||
|
@ -438,12 +446,12 @@ void McpParseData(void)
|
|||
// 06 19 CE 18 00 00 F2 08 3A 38 00 00 66 00 00 00 93 38 00 00 36 7F 9A C6 B7
|
||||
// Ak Ln Current---- Volt- ActivePower ReActivePow ApparentPow Factr Frequ Ck
|
||||
|
||||
mcp_current_rms = McpExtractInt(serial_in_buffer, 2, 4);
|
||||
mcp_voltage_rms = McpExtractInt(serial_in_buffer, 6, 2);
|
||||
mcp_active_power = McpExtractInt(serial_in_buffer, 8, 4);
|
||||
// mcp_reactive_power = McpExtractInt(serial_in_buffer, 12, 4);
|
||||
// mcp_power_factor = McpExtractInt(serial_in_buffer, 20, 2);
|
||||
mcp_line_frequency = McpExtractInt(serial_in_buffer, 22, 2);
|
||||
mcp_current_rms = McpExtractInt(mcp_buffer, 2, 4);
|
||||
mcp_voltage_rms = McpExtractInt(mcp_buffer, 6, 2);
|
||||
mcp_active_power = McpExtractInt(mcp_buffer, 8, 4);
|
||||
// mcp_reactive_power = McpExtractInt(mcp_buffer, 12, 4);
|
||||
// mcp_power_factor = McpExtractInt(mcp_buffer, 20, 2);
|
||||
mcp_line_frequency = McpExtractInt(mcp_buffer, 22, 2);
|
||||
|
||||
if (energy_power_on) { // Powered on
|
||||
energy_frequency = (float)mcp_line_frequency / 1000;
|
||||
|
@ -464,49 +472,52 @@ void McpParseData(void)
|
|||
|
||||
/********************************************************************************************/
|
||||
|
||||
bool McpSerialInput(void)
|
||||
void McpSerialInput(void)
|
||||
{
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
if (McpSerial->available()) {
|
||||
unsigned long start = millis();
|
||||
while (millis() - start < 20) {
|
||||
yield();
|
||||
if (Serial.available()) {
|
||||
serial_in_buffer[serial_in_byte_counter++] = Serial.read();
|
||||
if (McpSerial->available()) {
|
||||
mcp_buffer[mcp_byte_counter++] = McpSerial->read();
|
||||
start = millis();
|
||||
}
|
||||
}
|
||||
|
||||
AddLogSerial(LOG_LEVEL_DEBUG_MORE);
|
||||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t*)mcp_buffer, mcp_byte_counter);
|
||||
|
||||
if (1 == serial_in_byte_counter) {
|
||||
if (MCP_ERROR_CRC == serial_in_buffer[0]) {
|
||||
if (1 == mcp_byte_counter) {
|
||||
if (MCP_ERROR_CRC == mcp_buffer[0]) {
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("MCP: Send " D_CHECKSUM_FAILURE));
|
||||
mcp_timeout = 0;
|
||||
}
|
||||
else if (MCP_ERROR_NAK == serial_in_buffer[0]) {
|
||||
else if (MCP_ERROR_NAK == mcp_buffer[0]) {
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("MCP: NAck"));
|
||||
mcp_timeout = 0;
|
||||
}
|
||||
}
|
||||
else if (MCP_ACK_FRAME == serial_in_buffer[0]) {
|
||||
if (serial_in_byte_counter == serial_in_buffer[1]) {
|
||||
else if (MCP_ACK_FRAME == mcp_buffer[0]) {
|
||||
if (mcp_byte_counter == mcp_buffer[1]) {
|
||||
|
||||
if (McpChecksum((uint8_t *)serial_in_buffer) != serial_in_buffer[serial_in_byte_counter -1]) {
|
||||
if (McpChecksum((uint8_t *)mcp_buffer) != mcp_buffer[mcp_byte_counter -1]) {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("MCP: " D_CHECKSUM_FAILURE));
|
||||
} else {
|
||||
if (5 == serial_in_buffer[1]) { McpAddressReceive(); }
|
||||
if (25 == serial_in_buffer[1]) { McpParseData(); }
|
||||
if (MCP_CALIBRATION_LEN + 3 == serial_in_buffer[1]) { McpParseCalibration(); }
|
||||
if (MCP_FREQUENCY_LEN + 3 == serial_in_buffer[1]) { McpParseFrequency(); }
|
||||
if (5 == mcp_buffer[1]) { McpAddressReceive(); }
|
||||
if (25 == mcp_buffer[1]) { McpParseData(); }
|
||||
if (MCP_CALIBRATION_LEN + 3 == mcp_buffer[1]) { McpParseCalibration(); }
|
||||
if (MCP_FREQUENCY_LEN + 3 == mcp_buffer[1]) { McpParseFrequency(); }
|
||||
}
|
||||
|
||||
}
|
||||
mcp_timeout = 0;
|
||||
}
|
||||
else if (MCP_SINGLE_WIRE == serial_in_buffer[0]) {
|
||||
else if (MCP_SINGLE_WIRE == mcp_buffer[0]) {
|
||||
mcp_timeout = 0;
|
||||
}
|
||||
return 1;
|
||||
|
||||
mcp_byte_counter = 0;
|
||||
McpSerial->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -543,23 +554,35 @@ void McpEverySecond(void)
|
|||
|
||||
void McpSnsInit(void)
|
||||
{
|
||||
SetSeriallog(LOG_LEVEL_NONE); // Free serial interface from logging interference
|
||||
digitalWrite(15, 1); // GPIO15 - MCP enable
|
||||
// Software serial init needs to be done here as earlier (serial) interrupts may lead to Exceptions
|
||||
McpSerial = new TasmotaSerial(pin[GPIO_MCP39F5_RX], pin[GPIO_MCP39F5_TX], 1);
|
||||
if (McpSerial->begin(4800)) {
|
||||
if (McpSerial->hardwareSerial()) { ClaimSerial(); }
|
||||
if (pin[GPIO_MCP39F5_RST] < 99) {
|
||||
digitalWrite(pin[GPIO_MCP39F5_RST], 1); // MCP enable
|
||||
}
|
||||
} else {
|
||||
energy_flg = ENERGY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void McpDrvInit(void)
|
||||
{
|
||||
if (!energy_flg) {
|
||||
if (SHELLY2 == Settings.module) {
|
||||
pinMode(15, OUTPUT);
|
||||
digitalWrite(15, 0); // GPIO15 - MCP disable - Reset Delta Sigma ADC's
|
||||
baudrate = 4800;
|
||||
if ((pin[GPIO_MCP39F5_RX] < 99) && (pin[GPIO_MCP39F5_TX] < 99)) {
|
||||
mcp_buffer = (char*)(malloc(MCP_BUFFER_SIZE));
|
||||
if (mcp_buffer != NULL) {
|
||||
if (pin[GPIO_MCP39F5_RST] < 99) {
|
||||
pinMode(pin[GPIO_MCP39F5_RST], OUTPUT);
|
||||
digitalWrite(pin[GPIO_MCP39F5_RST], 0); // MCP disable - Reset Delta Sigma ADC's
|
||||
}
|
||||
mcp_calibrate = 0;
|
||||
mcp_timeout = 2; // Initial wait
|
||||
mcp_init = 2; // Initial setup steps
|
||||
energy_flg = XNRG_04;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool McpCommand(void)
|
||||
|
@ -628,15 +651,15 @@ int Xnrg04(uint8_t function)
|
|||
case FUNC_INIT:
|
||||
McpSnsInit();
|
||||
break;
|
||||
case FUNC_LOOP:
|
||||
McpSerialInput();
|
||||
break;
|
||||
case FUNC_EVERY_SECOND:
|
||||
McpEverySecond();
|
||||
break;
|
||||
case FUNC_COMMAND:
|
||||
result = McpCommand();
|
||||
break;
|
||||
case FUNC_SERIAL:
|
||||
result = McpSerialInput();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue