From 112991cd03fe0455eb894e8b70c5beb39d1ffceb Mon Sep 17 00:00:00 2001 From: uwekaditz <55511593+uwekaditz@users.noreply.github.com> Date: Fri, 24 Jul 2020 21:57:00 +0200 Subject: [PATCH 01/11] [P092_DLBus] Move plugin data from lib to PluginStructs Move plugin data from lib\DLBus to src\PluginStructs\P092_data_struct in PluginStructs (similar to P036_data_struct) --- lib/DLBus/keywords.txt | 6 ------ .../src/PluginStructs/P092_data_struct.cpp | 15 +-------------- .../src/PluginStructs/P092_data_struct.h | 1 + 3 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 lib/DLBus/keywords.txt rename lib/DLBus/DLBus.cpp => src/src/PluginStructs/P092_data_struct.cpp (95%) rename lib/DLBus/DLBus.h => src/src/PluginStructs/P092_data_struct.h (98%) diff --git a/lib/DLBus/keywords.txt b/lib/DLBus/keywords.txt deleted file mode 100644 index d0c8c4bb0..000000000 --- a/lib/DLBus/keywords.txt +++ /dev/null @@ -1,6 +0,0 @@ -DLBus KEYWORD1 -attachDLBusInterrupt KEYWORD2 -StartReceiving KEYWORD2 -CheckTimings KEYWORD2 -Processing KEYWORD2 -CheckCRC KEYWORD2 diff --git a/lib/DLBus/DLBus.cpp b/src/src/PluginStructs/P092_data_struct.cpp similarity index 95% rename from lib/DLBus/DLBus.cpp rename to src/src/PluginStructs/P092_data_struct.cpp index e041af332..a7d21562f 100644 --- a/lib/DLBus/DLBus.cpp +++ b/src/src/PluginStructs/P092_data_struct.cpp @@ -1,4 +1,4 @@ -#include "DLBus.h" +#include "P092_data_struct.h" // // DLBus reads and decodes the DL-Bus. // The DL-Bus is used in heating control units e.g. sold by Technische Alternative (www.ta.co.at). @@ -15,19 +15,6 @@ #define DLbus_FlagLongerThanTwiceDoubleWidth 0x80 #define DLbus_FlagsWrongTiming (DLbus_FlagLongerThanTwiceDoubleWidth | DLbus_FlagLongerThanDoubleWidth | DLbus_FlagBetweenDoubleSingleWidth | DLbus_FlagShorterThanSingleWidth) -extern long usecPassedSince(unsigned long timestamp) ICACHE_RAM_ATTR; -extern void addToLog(byte loglevel, const String& string); - -//#define LOG_LEVEL_ERROR 1 -#define LOG_LEVEL_INFO 2 -#ifndef F -// Create a no-op F() macro so the code base still compiles outside of the -// Arduino framework. Thus we can safely use the Arduino 'F()' macro through-out -// the code base. That macro stores constants in Flash (PROGMEM) memory. -// See: https://github.com/crankyoldgit/IRremoteESP8266/issues/667 - #define F(x) x -#endif // F - // Helper for ISR call DLBus* DLBus::__instance = nullptr; volatile static uint8_t* ISR_PtrChangeBitStream = nullptr; // pointer to received bit change stream diff --git a/lib/DLBus/DLBus.h b/src/src/PluginStructs/P092_data_struct.h similarity index 98% rename from lib/DLBus/DLBus.h rename to src/src/PluginStructs/P092_data_struct.h index 5e8ef99af..414fdae97 100644 --- a/lib/DLBus/DLBus.h +++ b/src/src/PluginStructs/P092_data_struct.h @@ -2,6 +2,7 @@ #define DLBus_H #include +#include "../../_Plugin_Helper.h" /*********************************************************************************************\ DLBus subs to get values from the receiving bitstream From 96fc31a03cba4f119a5131cf51f7635c445f0c48 Mon Sep 17 00:00:00 2001 From: uwekaditz <55511593+uwekaditz@users.noreply.github.com> Date: Fri, 24 Jul 2020 22:04:48 +0200 Subject: [PATCH 02/11] Update _P092_DLbus.ino FIX: Correct include --- src/_P092_DLbus.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_P092_DLbus.ino b/src/_P092_DLbus.ino index 803df9c5a..773776aa2 100644 --- a/src/_P092_DLbus.ino +++ b/src/_P092_DLbus.ino @@ -38,7 +38,7 @@ \**************************************************/ -#include +#include "src/PluginStructs/P092_data_struct.h" #define PLUGIN_092 #define PLUGIN_ID_092 92 From c5e6ae37ff48b19d3963bc7c086f5d5d785e70ce Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sat, 22 Aug 2020 11:16:21 +0200 Subject: [PATCH 03/11] [P044] Accept '_' in meter ID --- src/src/PluginStructs/P044_data_struct.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/src/PluginStructs/P044_data_struct.cpp b/src/src/PluginStructs/P044_data_struct.cpp index 18288db76..545e4752d 100644 --- a/src/src/PluginStructs/P044_data_struct.cpp +++ b/src/src/PluginStructs/P044_data_struct.cpp @@ -196,6 +196,7 @@ bool P044_Task::validP1char(char ch) { case '-': case '*': case ':': + case '_': return true; } return false; From 06254089a5670e8044c2bc6a01271240c3687f54 Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 16:30:20 +0200 Subject: [PATCH 04/11] [Docs] Add documentation for ESP32 ethernet + missing config page --- docs/source/Config/Config.rst | 235 +++++++++++++++++++ docs/source/Hardware/Hardware.rst | 84 +++++++ docs/source/Reference/Ethernet_PHY_ESP32.rst | 42 ++++ docs/source/Reference/GPIO.rst | 6 + docs/source/index.rst | 1 + src/WebServer_ConfigPage.ino | 4 +- src/WebServer_HardwarePage.ino | 2 +- src/src/Helpers/Hardware.cpp | 21 ++ 8 files changed, 392 insertions(+), 3 deletions(-) create mode 100644 docs/source/Config/Config.rst create mode 100644 docs/source/Reference/Ethernet_PHY_ESP32.rst diff --git a/docs/source/Config/Config.rst b/docs/source/Config/Config.rst new file mode 100644 index 000000000..50456fc63 --- /dev/null +++ b/docs/source/Config/Config.rst @@ -0,0 +1,235 @@ +Config page +*********** + +Main Settings +============= + +Unit Name +--------- + +The name of this node. +This is mainly used when connecting to a MQTT broker or in p2p communications. +It is also used to generate a hostname in the local network, for example when using mDNS. + + +Unit Number +----------- + +The number of this node. +It can be appended to the hostname. + +The main use of the unit number is in ESPEasy p2p communications. +When used in p2p communications, make sure not to use unit number ``0`` or ``255`` as those are reserved. + +Range: 0 ... 255 + +Append Unit Number to hostname +------------------------------ + +A flag to indicate how the hostname must be generated from *Unit Name* and *Unit Number*. + +N.B. currently it is used in all occurences where a hostname is needed, but this appeared to be not working well for some MQTT brokers. +So expect it to be changed later to split this flag for every occasion where a hostname is needed. + + +Admin Password +-------------- + +A password to prevent altering settings in the web interface. + +Default password is empty. + +N.B. when asked for a login prompt, the user name is ``admin`` + +WiFi Settings +============= + +A WiFi capable device can operate in two modes: + +* Station mode (STA), device needs to connect to an access point. +* Access Point mode (AP), other STA devices can connect to this device. + +An AP will broadcast an identifier string, called the SSID. + +For an STA device to connect to an AP, two parameters are needed: + +* SSID - The identifier string of an AP. +* WPA key - The password or pass phrase to make a connection. + +N.B. when using the mentioned commands to set SSID/key, don't forget to call the ``save`` command. + + +SSID +---- + +The AP identifier string to connect to. +This is needed when running in STA mode. + +Can also be set via the command ``wifissid``. + + +WPA Key +------- + +The password or pass phrase to connect to the AP with given SSID. + +Can also be set via the command ``wifikey``. + + +Fallback SSID / WPA Key +----------------------- + +This is an alternate to the first configured SSID/key. + +There are various use cases to have multiple AP configurations stored on a node. +For example to be able to move to anothe location where only another AP can be reached. +Or as a backup, for example to let the node connect to a local hotspot on your phone. + +Can also be set via the commands: + +* ``wifissid2`` +* ``wifikey2`` + + +WPA AP Mode Key +--------------- + +It is possible a node cannot connect to an AP: + +* When there is no SSID configured +* The configured AP's are not in reach +* The configured AP's do not allow the node to connect + +In these situations the ESP node will start its own local AP. + +As SSID the Unit Name will be used, which is by default ``ESP_Easy_0`` + +The default WPA key to connect to this AP is ``configesp``, but can be changed here. + +This is often used to perform the initial configuration like connecting to the local network. + +Can also be set via the command ``WiFiAPKey``. + + +Client IP filtering +=================== + +Sometimes it can be useful to only allow access to the web interface of a node from a specific range of IP-addresses. + +For example if a node should only be configured from the local subnet. + + + +Client IP block level +--------------------- + +* **Allow All** - No filtering applied, the web interface can be accessed from any IP able to reach the node. (default) +* **Allow Local Subnet** - Only allow access to the web interface from the local subnet. +* **Allow IP range** - Only allow access to the web interface from a specific IP range. + +Access IP lower range +--------------------- + +When *Allow IP range* is set, this field defines the lower bound of the range. + + +Access IP upper range +--------------------- + +When *Allow IP range* is set, this field defines the upper bound of the range. + + + +WiFi/Ethernet IP Settings +========================= + +For both WiFi and Ethernet a node can be configured to receive an IP automatically via DHCP, or use a static IP. + +If all fields for IP, GW, subnet mask and DNS are left empty, the configuration offered via DHCP will be used. + +* **IP** The static IPv4 address to use for this node +* **Gateway** IPv4 address of the gateway to reach hosts outside this subnet. (typically the IP of the router) +* **Subnetmask** Mask applied to define the local subnet. (typically: ``255.255.255.0`` ) +* **DNS** IPv4 address of a DNS server to use. (typically the IP of the router or some assigned by the ISP) + +Sleep Mode +========== + +Description +----------- + +The ESP can be put into deep sleep for a set amount of time. + +On an ESP8266, GPIO-16 must be connected to the RST pin to be able to wake up again. + +As long as the node is in deep sleep mode, you can't connect to the web interface. +In fact, the ESP is turned off and only a dedicated timer circuit is still powered to wake up the main ESP core. + +There are three ways to get out of sleep mode: + +Cold boot +^^^^^^^^^ + +Power off the ESP and reconnect power. +You will have 30 seconds to connect to the Web interface and disable the Sleep Mode function. +(You will get feedback in the serial interface) + + +Temporary disable Deep Sleep via jumper setting +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If 30 seconds is too short for you, you can use this method. + +* Disconnect GPIO-16 from RST and connect it to GND. Restart your ESP if neccesary. +* Now deep sleep will be disabled and your ESP will function normally, until you connect GPIO-16 to RST again. + +This requires ESPEasy v2.0.0-dev6 or newer. + +Factory reset +^^^^^^^^^^^^^ + +If all else fails, just do a factory reset. **You will lose all your settings!** + +* Connect the RX and TX pin together while you restart your ESP. (will clear all stored settings) +* Power off the device. +* Remove the connector across the RX and TX pins. +* Restart and then configure the ESPEasy firmware again. (at restart factory default settings will be loaded) + +If this doesn't work: + +* Try loading the blank image to match the size of the memory installed on the device. +* Reboot and wait 5 minutes. +* Then load on the firmware you are wanting to use. +* Reboot and wait 5 minutes. + + +Sleep awake time +---------------- + +This setting defines the minimum time in seconds a node should be awake from deep sleep. + +If set to 0, the node will not go into deep sleep automatically. + +At boot from deep sleep, a timer is started based on this setting. +If this timer expires, the node will enter deep sleep again. + +As soon as the node has a successful WiFi connection, the timer will be restarted to allow to send out sensor data. + + +N.B. It is possible to put a node into deepsleep via the command ``deepsleep``, regardless this setting. + + + +Sleep time +---------- + +The duration in seconds for a node to go into deep sleep. + +Typical max. duration is 4294 seconds (Roughly 71 minutes) + +N.B. the maximum possible duration depends on the used core library version and is mentioned at the configuration page. + + +Sleep on connection failure +--------------------------- + diff --git a/docs/source/Hardware/Hardware.rst b/docs/source/Hardware/Hardware.rst index 82be3a846..b4d0f5c85 100644 --- a/docs/source/Hardware/Hardware.rst +++ b/docs/source/Hardware/Hardware.rst @@ -155,6 +155,90 @@ Other SPI pins to be used are device specific, and need to be configured from th NB: When using the VSPI interface and also the I2C interface is used, another pin has to be selected for I2C GPIO -> SCL, as its configuration is fixed for the VSPI setting. +-------- +Ethernet +-------- + +On builds including ``_eth`` in their build name, it is also possible to use ethernet instead of WiFi. +Currently this is only present for ESP32 builds and no plans currently exist to support it for ESP82xx. + +N.B. This is still in testing phase, so not all kinds of network communications work right now. + +Preferred network medium +^^^^^^^^^^^^^^^^^^^^^^^^ + +Allows to switch between: + +* WiFi (default) +* Ethernet + +To activate a new configuration, a reboot is needed. + +Ethernet PHY type +^^^^^^^^^^^^^^^^^ + +Select the used PHY controller type: + +* LAN8710 (LAN8720 is also supported, but none of the newer features are supported) +* TLK110 + +Ethernet PHY Address +^^^^^^^^^^^^^^^^^^^^ + +The PHY address depends on the hardware and the PHY configuration. + +* Espressif's Ethernet board with TLK110 PHY use PHY address 31. +* Common Waveshare LAN8720 PHY breakout use PHY address 1. +* Olimex ESP32 EVB REV B IoT LAN8710 PHY Board with CAN use PHY address 0. +* Other LAN8720 breakouts often use PHY address 0. + +If the PHY address is incorrect then the EMAC will initialise but all attempts to read/write configuration registers on the PHY will fail. + +GPIO pins +^^^^^^^^^ + +RMII PHY SMI Wiring +""""""""""""""""""" + +Most PHY boards have documented their *RMII PHY SMI Wiring* pins: + +* **MDC** Output to PHY, usually pin 23 +* **MDIO** Bidirectional, usually pin 18 + +Clock sync +"""""""""" + +The PHY and the ESP need to keep a clock in sync. +This can either be done via an external crystal, which is connected to a GPIO pin. +Another option is to let the ESP provide the clock to the PHY. + +* External crystal oscillator +* 50MHz APLL Output on GPIO0 +* 50MHz APLL Output on GPIO16 +* 50MHz APLL Inverted Output on GPIO17 + +Power pin +""""""""" + +On almost all PHY boards, or ESP boards equiped with an ethernet PHY, it is possible to turn the PHY on or off. +Either to save energy, or to make sure the external clock is not affecting the ESP boot mode when it restarts. + +For example the Olimex ESP32-EVB does have the *external crystal oscillator* connected to GPIO-0, which could boot the ESP32 randomly into UART flash mode. +Most boards use a specific GPIO pin to control the power to the PHY. +The Olimex ESP32-EVB does have a specific delay circuit to only allow power to the PHY after boot and therefore does not need to control the PHY power. + +For other boards, the default is often GPIO-17, but this may change per board. + +RMII PHY Wiring +""""""""""""""" + +Apart from these GPIO pins, there is a number of other pins reserved on the ESP32 for RMII PHY Wiring. + +Since these GPIO pin assignments cannot be changed, it is also not needed to configure them. +However, they also cannot be used when *RMII PHY* is used. + +.. include:: ../Reference/Ethernet_PHY_ESP32.rst + ------------------- GPIO boot states diff --git a/docs/source/Reference/Ethernet_PHY_ESP32.rst b/docs/source/Reference/Ethernet_PHY_ESP32.rst new file mode 100644 index 000000000..cdce3b01b --- /dev/null +++ b/docs/source/Reference/Ethernet_PHY_ESP32.rst @@ -0,0 +1,42 @@ + + +The following PHY connections are required for RMII PHY data connections: + +.. list-table:: RMII PHY Wiring + :widths: 10 25 25 75 + :header-rows: 1 + + * - GPIO + - RMII Signal + - ESP32 EMAC Function + - Notes + * - 0 + - REF_CLK + - EMAC_TX_CLK + - See desciption about the clock + * - 21 + - TX_EN + - EMAC_TX_EN + - + * - 19 + - TX0 + - EMAC_TXD0 + - + * - 22 + - TX1 + - EMAC_TXD1 + - + * - 25 + - RX0 + - EMAC_RXD0 + - + * - 26 + - RX1 + - EMAC_RXD1 + - + * - 27 + - CRS_DV + - EMAC_RX_DRV + - + +See `ESP32 datasheet `_ diff --git a/docs/source/Reference/GPIO.rst b/docs/source/Reference/GPIO.rst index 49f512175..b505ef0cb 100644 --- a/docs/source/Reference/GPIO.rst +++ b/docs/source/Reference/GPIO.rst @@ -243,3 +243,9 @@ It is best not to use any of the GPIO pins 6 - 11. GPIO 6, 7 & 8 may output some PWM signals at boot. GPIO 9, 10 & 11 output high at boot and may fail to boot of pulled either high or low. + + +Pins used for RMII Ethernet PHY +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: ../Reference/Ethernet_PHY_ESP32.rst \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index c3db97f9d..70f15a8de 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -12,6 +12,7 @@ Welcome to ESP Easy's documentation! ESPEasy/AboutUs.rst ESPEasy/FunctionBlocks.rst + Config/Config.rst Controller/_Controller.rst Hardware/Hardware.rst Plugin/_Plugin.rst diff --git a/src/WebServer_ConfigPage.ino b/src/WebServer_ConfigPage.ino index 23a359d36..90520d3ba 100644 --- a/src/WebServer_ConfigPage.ino +++ b/src/WebServer_ConfigPage.ino @@ -154,7 +154,7 @@ void handle_config() { addFormSubHeader(F("WiFi IP Settings")); addFormIPBox(F("ESP WiFi IP"), F("espip"), Settings.IP); - addFormIPBox(F("ESP WiFi GW"), F("espgateway"), Settings.Gateway); + addFormIPBox(F("ESP WiFi Gateway"), F("espgateway"), Settings.Gateway); addFormIPBox(F("ESP WiFi Subnetmask"), F("espsubnet"), Settings.Subnet); addFormIPBox(F("ESP WiFi DNS"), F("espdns"), Settings.DNS); addFormNote(F("Leave empty for DHCP")); @@ -163,7 +163,7 @@ void handle_config() { addFormSubHeader(F("Ethernet IP Settings")); addFormIPBox(F("ESP Ethernet IP"), F("espethip"), Settings.ETH_IP); - addFormIPBox(F("ESP Ethernet GW"), F("espethgateway"), Settings.ETH_Gateway); + addFormIPBox(F("ESP Ethernet Gateway"), F("espethgateway"), Settings.ETH_Gateway); addFormIPBox(F("ESP Ethernet Subnetmask"), F("espethsubnet"), Settings.ETH_Subnet); addFormIPBox(F("ESP Ethernet DNS"), F("espethdns"), Settings.ETH_DNS); addFormNote(F("Leave empty for DHCP")); diff --git a/src/WebServer_HardwarePage.ino b/src/WebServer_HardwarePage.ino index 8891bee26..08f58d052 100644 --- a/src/WebServer_HardwarePage.ino +++ b/src/WebServer_HardwarePage.ino @@ -152,7 +152,7 @@ void handle_hardware() { #ifdef HAS_ETHERNET addFormSubHeader(F("Ethernet")); - addRowLabel_tr_id(F("Ethernet or WIFI?"), "ethwifi"); + addRowLabel_tr_id(F("Preferred network medium"), "ethwifi"); String ethWifiOptions[2] = { F("WIFI"), F("ETHERNET") }; addSelector("ethwifi", 2, ethWifiOptions, NULL, NULL, Settings.ETH_Wifi_Mode, false, true); addFormNote(F("Change Switch between WIFI and ETHERNET requires reboot to activate")); diff --git a/src/src/Helpers/Hardware.cpp b/src/src/Helpers/Hardware.cpp index cb16499ff..580db2415 100644 --- a/src/src/Helpers/Hardware.cpp +++ b/src/src/Helpers/Hardware.cpp @@ -528,6 +528,27 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning) // Has an internal pull-up, so unconnected = High = normal output. warning = true; } + + #ifdef HAS_ETHERNET + + // Check pins used for RMII Ethernet PHY + if (ETHERNET == Settings.ETH_Wifi_Mode) { + switch (gpio) { + case 0: + case 21: + case 19: + case 22: + case 25: + case 26: + case 27: + warning = true; + break; + } + // FIXME TD-er: Must we also check for pins used for MDC/MDIO and Eth PHY power? + } + + + #endif return true; } From c70055558f5634a744a147899b44904b029cfede Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 17:23:51 +0200 Subject: [PATCH 05/11] [ESP32 ETH] Add pre-defined Olimex ESP32-EVB config --- src/ESPEasy-Globals.h | 30 +++++++++++++++++++++++++----- src/ESPEasyEth.cpp | 4 ++-- src/WebServer_HardwarePage.ino | 4 ++-- src/src/DataStructs/DeviceModel.h | 1 + src/src/Helpers/Hardware.cpp | 7 +++++-- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/ESPEasy-Globals.h b/src/ESPEasy-Globals.h index b96574fda..4c4221fb2 100644 --- a/src/ESPEasy-Globals.h +++ b/src/ESPEasy-Globals.h @@ -403,14 +403,34 @@ struct GpioFactorySettingsStruct { i2c_scl = -1; // GPIO5 conflicts with SW input break; case DeviceMode_Olimex_ESP32_PoE: - button[0] = 34; // DUT1 Button + button[0] = 34; // BUT1 Button relais[0] = -1; // No LED's or relays on board status_led = -1; - i2c_sda = 4; - i2c_scl = 5; + i2c_sda = 13; + i2c_scl = 16; + eth_phyaddr = 0; + eth_phytype = 0; // LAN8710 + eth_mdc = 23; + eth_mdio = 18; eth_power = 12; - eth_clock_mode = 3; - eth_wifi_mode = 1; + eth_clock_mode = 3; // 50MHz APLL Inverted Output on GPIO17 + eth_wifi_mode = 1; // default to ethernet + break; + case DeviceMode_Olimex_ESP32_EVB: + button[0] = 34; // BUT1 Button + relais[0] = 32; // LED1 + Relay1 (0 = Off, 1 = On) + relais[1] = 33; // LED2 + Relay2 (0 = Off, 1 = On) + + status_led = -1; + i2c_sda = 13; + i2c_scl = 16; + eth_phyaddr = 0; + eth_phytype = 0; // LAN8710 + eth_mdc = 23; + eth_mdio = 18; + eth_power = -1; // No Ethernet power pin + eth_clock_mode = 0; // External crystal oscillator + eth_wifi_mode = 1; // default to ethernet break; // case DeviceModel_default: break; diff --git a/src/ESPEasyEth.cpp b/src/ESPEasyEth.cpp index 603e57cff..9313a0cca 100644 --- a/src/ESPEasyEth.cpp +++ b/src/ESPEasyEth.cpp @@ -77,8 +77,8 @@ String ethGetDebugClockModeStr() { String ethGetDebugEthWifiModeStr() { switch (eth_wifi_mode) { - case 0: return F("WIFI"); - case 1: return F("ETHERNET"); + case 0: return F("WiFi"); + case 1: return F("Ethernet"); default: return F("ETH_WIFI_ERR"); } } diff --git a/src/WebServer_HardwarePage.ino b/src/WebServer_HardwarePage.ino index 08f58d052..9913a8078 100644 --- a/src/WebServer_HardwarePage.ino +++ b/src/WebServer_HardwarePage.ino @@ -153,9 +153,9 @@ void handle_hardware() { #ifdef HAS_ETHERNET addFormSubHeader(F("Ethernet")); addRowLabel_tr_id(F("Preferred network medium"), "ethwifi"); - String ethWifiOptions[2] = { F("WIFI"), F("ETHERNET") }; + String ethWifiOptions[2] = { F("WiFi"), F("Ethernet") }; addSelector("ethwifi", 2, ethWifiOptions, NULL, NULL, Settings.ETH_Wifi_Mode, false, true); - addFormNote(F("Change Switch between WIFI and ETHERNET requires reboot to activate")); + addFormNote(F("Change Switch between WiFi and Ethernet requires reboot to activate")); addRowLabel_tr_id(F("Ethernet PHY type"), "ethtype"); String ethPhyTypes[2] = { F("LAN8710"), F("TLK110") }; addSelector("ethtype", 2, ethPhyTypes, NULL, NULL, Settings.ETH_Phy_Type, false, true); diff --git a/src/src/DataStructs/DeviceModel.h b/src/src/DataStructs/DeviceModel.h index 1c89795ef..8dd6b0534 100644 --- a/src/src/DataStructs/DeviceModel.h +++ b/src/src/DataStructs/DeviceModel.h @@ -20,6 +20,7 @@ enum DeviceModel { DeviceModel_Shelly1, DeviceModel_ShellyPLUG_S, DeviceMode_Olimex_ESP32_PoE, + DeviceMode_Olimex_ESP32_EVB, DeviceModel_MAX }; diff --git a/src/src/Helpers/Hardware.cpp b/src/src/Helpers/Hardware.cpp index 580db2415..d3f456975 100644 --- a/src/src/Helpers/Hardware.cpp +++ b/src/src/Helpers/Hardware.cpp @@ -362,7 +362,8 @@ String getDeviceModelBrandString(DeviceModel model) { case DeviceModel_Sonoff_POWr2: return F("Sonoff"); case DeviceModel_Shelly1: case DeviceModel_ShellyPLUG_S: return F("Shelly"); - case DeviceMode_Olimex_ESP32_PoE: return F("Olimex"); + case DeviceMode_Olimex_ESP32_PoE: + case DeviceMode_Olimex_ESP32_EVB: return F("Olimex"); // case DeviceModel_default: default: return ""; @@ -388,6 +389,7 @@ String getDeviceModelString(DeviceModel model) { case DeviceModel_Shelly1: result += '1'; break; case DeviceModel_ShellyPLUG_S: result += F(" PLUG S"); break; case DeviceMode_Olimex_ESP32_PoE: result += F(" ESP32-PoE"); break; + case DeviceMode_Olimex_ESP32_EVB: result += F(" ESP32-EVB"); break; // case DeviceModel_default: default: result += F("default"); @@ -411,7 +413,8 @@ bool modelMatchingFlashSize(DeviceModel model) { case DeviceModel_Sonoff_POWr2: return size_MB == 4; case DeviceModel_Shelly1: case DeviceModel_ShellyPLUG_S: return size_MB == 2; - case DeviceMode_Olimex_ESP32_PoE:return size_MB == 4; + case DeviceMode_Olimex_ESP32_PoE: + case DeviceMode_Olimex_ESP32_EVB:return size_MB == 4; // case DeviceModel_default: default: return true; From 8efff6f0a356258ccafac9df42bf857cbb968855 Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 17:24:26 +0200 Subject: [PATCH 06/11] [ESP32 ETH] Fix JSON when Ethernet is enabled. --- src/WebServer_JSON.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WebServer_JSON.ino b/src/WebServer_JSON.ino index 491e29736..3f07e2516 100644 --- a/src/WebServer_JSON.ino +++ b/src/WebServer_JSON.ino @@ -193,6 +193,7 @@ void handle_json() stream_next_json_object_value(LabelType::ETH_SPEED); stream_next_json_object_value(LabelType::ETH_STATE); stream_last_json_object_value(LabelType::ETH_SPEED_STATE); + addHtml(F(",\n")); } #endif From 80a1998ca225a917f0bae5f0319b9a1611309cfd Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 17:39:44 +0200 Subject: [PATCH 07/11] [Docs] Fix images with .PNG instead of .png extension --- .../{P092_12V_Wiring.PNG => P092_12V_Wiring.png} | Bin .../{P092_24V_Wiring.PNG => P092_24V_Wiring.png} | Bin .../Plugin/{P092_ESR21.PNG => P092_ESR21.png} | Bin ...2_ESR21_Protocol.PNG => P092_ESR21_Protocol.png} | Bin .../Plugin/{P092_UVR31.PNG => P092_UVR31.png} | Bin ...2_UVR31_Protocol.PNG => P092_UVR31_Protocol.png} | Bin 6 files changed, 0 insertions(+), 0 deletions(-) rename docs/source/Plugin/{P092_12V_Wiring.PNG => P092_12V_Wiring.png} (100%) rename docs/source/Plugin/{P092_24V_Wiring.PNG => P092_24V_Wiring.png} (100%) rename docs/source/Plugin/{P092_ESR21.PNG => P092_ESR21.png} (100%) rename docs/source/Plugin/{P092_ESR21_Protocol.PNG => P092_ESR21_Protocol.png} (100%) rename docs/source/Plugin/{P092_UVR31.PNG => P092_UVR31.png} (100%) rename docs/source/Plugin/{P092_UVR31_Protocol.PNG => P092_UVR31_Protocol.png} (100%) diff --git a/docs/source/Plugin/P092_12V_Wiring.PNG b/docs/source/Plugin/P092_12V_Wiring.png similarity index 100% rename from docs/source/Plugin/P092_12V_Wiring.PNG rename to docs/source/Plugin/P092_12V_Wiring.png diff --git a/docs/source/Plugin/P092_24V_Wiring.PNG b/docs/source/Plugin/P092_24V_Wiring.png similarity index 100% rename from docs/source/Plugin/P092_24V_Wiring.PNG rename to docs/source/Plugin/P092_24V_Wiring.png diff --git a/docs/source/Plugin/P092_ESR21.PNG b/docs/source/Plugin/P092_ESR21.png similarity index 100% rename from docs/source/Plugin/P092_ESR21.PNG rename to docs/source/Plugin/P092_ESR21.png diff --git a/docs/source/Plugin/P092_ESR21_Protocol.PNG b/docs/source/Plugin/P092_ESR21_Protocol.png similarity index 100% rename from docs/source/Plugin/P092_ESR21_Protocol.PNG rename to docs/source/Plugin/P092_ESR21_Protocol.png diff --git a/docs/source/Plugin/P092_UVR31.PNG b/docs/source/Plugin/P092_UVR31.png similarity index 100% rename from docs/source/Plugin/P092_UVR31.PNG rename to docs/source/Plugin/P092_UVR31.png diff --git a/docs/source/Plugin/P092_UVR31_Protocol.PNG b/docs/source/Plugin/P092_UVR31_Protocol.png similarity index 100% rename from docs/source/Plugin/P092_UVR31_Protocol.PNG rename to docs/source/Plugin/P092_UVR31_Protocol.png From fc8b54d8dbd5adb6655fdceda2c37893c0244b58 Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 17:40:33 +0200 Subject: [PATCH 08/11] [Sphinx docs] Change deprecated add_stylesheet to add_css_file --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 65765622e..5824e78bf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -287,7 +287,7 @@ todo_include_todos = True # This def is used to add ESP Easy related formatation (color etc). def setup(app): - app.add_stylesheet('css/custom.css') + app.add_css_file('css/custom.css') # To replace chunks of text globally + # ESP Easy colors (set in cutom.css) From c027c7f11e4041c5a9ccfc9352e07efd65369091 Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Sat, 22 Aug 2020 18:05:12 +0200 Subject: [PATCH 09/11] [Docs] Updated DL-bus documentation as it was hard to find Plus fixed some Sphinx errors. --- docs/source/Plugin/P092.rst | 8 +++++++ docs/source/Plugin/P092_DLbus.rst | 33 +++++++++++++++++------------ docs/source/Plugin/P092_ESR21.rst | 8 ++++--- docs/source/Plugin/P092_UVR1611.rst | 8 ++++--- docs/source/Plugin/P092_UVR31.rst | 7 +++--- docs/source/Plugin/P092_UVR61-3.rst | 11 ++++++---- 6 files changed, 49 insertions(+), 26 deletions(-) diff --git a/docs/source/Plugin/P092.rst b/docs/source/Plugin/P092.rst index 1b87fd993..e2eedac43 100644 --- a/docs/source/Plugin/P092.rst +++ b/docs/source/Plugin/P092.rst @@ -21,11 +21,19 @@ Maintainer: |P092_maintainer| Used libraries: |P092_usedlibraries| +.. include:: P092_DLbus.rst + Supported hardware ------------------ |P092_usedby| +* :ref:`P092_ESR21_page` Simple Solar Control. +* :ref:`P092_UVR31_page` single-circuit universal control system. +* :ref:`P092_UVR61-3_page` three-circuit universal control system. +* :ref:`P092_UVR1611_page` freely programmable universal control system. + + Change log ---------- diff --git a/docs/source/Plugin/P092_DLbus.rst b/docs/source/Plugin/P092_DLbus.rst index 232419bd1..be3e341ca 100644 --- a/docs/source/Plugin/P092_DLbus.rst +++ b/docs/source/Plugin/P092_DLbus.rst @@ -1,25 +1,20 @@ -.. include:: ../Plugin/_plugin_substitutions_p09x.repl -.. _P092_DLbus_page: - -DL bus -====== - -|P092_typename| -|P092_status| - Introduction ------------ The DL-Bus is used in control units e.g. sold by `Technische Alternative `_. + The DL-Bus serves as a bus line for various external sensors and modules. + The DL-Bus is a bidirectional data line and only compatible with products of Technische Alternative. The data transmission looks as follows: - * In an infinite loop, a logging data frame is created by the control one after the others on the data line. + +* In an infinite loop, a logging data frame is created by the control one after the others on the data line. Up to 4 sensor measured value queries (master/slave) can be made between the individual logging data frames on the DL bus. - * So that the beginning of a data frame can be detected, a SYNC of 16 high bits is sent before the first data byte. - * The data transmission is carried out as Manchester code (EXOR linked) with a display clock of 50 or 488Hz (depending on control type). + +* So that the beginning of a data frame can be detected, a SYNC of 16 high bits is sent before the first data byte. +* The data transmission is carried out as Manchester code (EXOR linked) with a display clock of 50 or 488Hz (depending on control type). This is necessary to ensure the supply voltage of the logger and DL sensors from the data signal. If the receiver is synchronized to the display clock, the correct bit value appears always during the second half period of the data bit (inverted in the first half period). @@ -27,24 +22,36 @@ If the receiver is synchronized to the display clock, the correct bit value appe Wiring ------ -The DL-Bus consists of 2 wires: DL and GND (sensor ground). +The DL-Bus consists of 2 wires: + +* DL +* GND (sensor ground). + The power supply for the DL-Bus sensors is supplied via the DL-Bus itself. + Some DL-Bus devices can/must be powered via a 12V source, e.g. that of the CAN bus (this is explicitly noted in the operating manual of that sensor). + The cable routing can be star-shaped or serial (from one device to the next). + Any cable with a cross-section of 0.75 mm2 up to a maximum length of 30 m can be used as a data cable. + Over 30 m, the use of shielded cables is recommended, which increases the permissible length of the cable to 100 m. Protocol -------- Transmission of a data byte + .. image:: P092_DL_bus_databyte.png Transmission of a data frame + .. image:: P092_DL_bus_dataframe.png Data frame on the DL bus + .. image:: P092_DL_bus_dataframelog.png Display clock + .. image:: P092_DL_bus_displayclock.png diff --git a/docs/source/Plugin/P092_ESR21.rst b/docs/source/Plugin/P092_ESR21.rst index ba2af9a8c..892f0857b 100644 --- a/docs/source/Plugin/P092_ESR21.rst +++ b/docs/source/Plugin/P092_ESR21.rst @@ -11,11 +11,13 @@ Introduction ------------ The ESR21 unit is a simple solar control. + The ESR21 unit is a differential control that can be used in many ways -The DL bus runs at 12 volts. -The data frame consist of 30 bytes (excluding sync and CRC). -The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 0.67 seconds. +* The DL bus runs at 12 volts. +* The data frame consist of 30 bytes (excluding sync and CRC). +* The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 0.67 seconds. + .. image:: P092_ESR21.png Wiring diff --git a/docs/source/Plugin/P092_UVR1611.rst b/docs/source/Plugin/P092_UVR1611.rst index efd456823..55e97d827 100644 --- a/docs/source/Plugin/P092_UVR1611.rst +++ b/docs/source/Plugin/P092_UVR1611.rst @@ -11,11 +11,13 @@ Introduction ------------ The UVR1611 unit is a freely programmable universal control system. + The UVR1611 universal controller can be freely programmed using function modules to match any system configuration for heating room management. -The DL bus runs at 12 volts. -The data frame consist of 63 bytes (excluding sync and CRC). -The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 1.4 seconds. +* The DL bus runs at 12 volts. +* The data frame consist of 63 bytes (excluding sync and CRC). +* The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 1.4 seconds. + .. image:: P092_UVR1611.png Wiring diff --git a/docs/source/Plugin/P092_UVR31.rst b/docs/source/Plugin/P092_UVR31.rst index b7748a8f7..1420df697 100644 --- a/docs/source/Plugin/P092_UVR31.rst +++ b/docs/source/Plugin/P092_UVR31.rst @@ -13,9 +13,10 @@ Introduction The UVR31 unit is a single-circuit universal control system. The UVR31 unit is designed for simple solar installations and heating systems (storage charging, domestic hot water preparation) -The DL bus runs at 24 volts. -The data frame consist of 8 bytes (excluding sync). -The data are transmitted @ 50Hz, therefore the transmission of one data set takes about 1.92 seconds. +* The DL bus runs at 24 volts. +* The data frame consist of 8 bytes (excluding sync). +* The data are transmitted @ 50Hz, therefore the transmission of one data set takes about 1.92 seconds. + .. image:: P092_UVR31.png Wiring diff --git a/docs/source/Plugin/P092_UVR61-3.rst b/docs/source/Plugin/P092_UVR61-3.rst index 1995671ac..e450878a6 100644 --- a/docs/source/Plugin/P092_UVR61-3.rst +++ b/docs/source/Plugin/P092_UVR61-3.rst @@ -11,12 +11,15 @@ Introduction ------------ The UVR61-3 unit is a three-circuit universal control system. + The UVR61-3 unit is designed for an energy-saving and cost-effective drying of cellars and other parts of buildings by means of fan control. + The UVR61-3 three-circuit controllers has various thermostat, differential temperature and speed control functions for use in solar and heating systems, too. -The DL bus runs at 12 volts. -The data frame consist of 34 bytes (excluding sync and CRC). -The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 0.8 seconds. +* The DL bus runs at 12 volts. +* The data frame consist of 34 bytes (excluding sync and CRC). +* The data are transmitted @ 488Hz, therefore the transmission of one data set takes about 0.8 seconds. + .. image:: P092_UVR61-3.png Wiring @@ -73,4 +76,4 @@ Data acquisition * **Send to controller** 1..3: Check which controller (if any) you want to publish to. All or no controller can be used. * **Interval**: How often should the task publish its value (10..60 seconds is normal). -.. note:: Intervall not less than **10 seconds**! The reading of the DL bus happens twice per intervall. +.. note:: Interval not less than **10 seconds**! The reading of the DL bus happens twice per intervall. From a16cf58efc6c004d2029357678eeb34bd1c453da Mon Sep 17 00:00:00 2001 From: TD-er Date: Sun, 23 Aug 2020 13:53:28 +0200 Subject: [PATCH 10/11] Fix build issue for P094 CUL reader --- src/src/PluginStructs/P094_data_struct.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/src/PluginStructs/P094_data_struct.cpp b/src/src/PluginStructs/P094_data_struct.cpp index a055635be..42310eda3 100644 --- a/src/src/PluginStructs/P094_data_struct.cpp +++ b/src/src/PluginStructs/P094_data_struct.cpp @@ -3,6 +3,7 @@ #ifdef USES_P094 +#include "../Helpers/StringConverter.h" P094_data_struct::P094_data_struct() : easySerial(nullptr) {} From ad4d6fb86dbfb59ba09c77bd583c3c96b13150b3 Mon Sep 17 00:00:00 2001 From: TD-er Date: Mon, 24 Aug 2020 10:40:13 +0200 Subject: [PATCH 11/11] Fix C002 Domoticz dimmer switch set value (#3230) Fixes: #3230 --- src/_C002.ino | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/_C002.ino b/src/_C002.ino index 510804b85..09f00a2ee 100644 --- a/src/_C002.ino +++ b/src/_C002.ino @@ -122,14 +122,12 @@ bool CPlugin_002(CPlugin::Function function, struct EventStruct *event, String& switch ((int)nvalue) { - case 0: + case 0: // Off pwmValue = 0; UserVar[baseVar] = pwmValue; break; - case 1: - pwmValue = UserVar[baseVar]; - break; - case 2: + case 1: // On + case 2: // Update dimmer value pwmValue = 10 * atol(svalue1); UserVar[baseVar] = pwmValue; break;