Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into feature/I2C-multiple-interfaces-support

This commit is contained in:
Ton Huisman
2025-03-15 14:49:45 +01:00
45 changed files with 926 additions and 125 deletions
+14 -6
View File
@@ -121,29 +121,37 @@ OTA | Arduino OTA (Over The Air) update feature enabled
Domoticz | Only Domoticz controllers (HTTP) and plugins included |
Domoticz_MQTT | Only Domoticz controllers (MQTT) and plugins included |
FHEM_HA | Only FHEM/OpenHAB/Home Assistant (MQTT) controllers and plugins included |
ETH | Ethernet interface enabled (ESP32-classic and IDF 5.x based builds) |
ETH | Ethernet support enabled (ESP32 and IDF 5.x based builds) |
OPI_PSRAM | Specific configuration to enable PSRAM detection, ESP32-S3 only |
CDC | Support USBCDC/HWCDC-serial console on ESP32-C3, ESP32-S2, ESP32-S3 and ESP32-C6 |
noOTA/NO_OTA | Does not support OTA (Over The Air-updating of the firmware) Use [the flash page](https://td-er.nl/ESPEasy/) or ESPTool via USB Serial |
N.B. Starting ca. 2025/02/27, many ESP32 builds are *only* available with _ETH suffix, indicating that Ethernet support is enabled, to reduce the (rather high) number of builds.
Some example firmware names:
Firmware name | Hardware | Included plugins |
----------------------------------------------------------------------|-------------------------------------------------|----------------------------------|
ESPEasy_mega-20230822_normal_ESP8266_1M.bin | ESP8266/ESP8285 with 1MB flash | Stable |
ESPEasy_mega-20230822_normal_ESP8266_4M1M.bin | ESP8266 with 4MB flash | Stable |
ESPEasy_mega-20230822_collection_A_ESP8266_4M1M.bin | ESP8266 with 4MB flash | Stable + Collection base + set A |
ESPEasy_mega-20230822_normal_ESP32_4M316k.bin | ESP32 with 4MB flash | Stable |
ESPEasy_mega-20230822_collection_A_ESP32_4M316k.bin | ESP32 with 4MB flash | Stable + Collection base + set A |
ESPEasy_mega-20230822_collection_B_ESP32_4M316k.bin | ESP32 with 4MB flash | Stable + Collection base + set B |
ESPEasy_mega-20230822_normal_ESP32_4M316k_ETH.bin | ESP32 with 4MB flash | Stable |
ESPEasy_mega-20230822_collection_A_ESP32_4M316k_ETH.bin | ESP32 with 4MB flash | Stable + Collection base + set A |
ESPEasy_mega-20230822_collection_B_ESP32_4M316k_ETH.bin | ESP32 with 4MB flash | Stable + Collection base + set B |
ESPEasy_mega-20230822_max_ESP32s3_8M1M_LittleFS_CDC_ETH.bin | ESP32-S3 with 8MB flash, CDC-serial, Ethernet | All available plugins |
ESPEasy_mega-20230822_max_ESP32s3_8M1M_LittleFS_OPI_PSRAM_CDC_ETH.bin | ESP32-S3 8MB flash, PSRAM, CDC-serial, Ethernet | All available plugins |
ESPEasy_mega-20230822_max_ESP32_16M1M.bin | ESP32 with 16MB flash | All available plugins |
ESPEasy_mega-20230822_max_ESP32_16M8M_LittleFS_ETH.bin | ESP32 with 16MB flash, Ethernet | All available plugins |
ESPEasy_mega-20230822_max_ESP32_16M1M_ETH.bin | ESP32 with 16MB flash, SPIFFS, Ethernet | All available plugins |
ESPEasy_mega-20230822_max_ESP32_16M8M_LittleFS_ETH.bin | ESP32 with 16MB flash, LittleFS, Ethernet | All available plugins |
The binary files for the different ESP32 variants (S2, C3, S3, C2, C6, Solo1, 'Classic') are available in separate archives.
To see what plugins are included in which collection set, you can find that on the [ESPEasy Plugin overview page](https://espeasy.readthedocs.io/en/latest/Plugin/_Plugin.html)
For ESP32 builds (all models) there are 2 ``.bin`` files available:
1) a ``.factory.bin`` to be used when flashing the firmware via external tools, like the Espressif Flash Download tool, to be loaded at address ``0x0``, that includes the bootloader and flash-partitioning data. This is the second of 2 recommended methods to install ESPEasy on a new device.<BR/>
The main recommended method for flashing ESPEasy onto a (new) device is via [this flash page](https://td-er.nl/ESPEasy/) (using Chrome or Edge webbrowser), where you connect the device via USB-serial, and select what firmware-build to install.
2) a 'regular' ``.bin`` file, that can be used to update a running board via OTA (Over The Air), using the Update Firmware button on the Tools page. The .bin file then has to be available for the device the webbrowser is running from (local or via a network), as the file is uploaded via the webbrowser.<BR/>
The firmware to upload via OTA must match both the ESP32 model, and current partitioning & formatting, LittleFS as indicated in the name, or SPIFFS.
## Documentation & more info
Our new, in-depth documentation can be found at [ESPEasy.readthedocs.io](https://espeasy.readthedocs.io/en/latest/). Automatically built, so always up-to-date according to the contributed contents. The old Wiki documentation can be found at [letscontrolit.com/wiki](https://www.letscontrolit.com/wiki/index.php?title=ESPEasy).
+37
View File
@@ -0,0 +1,37 @@
{
"build": {
"arduino":{
"ldscript": "esp32c3_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_TASMOTA -DARDUINO_USB_MODE=1 -DESP32_16M -DESP32C3 -DUSE_USB_CDC_CONSOLE -DARDUINO_USB_CDC_ON_BOOT=1",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"mcu": "esp32c3",
"variant": "esp32c3",
"partitions": "boards/partitions/esp32_partition_app4096k_spiffs8124k.csv"
},
"connectivity": [
"wifi",
"bluetooth"
],
"debug": {
"openocd_target": "esp32c3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32-C3 USB CDC 16M Flash, ESPEasy 4096k Code/OTA 8M FS",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"before_reset": "usb_reset",
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
"vendor": "Espressif"
}
+1 -1
View File
@@ -36,7 +36,7 @@
"espidf",
"arduino"
],
"name": "Espressif Generic ESP32-S3 USB CDC 16M Flash OPI PSRAM, ESPEasy 4096k Code/OTA 1088k FS",
"name": "Espressif Generic ESP32-S3 USB CDC 16M Flash OPI PSRAM, ESPEasy 4096k Code/OTA 8124k FS",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
+48
View File
@@ -28,6 +28,46 @@ Description
The module supports upto four 32-bit counters, of which 2 are with external trigger (A and B).
Configuration
-------------
.. image:: P100_DeviceConfiguration.png
* **Name**: Required by ESPEasy, must be unique among the list of available devices/tasks.
* **Enabled**: The device can be disabled or enabled. When not enabled the device should not use any resources.
Sensor
^^^^^^
* **GPIO <-> 1-Wire**: Select the GPIO pin the counter is connected to. Once this is set the next section will be available for configuration.
Device Settings
^^^^^^^^^^^^^^^
* **Device Address**: When 1 or more counters are connected to the unit, a counter can be selected based on the counter device address. (Multiple devices can be connected to the same GPIO pin.)
* **Counter**: Select either counter **A** or counter **B**, for each counter a separate task has to be configured, if you have wired both the **A** and **B** counter to a counter source.
* **Show CountTotal Value**: When checked, and the settings saved, the ``CountTotal`` value will also be shown, and sent to Controllers if so configured. The ``CountTotal`` value is available, wether this option is enabled or not (see below: **Get Config Values**).
.. image:: P100_CountTotalEnabled.png
Data Acquisition
^^^^^^^^^^^^^^^^
This group of settings, **Single event with all values** and **Send to Controller** settings are standard available configuration items. Send to Controller is only visible when one or more Controllers are configured.
* **Interval** By default, Interval will be set to 60 sec. The data will be collected and optionally sent to any configured controllers using this interval. When an output value is changed, the data will be sent to any configured controller, and an event will also be generated when the Rules are enabled (Tools/Advanced).
Values
^^^^^^
The plugin provides the ``CountDelta`` value, that will hold the delta compared to the previous read value, and optionally also the ``CountTotal`` value. This delta depends on the **Interval** value, as waiting longer for a new value will probably increase the counted difference. A formula can be set to recalculate. The number of decimals can be set as desired, though for a count that doesn't make much sense.
Per Value is a **Stats** checkbox available, that when checked, gathers the data and presents recent data in a graph, as described here: :ref:`Task Value Statistics: <Task Value Statistics>`
.. Events
@@ -36,6 +76,12 @@ The module supports upto four 32-bit counters, of which 2 are with external trig
.. .. include:: P100_events.repl
Get Config Values
^^^^^^^^^^^^^^^^^
.. include:: P100_config_values.repl
Change log
----------
@@ -43,4 +89,6 @@ Change log
.. versionchanged:: 2.0
...
|changed| 2025-03-15 Add CountTotal value, and enable PluginStats feature.
|added| 2020-04-25
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

@@ -0,0 +1,10 @@
.. csv-table::
:header: "Config value", "Information"
:widths: 20, 30
"
``[<taskname>#CounterTotal]``
","
Returns the current total count accumulated for the selected **A** or **B** counter since power-on of the sensor.
"
+28 -15
View File
@@ -28,7 +28,7 @@ The ST7735, ST7789 and ST7796 chip families drive color TFT displays in various
This plugin supports these display models:
* **ST7735** with resolutions 128 x 128, 128 x 160, 80 x 160 and 135 x 240 pixels
* **ST7735** with resolutions 128 x 128, 128 x 160, 80 x 160, 135 x 240 and 172 x 320 pixels
* **ST7789** with resolutions 240 x 320, 240 x 240, 240 x 280 and 135 x 240 pixels
* **ST7796** with resolution of 320 x 480 pixels.
@@ -129,6 +129,9 @@ Actuator
* **Display button** A GPIO pin can be configured to wake the display on demand. This, combined with the **Display Timeout** setting, can preserve the lifetime of the display, and save some power.
* **Inversed Logic** When checked, reverses the pin-state action of the **Display button** gpio. This allows an external circuit, f.e. an IR sensor, that may provide a *high* signal when activated, to wake the display.
* **Display Timeout** Select the timeout in seconds to turn off the display after the last update or wake-up. Only used if the **Display button** is *also* configured.
|
* **TFT Display model** Select the hardware model that is connected. Currently there are only preset resolutions available.
Available options:
@@ -136,16 +139,20 @@ Available options:
.. image:: P116_TFTDisplayModelOptions.png
:alt: TFT Display model options
* *ST7735 128 x 128px* Allows about 12 lines of text in the smallest font scaling setting (the 13th line will be distorted, as the bottom 2 pixellines aren't available)
* *ST7735 128 x 160px* Allows 16 lines of text in the smallest font scaling setting.
* *ST7735 80 x 160px* Allows 16 lines of text in the smallest font scaling setting.
* *ST7735 80 x 160px (Color inverted)* Special color inverted configuration as used in f.e. M5Stack StickC.
* *ST7735 135 x 240px* Added to support a revision of the TTGO T-Display 16MB Flash module, that won't work with the ST7789 driver, the seller is claiming to use, but does work with this specially crafted ST7735 driver.
* *ST7789 240 x 320px* Allows 32 lines of text in the smallest font scaling setting. Predefined text only goes to 24, extra lines can be displayed from rules or external commands.
* *ST7789 240 x 240px* Allows 24 lines of text in the smallest font scaling setting.
* *ST7789 240 x 280px* Allows 28 lines of text in the smallest font scaling setting. Predefined text only goes to 24, extra lines can be displayed from rules or external commands.
* *ST7789 135 x 240px* Allows about 13 lines of text in the smallest font scaling setting (the 14th line may be distorted because of a lack of pixellines).
* *ST7796 320 x 480px* Allows 32 or 48 lines of text in the smallest font scaling setting.
* *ST7735 128 x 128px*: Allows about 12 lines of text in the smallest font scaling setting (the 13th line will be distorted, as the bottom 2 pixellines aren't available)
* *ST7735 128 x 160px*: Allows 16 lines of text in the smallest font scaling setting.
* *ST7735 80 x 160px*{ Allows 16 lines of text in the smallest font scaling setting.
* *ST7735 80 x 160px (Color inverted)*: Special color inverted configuration as used in f.e. M5Stack StickC.
* *ST7735 135 x 240px*: Added to support a revision of the TTGO T-Display 16MB Flash module, that won't work with the ST7789 driver, the seller is claiming to use, but does work with this specially crafted ST7735 driver.
* *ST7735 172 x 320px*: Added to support an ESP32-C6 module having a display with this specific resolution.
* *ST7789 240 x 320px*: Allows 32 lines of text in the smallest font scaling setting. Predefined text only goes to 24, extra lines can be displayed from rules or external commands.
* *ST7789 240 x 240px*: Allows 24 lines of text in the smallest font scaling setting.
* *ST7789 240 x 280px*: Allows 28 lines of text in the smallest font scaling setting. Predefined text only goes to 24, extra lines can be displayed from rules or external commands.
* *ST7789 135 x 240px*: Allows about 13 lines of text in the smallest font scaling setting (the 14th line may be distorted because of a lack of pixellines).
* *ST7789 135 x 240px (alt1)*: Alternative initialization sequence 1, these alternatives can be tried if the regular 135 x 240px configuration doesn't work, and also the ST7735 135 x 240px configuration won't give the desired result.
* *ST7789 135 x 240px (alt2)*: Alternative initialization sequence 2.
* *ST7789 135 x 240px (alt3)*: Alternative initialization sequence 3.
* *ST7796 320 x 480px*: Allows 32 or 48 lines of text in the smallest font scaling setting.
Layout
^^^^^^^^
@@ -166,11 +173,17 @@ Available options:
.. image:: P116_TextPrintModeOptions.png
:alt: Text print mode
* *Continue to next line* Simply 'prints' all text to the display, with automatic overflow to the next line(s) if the text doesn't fit on the current line.
* *Truncate exceeding message* Display the provided message, but any excess at the right border of the display is discarded.
* *Clear then truncate exceeding message* Clear from the current cursor position to the end of the display, then display the provided message, but any excess at the right border of the display is discarded.
* *Continue to next line*: Simply 'prints' all text to the display, with automatic overflow to the next line(s) if the text doesn't fit on the current line.
* *Truncate exceeding message (default)*: Display the provided message, but any excess at the right border of the display is discarded.
* *Clear then truncate exceeding message*: Clear from the current cursor position to the end of the display, then display the provided message, but any excess at the right border of the display is discarded.
* *Truncate, center if maxWidth set*: Like *Truncate exceeding message*, and will also center the content horizontally if a max. width argument is given with the ``txtfull`` subcommand.
Default setting is *Truncate exceeding message*.
|
* **Default font**: If fonts are available in the build (excluded from some builds because of .bin size issues), the default font at initialization can be selected. The names/numbers that can be used in the ``<trigger>,font,<fontname|fontnr>`` are shown in the combobox, and documented below in the **AdafruitGFX_Helper** documentation. The font numbers aren't consecutive if all fonts aren't included, to keep them consistent across builds.
.. image:: P116_DefaultFontOptions.png
:alt: Default font
* **Font scaling** The scaling factor for the currently active font. Select a factor between 1 and 10.
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 30 KiB

+92
View File
@@ -0,0 +1,92 @@
.. include:: ../Plugin/_plugin_substitutions_p17x.repl
.. _P177_page:
|P177_typename|
==================================================
|P177_shortinfo|
Plugin details
--------------
Type: |P177_type|
Name: |P177_name|
Status: |P177_status|
GitHub: |P177_github|_
Maintainer: |P177_maintainer|
Used libraries: |P177_usedlibraries|
Description
-----------
The XDB401 I2C Pressure and Temperature sensor is available in many configurations, with regard to the max. allowed pressure. It is placed in the Environment (Climate) category, as it can be used as a barometric pressure device. The Temperature measured is the device-temperature, so this could be taken into account when using the value.
Data is measured every 0.5 second, as for each measurement the sensor needs some time (~0.1 sec.) to get a reliable result.
Configuration
-------------
.. image:: P177_DeviceConfiguration.png
* **Name**: Required by ESPEasy, must be unique among the list of available devices/tasks.
* **Enabled**: The device can be disabled or enabled. When not enabled the device should not use any resources.
I2C options
^^^^^^^^^^^
The available I2C settings here depend on the build used. At least the **Force Slow I2C speed** option is available. This sensor can also be used with an I2C Multiplexer, as the (fixed) device address is ``0x7F`` to allow for multiple sensors on a single ESP. For details see the :ref:`Hardware_page`.
Device Settings
^^^^^^^^^^^^^^^
* **Temperature offset**: An offset from the current temperature can be applied in 0.1°C steps. The offset can be set here.
* **Sensor Full-scale Pressure**: This scaling factor determines the Unit of measure available in the Pressure variable. It should be set to the max. range of the device in use for the desired Unit of measure. No presets here, because of the many different full-range options available, that can be 'converted' to any required UoM.
* **Generate events on Pressure change**: When checked will generate the standard events as soon as a pressure difference is measured. This allows the **Interval** to be set to 0, and only on pressure changes the data will be published.
* **Ignore negative pressure values**: When checked, any negative pressure value will be reported as 0.
* **Use raw data from sensor**: When checked, no **Temperature offset** and **Sensor Full-scale Pressure** factor will be applied to the measured data. Is mostly useful for testing or when calibrating the sensor. Should probably be unchecked during normal operation.
Data Acquisition
^^^^^^^^^^^^^^^^
This group of settings, **Single event with all values** and **Send to Controller** settings are standard available configuration items. Send to Controller is only visible when one or more Controllers are configured.
* **Interval** Interval is optional, and will be set to 0 sec. The data will be collected and optionally sent to any configured controllers using this interval. When **Generate events on Pressure change** is enabled, this can be kept on 0, to only send out data when something changes.
Values
^^^^^^
The plugin provides the ``Temperature`` and ``Pressure`` values. A formula can be set to recalculate, f.e. when temperature has to be presented in ° Fahrenheit instead of ° Celcius: ``%c_c2f%(%value%)``. The number of decimals can be set as desired, and defaults to 2.
In selected builds, per Value **Stats** options are available, that when enabled, will gather the measured data and present most recent data in a graph, as described here: :ref:`Task Value Statistics: <Task Value Statistics>`
.. Commands available
.. ^^^^^^^^^^^^^^^^^^
.. .. include:: P177_commands.repl
.. Get Config Values
.. ^^^^^^^^^^^^^^^^^
.. Get Config Values retrieves values or settings from the sensor or plugin, and can be used in Rules, Display plugins, Formula's etc. The square brackets **are** part of the variable. Replace ``<taskname>`` by the **Name** of the task.
.. .. include:: P177_config_values.repl
Change log
----------
.. versionchanged:: 2.0
...
|added|
2025-03-08 Initial release version.
Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

+1
View File
@@ -403,6 +403,7 @@ There are different released versions of ESP Easy:
":ref:`P173_page`","|P173_status|","P173"
":ref:`P175_page`","|P175_status|","P175"
":ref:`P176_page`","|P176_status|","P176"
":ref:`P177_page`","|P177_status|","P177"
":ref:`P178_page`","|P178_status|","P178"
+1 -1
View File
@@ -8,7 +8,7 @@
.. |Plugin_Energy_AC| replace:: :ref:`P076_page`, :ref:`P077_page`, :ref:`P078_page`, :ref:`P102_page`, :ref:`P108_page`
.. |Plugin_Energy_DC| replace:: :ref:`P027_page`, :ref:`P085_page`, :ref:`P115_page`, :ref:`P132_page`
.. |Plugin_Energy_Heat| replace:: :ref:`P088_page`, :ref:`P093_page`
.. |Plugin_Environment| replace:: :ref:`P004_page`, :ref:`P005_page`, :ref:`P006_page`, :ref:`P014_page`, :ref:`P024_page`, :ref:`P028_page`, :ref:`P030_page`, :ref:`P031_page`, :ref:`P032_page`, :ref:`P034_page`, :ref:`P039_page`, :ref:`P047_page`, :ref:`P051_page`, :ref:`P068_page`, :ref:`P069_page`, :ref:`P072_page`, :ref:`P103_page`, :ref:`P105_page`, :ref:`P106_page`, :ref:`P122_page`, :ref:`P150_page`, :ref:`P151_page`, :ref:`P153_page`, :ref:`P154_page`, :ref:`P163_page`, :ref:`P167_page`, :ref:`P169_page`, :ref:`P172_page`, :ref:`P173_page`
.. |Plugin_Environment| replace:: :ref:`P004_page`, :ref:`P005_page`, :ref:`P006_page`, :ref:`P014_page`, :ref:`P024_page`, :ref:`P028_page`, :ref:`P030_page`, :ref:`P031_page`, :ref:`P032_page`, :ref:`P034_page`, :ref:`P039_page`, :ref:`P047_page`, :ref:`P051_page`, :ref:`P068_page`, :ref:`P069_page`, :ref:`P072_page`, :ref:`P103_page`, :ref:`P105_page`, :ref:`P106_page`, :ref:`P122_page`, :ref:`P150_page`, :ref:`P151_page`, :ref:`P153_page`, :ref:`P154_page`, :ref:`P163_page`, :ref:`P167_page`, :ref:`P169_page`, :ref:`P172_page`, :ref:`P173_page`, :ref:`P177_page`
.. |Plugin_Extra_IO| replace:: :ref:`P011_page`, :ref:`P022_page`, :ref:`P178_page`
.. |Plugin_Gases| replace:: :ref:`P049_page`, :ref:`P052_page`, :ref:`P083_page`, :ref:`P090_page`, :ref:`P117_page`, :ref:`P127_page`, :ref:`P135_page`, :ref:`P145_page`, :ref:`P147_page`, :ref:`P164_page`
.. |Plugin_Generic| replace:: :ref:`P003_page`, :ref:`P026_page`, :ref:`P033_page`, :ref:`P037_page`, :ref:`P081_page`, :ref:`P100_page`, :ref:`P146_page`
@@ -63,6 +63,19 @@
.. |P176_compileinfo| replace:: `.`
.. |P176_usedlibraries| replace:: `.`
.. |P177_name| replace:: :cyan:`XDB401 I2C Pressure`
.. |P177_type| replace:: :cyan:`Environment`
.. |P177_typename| replace:: :cyan:`Environment - XDB401 I2C Pressure`
.. |P177_porttype| replace:: `.`
.. |P177_status| replace:: :yellow:`COLLECTION G` :yellow:`CLIMATE`
.. |P177_github| replace:: P177_XDB_pressure.ino
.. _P177_github: https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P177_XDB_pressure.ino
.. |P177_usedby| replace:: `.`
.. |P177_shortinfo| replace:: `XDB401 I2C Pressure and Temperature sensor`
.. |P177_maintainer| replace:: `tonhuisman`
.. |P177_compileinfo| replace:: `.`
.. |P177_usedlibraries| replace:: `.`
.. |P178_name| replace:: :cyan:`LU9685 Servo controller`
.. |P178_type| replace:: :cyan:`Extra IO`
.. |P178_typename| replace:: :cyan:`Extra IO - LU9685 Servo controller`
+45
View File
@@ -1016,6 +1016,51 @@ Firmware update
Via the :cyan:`Update Firmware` button, you can browse for an updated firmware, downloaded from the Releases page, an Actions run, or self-built, and install that. When using the same flash configuration (``4M1M``, ``4M316k``, ``8M1M``, etc.) and file system type (SPIFFS v.s. LittleFS) all settings will be preserved. When uncertain, the configuration should be saved first, using either the Save (or Backup files if available) button above.
Migrate from SPIFFS to LittleFS (ESP32)
=======================================
Since IDF 5.x framework (ESP32 chips only), the SPIFFS file-system is no longer supported. As ESPEasy is using a specially crafted framework-release that still includes SPIFFS support, we still have support for SPIFFS, but this requires quite some effort. To reduce that effort, and because SPIFFS won't be made available after IDF 5.1.x for ESPEasy, it is strongly advised to migrate to a LittleFS build.
NB: A build can not have support for both SPIFFS *and* LittleFS. (Technical limitation.)
Using the 4 steps below, a safe (and easy) migration path is available:
1) Upgrade to the latest release
--------------------------------
For the best experience, and to ensure a stable running system, a very recent release of ESPEasy should be used. This can be downloaded from the `Github Releases page <https://github.com/letscontrolit/ESPEasy/releases>`_
Releases that no longer include SPIFFS support will be clearly marked.
In the previous paragraph is shown how to select the correct binary for upgrading. After a successful upgrade, the ESP will be rebooted, and should be left running for *at least* 5 minutes to ensure that the WiFi configuration is stored in the NVS (non-volatile storage) partiton of the flash (this is a background process, activated ~5 minutes after a successful connection to WiFI), so this can be used to reconnect to WiFi after upgrading to a LittleFS build.
2) Backup the current configuration and file-system content
-----------------------------------------------------------
As all ESP32 builds include support for creating a .tar archive backup, this feature should now be used to create an up-to-date system backup, by using the :cyan:`Backup files` button (as opposed to the :cyan:`Save` button that only stores the configuration files), and storing the archive on a persistent storage medium (local disk, USB stick, network storage, etc.).
NB: Depending on the browser used, it may be needed to confirm that the created archive should *really* be stored, so don't forget to confirm that!
3) Upgrade to the matching LittleFS release
-------------------------------------------
After the backup is created, the matching release with LittleFS support cna be downloaded from the `Github Releases page <https://github.com/letscontrolit/ESPEasy/releases>`_ (If your build is not (yet) included, then please request it via a support issue.)
As long as the flash partitioning is the same (``4M316k``, ``8M1M`` etc.) the upgrade can be done via OTA. If the partitioning is different, either the `ESPEasy Web Flash tool <https://td-er.nl/ESPEasy/>`_ or the Espressif Flash Download tool should be used to install the update (flash partitioning can not be changed via an OTA update).
Once the new binary is installed, and the ESP rebooted, the unit should automatically connect to WiFi, as it has the last used credentials stored in the NVS partition. Might that fail, the initial setup via the Setup portal should be started.
4) Restore the backup
---------------------
Now that the unit is available via WiFi again, the backup we created in step **2)** can be restored so alle previously configured devices, controllers, rules, settings, etc. are available again.
From the Tools page, select the :cyan:`Load` button, and browse to the location of the backup .tar file to select it. After the restore is finished, the unit **must** be rebooted immediately (a :cyan:`Reboot` button is available), so the freshly restored settings won't be overwritten by any settings kept in memory.
When these steps are completed, the migration from SPIFFS to LittleFS is **successfully completed!**
|
File system
***********
+39 -4
View File
@@ -190,6 +190,14 @@ static const uint8_t PROGMEM
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
240 >> 8, 240 & 0xFF }, // XEND = 240
Rcmd2black172x320[] = { // 7735R init, part 2 (mini 172x320)
2, // 2 commands in list:
ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 172, // XEND = 172
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
320 >> 8, 320 & 0xFF }, // XEND = 320
#endif // if ST7735_EXTRA_INIT
Rcmd3[] = { // 7735R init, part 3 (red or green tab)
@@ -262,6 +270,13 @@ void Adafruit_ST7735::initR(uint8_t options) {
const uint8_t data = 0x00;
sendCommand(ST77XX_INVON, &data, 0);
sendCommand(ST77XX_INVON, &data, 0); // Write twice...
} else if (options == INITR_BLACKTAB172x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_172;
displayInit(Rcmd2black172x320);
const uint8_t data = 0x00;
sendCommand(ST77XX_INVON, &data, 0);
sendCommand(ST77XX_INVON, &data, 0); // Write twice...
#endif // if ST7735_EXTRA_INIT
} else {
// colstart, rowstart left at default '0' values
@@ -309,7 +324,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB;
#if ST7735_EXTRA_INIT
} else if (tabcolor == INITR_BLACKTAB135x240) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320)) {
madctl = ST77XX_MADCTL_MY | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -328,6 +343,11 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_width = ST7735_TFTWIDTH_135;
_colstart = 53;
_rowstart = 40;
} else if (tabcolor == INITR_BLACKTAB172x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_172;
_colstart = 34;
_rowstart = 1;
#endif // if ST7735_EXTRA_INIT
} else {
_height = ST7735_TFTHEIGHT_160;
@@ -340,7 +360,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MY | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#if ST7735_EXTRA_INIT
} else if (tabcolor == INITR_BLACKTAB135x240) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -359,6 +379,11 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_height = ST7735_TFTWIDTH_135;
_colstart = 52;
_rowstart = 40;
} else if (tabcolor == INITR_BLACKTAB172x320) {
_width = ST7735_TFTHEIGHT_320;
_height = ST7735_TFTWIDTH_172;
_colstart = 34;
_rowstart = 1;
#endif // if ST7735_EXTRA_INIT
} else {
_width = ST7735_TFTHEIGHT_160;
@@ -371,7 +396,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_RGB;
#if ST7735_EXTRA_INIT
} else if (tabcolor == INITR_BLACKTAB135x240) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -390,6 +415,11 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_width = ST7735_TFTWIDTH_135;
_colstart = 52;
_rowstart = 40;
} else if (tabcolor == INITR_BLACKTAB172x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_172;
_colstart = 34;
_rowstart = 1;
#endif // if ST7735_EXTRA_INIT
} else {
_height = ST7735_TFTHEIGHT_160;
@@ -402,7 +432,7 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#if ST7735_EXTRA_INIT
} else if (tabcolor == INITR_BLACKTAB135x240) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320)) {
madctl = ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -421,6 +451,11 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_height = ST7735_TFTWIDTH_135;
_colstart = 53;
_rowstart = 40;
} else if (tabcolor == INITR_BLACKTAB172x320) {
_width = ST7735_TFTHEIGHT_320;
_height = ST7735_TFTWIDTH_172;
_colstart = 34;
_rowstart = 1;
#endif // if ST7735_EXTRA_INIT
} else {
_width = ST7735_TFTHEIGHT_160;
+1
View File
@@ -31,6 +31,7 @@
#define INITR_HALLOWING 0x05
#define INITR_GREENTAB160x80 0x06
#define INITR_BLACKTAB135x240 0x07
#define INITR_BLACKTAB172x320 0x08
// Some register settings
#define ST7735_MADCTL_BGR 0x08
+2
View File
@@ -34,9 +34,11 @@
#define ST7735_TFTWIDTH_128 128 // for 1.44 and mini
#define ST7735_TFTWIDTH_80 80 // for mini
#define ST7735_TFTWIDTH_135 135
#define ST7735_TFTWIDTH_172 172
#define ST7735_TFTHEIGHT_128 128 // for 1.44" display
#define ST7735_TFTHEIGHT_160 160 // for 1.8" and mini display
#define ST7735_TFTHEIGHT_240 240
#define ST7735_TFTHEIGHT_320 320
#define ST_CMD_DELAY 0x80 // special signifier for command lists
+107 -84
View File
@@ -150,9 +150,11 @@ extra_scripts = ${esp32_common_LittleFS.extra_scripts}
pre:tools/pio/pre_custom_esp32.py
[env:custom_ESP32_4M316k]
[env:custom_ESP32_4M316k_ETH]
extends = esp32_custom_base
board = esp32_4M
build_flags = ${esp32_custom_base.build_flags}
-DFEATURE_ETHERNET=1
; [env:custom_ESP32_4M316k_LittleFS]
; extends = esp32_custom_base_LittleFS
@@ -165,12 +167,13 @@ board_upload.flash_size = 16MB
build_flags = ${esp32_custom_base_LittleFS.build_flags}
-DFEATURE_ETHERNET=1
[env:custom_IR_ESP32_4M316k]
[env:custom_IR_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DPLUGIN_BUILD_CUSTOM
-DPLUGIN_BUILD_IR
-DFEATURE_ETHERNET=1
lib_ignore = ${esp32_always.lib_ignore}
ESP32_ping
extra_scripts = ${esp32_common.extra_scripts}
@@ -185,11 +188,13 @@ build_flags = ${esp32_custom_base_LittleFS.build_flags}
-DFEATURE_ETHERNET=1
[env:normal_ESP32_4M316k]
[env:normal_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
lib_ignore = ${esp32_common.lib_ignore}
${no_ir.lib_ignore}
build_flags = ${esp32_common.build_flags}
-DFEATURE_ETHERNET=1
; [env:normal_ESP32_4M316k_LittleFS]
; extends = esp32_common_LittleFS
@@ -197,61 +202,68 @@ lib_ignore = ${esp32_common.lib_ignore}
; lib_ignore = ${esp32_common_LittleFS.lib_ignore}
; ${no_ir.lib_ignore}
[env:collection_A_ESP32_4M316k]
[env:collection_A_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_B_ESP32_4M316k]
[env:collection_B_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_B_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_C_ESP32_4M316k]
[env:collection_C_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_C_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_D_ESP32_4M316k]
[env:collection_D_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_D_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_E_ESP32_4M316k]
[env:collection_E_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_E_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_F_ESP32_4M316k]
[env:collection_F_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_F_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_G_ESP32_4M316k]
[env:collection_G_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_SET_COLLECTION_G_ESP32
-DCOLLECTION_FEATURE_RTTTL=1
-DFEATURE_ETHERNET=1
[env:collection_A_ESP32_IRExt_4M316k]
@@ -296,41 +308,47 @@ board = esp32_4M
build_flags = ${esp32_IRExt.build_flags}
-DPLUGIN_SET_COLLECTION_G_ESP32
[env:energy_ESP32_4M316k]
[env:energy_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_ENERGY_COLLECTION
-DFEATURE_ETHERNET=1
[env:display_ESP32_4M316k]
[env:display_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_DISPLAY_COLLECTION
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
-DFEATURE_ETHERNET=1
[env:climate_ESP32_4M316k]
[env:climate_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_CLIMATE_COLLECTION
-DFEATURE_ETHERNET=1
[env:neopixel_ESP32_4M316k]
[env:neopixel_ESP32_4M316k_ETH]
extends = esp32_common
board = esp32_4M
build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DFEATURE_SD=1
-D PLUGIN_NEOPIXEL_COLLECTION
[env:custom_ESP32_4M316k_ETH]
extends = env:custom_ESP32_4M316k
build_flags = ${env:custom_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:custom_ESP32_4M316k_ETH]
; extends = env:custom_ESP32_4M316k
; build_flags = ${env:custom_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
[env:custom_ESP32_4M316k_LittleFS_ETH]
extends = esp32_custom_base_LittleFS
board = esp32_4M
@@ -338,11 +356,11 @@ build_flags = ${esp32_custom_base_LittleFS.build_flags}
-DFEATURE_ETHERNET=1
[env:custom_IR_ESP32_4M316k_ETH]
extends = env:custom_IR_ESP32_4M316k
build_flags = ${env:custom_IR_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
extra_scripts = ${env:custom_IR_ESP32_4M316k.extra_scripts}
; [env:custom_IR_ESP32_4M316k_ETH]
; extends = env:custom_IR_ESP32_4M316k
; build_flags = ${env:custom_IR_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; extra_scripts = ${env:custom_IR_ESP32_4M316k.extra_scripts}
[env:custom_IR_ESP32_16M8M_LittleFS_ETH]
extends = esp32_common_LittleFS
@@ -359,10 +377,10 @@ extra_scripts = ${esp32_common.extra_scripts}
pre:tools/pio/pre_custom_esp32_IR.py
pre:tools/pio/ir_build_check.py
[env:normal_ESP32_4M316k_ETH]
extends = env:normal_ESP32_4M316k
build_flags = ${env:normal_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:normal_ESP32_4M316k_ETH]
; extends = env:normal_ESP32_4M316k
; build_flags = ${env:normal_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
[env:normal_ESP32_4M316k_LittleFS_ETH]
@@ -382,67 +400,67 @@ board = esp32_4M
build_flags = ${esp32_IRExt.build_flags}
-DFEATURE_ETHERNET=1
[env:collection_A_ESP32_4M316k_ETH]
extends = env:collection_A_ESP32_4M316k
build_flags = ${env:collection_A_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_A_ESP32_4M316k_ETH]
; extends = env:collection_A_ESP32_4M316k
; build_flags = ${env:collection_A_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_B_ESP32_4M316k_ETH]
extends = env:collection_B_ESP32_4M316k
build_flags = ${env:collection_B_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_B_ESP32_4M316k_ETH]
; extends = env:collection_B_ESP32_4M316k
; build_flags = ${env:collection_B_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_C_ESP32_4M316k_ETH]
extends = env:collection_C_ESP32_4M316k
build_flags = ${env:collection_C_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_C_ESP32_4M316k_ETH]
; extends = env:collection_C_ESP32_4M316k
; build_flags = ${env:collection_C_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_D_ESP32_4M316k_ETH]
extends = env:collection_D_ESP32_4M316k
build_flags = ${env:collection_D_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_D_ESP32_4M316k_ETH]
; extends = env:collection_D_ESP32_4M316k
; build_flags = ${env:collection_D_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_E_ESP32_4M316k_ETH]
extends = env:collection_E_ESP32_4M316k
build_flags = ${env:collection_E_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_E_ESP32_4M316k_ETH]
; extends = env:collection_E_ESP32_4M316k
; build_flags = ${env:collection_E_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_F_ESP32_4M316k_ETH]
extends = env:collection_F_ESP32_4M316k
build_flags = ${env:collection_F_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_F_ESP32_4M316k_ETH]
; extends = env:collection_F_ESP32_4M316k
; build_flags = ${env:collection_F_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:collection_G_ESP32_4M316k_ETH]
extends = env:collection_G_ESP32_4M316k
build_flags = ${env:collection_G_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
-DCOLLECTION_FEATURE_RTTTL=1
; [env:collection_G_ESP32_4M316k_ETH]
; extends = env:collection_G_ESP32_4M316k
; build_flags = ${env:collection_G_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; -DCOLLECTION_FEATURE_RTTTL=1
[env:energy_ESP32_4M316k_ETH]
extends = env:energy_ESP32_4M316k
build_flags = ${env:energy_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:energy_ESP32_4M316k_ETH]
; extends = env:energy_ESP32_4M316k
; build_flags = ${env:energy_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
[env:display_ESP32_4M316k_ETH]
extends = env:display_ESP32_4M316k
build_flags = ${env:display_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:display_ESP32_4M316k_ETH]
; extends = env:display_ESP32_4M316k
; build_flags = ${env:display_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
[env:climate_ESP32_4M316k_ETH]
extends = env:climate_ESP32_4M316k
build_flags = ${env:climate_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:climate_ESP32_4M316k_ETH]
; extends = env:climate_ESP32_4M316k
; build_flags = ${env:climate_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
[env:neopixel_ESP32_4M316k_ETH]
extends = env:neopixel_ESP32_4M316k
build_flags = ${env:neopixel_ESP32_4M316k.build_flags}
-DFEATURE_ETHERNET=1
; [env:neopixel_ESP32_4M316k_ETH]
; extends = env:neopixel_ESP32_4M316k
; build_flags = ${env:neopixel_ESP32_4M316k.build_flags}
; -DFEATURE_ETHERNET=1
; [env:collection_A_ESP32_IRExt_4M316k_ETH]
; extends = esp32_IRExt
@@ -525,7 +543,7 @@ build_flags = ${env:neopixel_ESP32_4M316k.build_flags}
; ESP32 MAX builds 16M flash ------------------------------
; A Lolin D32 PRO with 16MB Flash, allowing 4MB sketch size, and file storage using the default (SPIFFS) filesystem
[env:max_ESP32_16M1M]
[env:max_ESP32_16M1M_ETH]
extends = esp32_common
board = esp32_16M1M
board_upload.flash_size = 16MB
@@ -535,12 +553,15 @@ build_flags = ${esp32_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
[env:max_ESP32_16M1M_ETH]
extends = env:max_ESP32_16M1M
build_flags = ${env:max_ESP32_16M1M.build_flags}
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
-DFEATURE_ETHERNET=1
; [env:max_ESP32_16M1M_ETH]
; extends = env:max_ESP32_16M1M
; build_flags = ${env:max_ESP32_16M1M.build_flags}
; -DFEATURE_ETHERNET=1
; A Lolin D32 PRO with 16MB Flash, allowing 4MB sketch size, and file storage using LittleFS filesystem
[env:max_ESP32_16M8M_LittleFS_ETH]
@@ -555,6 +576,8 @@ build_flags = ${esp32_common_LittleFS.build_flags}
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-DFEATURE_ETHERNET=1
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32_common.extra_scripts}
board_build.filesystem = littlefs
+13
View File
@@ -150,6 +150,8 @@ extends = esp32c3_common
board = esp32c3cdc
build_flags = ${esp32c3_common.build_flags}
-D PLUGIN_DISPLAY_COLLECTION
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
[env:climate_ESP32c3_4M316k_CDC]
extends = esp32c3_common
@@ -173,3 +175,14 @@ build_flags = ${esp32c3_common_LittleFS.build_flags}
-DFEATURE_SD=1
-DFEATURE_ETHERNET=1
-DPLUGIN_NEOPIXEL_COLLECTION
[env:max_ESP32c3_16M8M_LittleFS_CDC_ETH]
extends = esp32c3_common_LittleFS
board = esp32c3cdc-16M
build_flags = ${esp32c3_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DFEATURE_SD=1
-DFEATURE_ETHERNET=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
extra_scripts = ${esp32c3_common_LittleFS.extra_scripts}
+4
View File
@@ -39,6 +39,8 @@ build_flags = ${esp32c6_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32c6_common_LittleFS.extra_scripts}
@@ -50,6 +52,8 @@ build_flags = ${esp32c6_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32c6_common_LittleFS.extra_scripts}
+2
View File
@@ -159,6 +159,8 @@ extends = esp32s2_common
board = esp32s2cdc
build_flags = ${esp32s2_common.build_flags}
-D PLUGIN_DISPLAY_COLLECTION
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
[env:climate_ESP32s2_4M316k_CDC]
extends = esp32s2_common
+8
View File
@@ -122,6 +122,8 @@ extends = esp32s3_common
board = esp32s3cdc-qio_qspi
build_flags = ${esp32s3_common.build_flags}
-D PLUGIN_DISPLAY_COLLECTION
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
[env:climate_ESP32s3_4M316k_CDC]
extends = esp32s3_common
@@ -171,6 +173,8 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
@@ -204,6 +208,8 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
@@ -216,6 +222,8 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
-DPLUGIN_BUILD_MAX_ESP32
-DPLUGIN_BUILD_IR_EXTENDED
-DCONFIG_PM_LIGHTSLEEP_RTC_OSC_CAL_INTERVAL=1
-D ST7789_EXTRA_INIT=1
-D P116_EXTRA_ST7789=1
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
;custom_sdkconfig =
; CONFIG_RMT_ISR_CACHE_SAFE=y
+48 -4
View File
@@ -7,12 +7,20 @@
// Maxim Integrated (ex Dallas) DS2423 datasheet : https://datasheets.maximintegrated.com/en/ds/DS2423.pdf
/** Changelog:
* 2025-03-15 tonhuisman: Add option in UI to enable the CountTotal value. When not enabled, still available via [<TaskName>#CountTotal]
* Enable PluginStats feature. Initially set Decimals to 0.
* 2025-03-06 tonhuisman: Add support for getting the (already fetched and stored) CountTotal value for the selected counter
* 2025-03-06 tonhuisman: Start changelog.
*/
# include "src/Helpers/Dallas1WireHelper.h"
# define PLUGIN_100
# define PLUGIN_ID_100 100
# define PLUGIN_NAME_100 "Pulse Counter - DS2423"
# define PLUGIN_VALUENAME1_100 "CountDelta"
# define PLUGIN_VALUENAME2_100 "CountTotal"
boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
{
@@ -25,11 +33,12 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_100;
dev.Type = DEVICE_TYPE_SINGLE;
dev.VType = Sensor_VType::SENSOR_TYPE_SINGLE;
dev.VType = Sensor_VType::SENSOR_TYPE_DUAL;
dev.FormulaOption = true;
dev.ValueCount = 1;
dev.ValueCount = 2;
dev.SendDataOption = true;
dev.TimerOption = true;
dev.PluginStats = true;
break;
}
@@ -42,6 +51,28 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_100));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_100));
break;
}
case PLUGIN_GET_DEVICEVALUECOUNT:
{
event->Par1 = 1 == PCONFIG(1) ? 2 : 1;
success = true;
break;
}
case PLUGIN_GET_DEVICEVTYPE:
{
event->sensorType = 1 == PCONFIG(1) ? Sensor_VType::SENSOR_TYPE_DUAL : Sensor_VType::SENSOR_TYPE_SINGLE;
success = true;
break;
}
case PLUGIN_SET_DEFAULTS:
{
ExtraTaskSettings.TaskDeviceValueDecimals[0] = 0; // Counters don't use decimals by default
ExtraTaskSettings.TaskDeviceValueDecimals[1] = 0;
break;
}
@@ -56,7 +87,7 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
addFormNote(F("External pull up resistor is needed, see docs!"));
// Scan the onewire bus and fill dropdown list with devicecount on this GPIO.
int8_t Plugin_100_DallasPin = CONFIG_PIN1;
const int8_t Plugin_100_DallasPin = CONFIG_PIN1;
if (validGpio(Plugin_100_DallasPin)) {
Dallas_addr_selector_webform_load(event->TaskIndex, Plugin_100_DallasPin, Plugin_100_DallasPin);
@@ -68,6 +99,7 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
selector.addFormSelector(F("Counter"), F("counter"), PCONFIG(0));
addFormNote(F("Counter value is incremental"));
}
addFormCheckBox(F("Show CountTotal value"), F("ptot"), PCONFIG(1) == 1);
success = true;
break;
}
@@ -79,6 +111,7 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
// 1-wire device address
Dallas_addr_selector_webform_save(event->TaskIndex, CONFIG_PIN1, CONFIG_PIN1);
PCONFIG(1) = isFormItemChecked(F("ptot")) ? 1 : 0;
success = true;
break;
@@ -103,9 +136,9 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
// Explicitly set the pinMode using the "slow" pinMode function
// This way we know for sure the state of any pull-up or -down resistor is known.
pinMode(CONFIG_PIN1, INPUT);
success = true; // Only start with a valid GPIO pin set
}
success = true;
break;
}
@@ -147,6 +180,17 @@ boolean Plugin_100(uint8_t function, struct EventStruct *event, String& string)
}
break;
}
case PLUGIN_GET_CONFIG_VALUE:
{
const String cmd = parseString(string, 1);
if (equals(cmd, F("counttotal"))) {
string = formatUserVarNoCheck(event, 1); // Fetch stored value
success = true;
}
break;
}
}
return success;
}
+5 -1
View File
@@ -148,6 +148,7 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
ST77xx_type_toString(ST77xx_type_e::ST7735s_80x160_M5),
# if P116_EXTRA_ST7735
ST77xx_type_toString(ST77xx_type_e::ST7735s_135x240),
ST77xx_type_toString(ST77xx_type_e::ST7735s_172x320),
# endif // if P116_EXTRA_ST7735
ST77xx_type_toString(ST77xx_type_e::ST7789vw_240x320),
ST77xx_type_toString(ST77xx_type_e::ST7789vw_240x240),
@@ -167,6 +168,7 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
static_cast<int>(ST77xx_type_e::ST7735s_80x160_M5),
# if P116_EXTRA_ST7735
static_cast<int>(ST77xx_type_e::ST7735s_135x240),
static_cast<int>(ST77xx_type_e::ST7735s_172x320),
# endif // if P116_EXTRA_ST7735
static_cast<int>(ST77xx_type_e::ST7789vw_240x320),
static_cast<int>(ST77xx_type_e::ST7789vw_240x240),
@@ -216,7 +218,8 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
static_cast<int>(P116_CommandTrigger::st7796)
};
constexpr int cmdCount = NR_ELEMENTS(commandTriggerOptions);
const FormSelectorOptions selector(cmdCount, commandTriggers, commandTriggerOptions);
FormSelectorOptions selector(cmdCount, commandTriggers, commandTriggerOptions);
selector.default_index = 1;
selector.addFormSelector(
F("Write Command trigger"),
F("commandtrigger"),
@@ -252,6 +255,7 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
addFormTextBox(concat(F("Line "), varNr + 1), getPluginCustomArgName(varNr), strings[varNr], P116_Nchars);
remain -= (strings[varNr].length() + 1);
}
addUnit(concat(F("Remaining: "), remain));
}
success = true;
+151
View File
@@ -0,0 +1,151 @@
#include "_Plugin_Helper.h"
#ifdef USES_P177
// #######################################################################################################
// ################################ Plugin 177 XDB401 I2C Pressure Sensor ################################
// #######################################################################################################
/** Changelog:
* 2025-03-03 tonhuisman: Change Sensor_VType to SENSOR_TYPE_TEMP_BARO for correct handling by Domoticz HTTP Controller.
* 2025-03-01 tonhuisman: Ensure all requested data is read from the sensor, to avoid read-stalling
* Change: We're now ignoring the status bit to see if data is available, and just read it after a ~100 msec delay
* 2025-02-27 tonhuisman: Swapped Temperature and Pressure values so they can be handled as a single device by Domoticz.
* Re-ordered the settings options for a better grouping of related settings.
* 2025-02-26 tonhuisman: Fix some typos in calculation.
* 2025-02-25 tonhuisman: Repair broken temperature calculation.
* 2025-02-24 tonhuisman: Adjust calculations to avoid zero-division, and use double for accuracy when available.
* Add setting to ignore negative pressure values
* 2025-02-23 tonhuisman: Add Generate events on pressure change and Raw data options
* Fix pressure and temperature calculation
* 2025-02-22 tonhuisman: Initial plugin development, direct I2C access,
* based on this documentation: https://www.letscontrolit.com/forum/viewtopic.php?t=10568#p71993 (attachment)
*/
# define PLUGIN_177
# define PLUGIN_ID_177 177
# define PLUGIN_NAME_177 "Environment - XDB401 I2C Pressure"
# define PLUGIN_VALUENAME1_177 "Temperature"
# define PLUGIN_VALUENAME2_177 "Pressure"
# include "./src/PluginStructs/P177_data_struct.h"
boolean Plugin_177(uint8_t function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_177;
dev.Type = DEVICE_TYPE_I2C;
dev.VType = Sensor_VType::SENSOR_TYPE_TEMP_BARO;
dev.FormulaOption = true;
dev.ValueCount = 2;
dev.SendDataOption = true;
dev.TimerOption = true;
dev.TimerOptional = true;
dev.PluginStats = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_177);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_177));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_177));
break;
}
case PLUGIN_I2C_HAS_ADDRESS:
{
success = P177_I2C_ADDR == event->Par1;
break;
}
# if FEATURE_I2C_GET_ADDRESS
case PLUGIN_I2C_GET_ADDRESS:
{
event->Par1 = P177_I2C_ADDR;
success = true;
break;
}
# endif // if FEATURE_I2C_GET_ADDRESS
case PLUGIN_SET_DEFAULTS:
{
P177_PRESSURE_SCALE_FACTOR = 1000; // Default to 1000
P177_GENERATE_EVENTS = 1; // Enabled
break;
}
case PLUGIN_WEBFORM_LOAD:
{
addFormNumericBox(F("Temperature offset"), F("tempoffset"), P177_TEMPERATURE_OFFSET);
addUnit(F("x 0.1C"));
addFormNote(F("Offset in units of 0.1 degree Celsius"));
addFormNumericBox(F("Sensor Full-scale Pressure"), F("scale"), P177_PRESSURE_SCALE_FACTOR, 1);
addUnit(F("psi, mBar, hPa, etc."));
addFormCheckBox(F("Generate events on Pressure change"), F("pevents"), P177_GENERATE_EVENTS == 1);
addFormCheckBox(F("Ignore negative pressure values"), F("pneg"), P177_IGNORE_NEGATIVE == 1);
addFormCheckBox(F("Use raw data from sensor"), F("praw"), P177_RAW_DATA == 1);
addFormNote(F("When checked: Temperature offset and Sensor Full-scale Pressure will be ignored!"));
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
P177_TEMPERATURE_OFFSET = getFormItemInt(F("tempoffset"), 0);
P177_PRESSURE_SCALE_FACTOR = getFormItemInt(F("scale"), 1000);
P177_GENERATE_EVENTS = isFormItemChecked(F("pevents")) ? 1 : 0;
P177_IGNORE_NEGATIVE = isFormItemChecked(F("pneg")) ? 1 : 0;
P177_RAW_DATA = isFormItemChecked(F("praw")) ? 1 : 0;
success = true;
break;
}
case PLUGIN_INIT:
{
success = initPluginTaskData(event->TaskIndex, new (std::nothrow) P177_data_struct(event));
break;
}
case PLUGIN_READ:
{
P177_data_struct *P177_data = static_cast<P177_data_struct *>(getPluginTaskData(event->TaskIndex));
if (nullptr != P177_data) {
success = P177_data->plugin_read(event);
}
break;
}
case PLUGIN_TEN_PER_SECOND:
{
P177_data_struct *P177_data = static_cast<P177_data_struct *>(getPluginTaskData(event->TaskIndex));
if (nullptr != P177_data) {
success = P177_data->plugin_ten_per_second(event);
}
break;
}
}
return success;
}
#endif // ifdef USES_P177
+9
View File
@@ -1697,6 +1697,9 @@ To create/register a plugin, you have to :
#if !defined(USES_P173) && defined(ESP32)
#define USES_P173 // Environment - SHTC3
#endif
#if !defined(USES_P177) && defined(ESP32)
#define USES_P177 // Environment - I2C XDB401 pressure
#endif
#if !defined(USES_P178) && defined(ESP32)
#define USES_P178 // Extra IO - LU9685 Servo controller
#endif
@@ -2043,6 +2046,9 @@ To create/register a plugin, you have to :
#if !defined(USES_P175) && defined(ESP32)
#define USES_P175 // Dust - PMSx003i I2C
#endif
#if !defined(USES_P177) && defined(ESP32)
#define USES_P177 // Environment - I2C XDB401 pressure
#endif
#if !defined(USES_P178) && defined(ESP32)
#define USES_P178 // Extra IO - LU9685 Servo controller
#endif
@@ -2526,6 +2532,9 @@ To create/register a plugin, you have to :
#ifndef USES_P175
#define USES_P175 // Dust - PMSx003i I2C
#endif
#ifndef USES_P177
#define USES_P177 // Environment - I2C XDB401 pressure
#endif
#ifndef USES_P178
#define USES_P178 // Extra IO - LU9685 Servo controller
#endif
+3 -1
View File
@@ -211,7 +211,9 @@ void AdaGFXFormTextPrintMode(const __FlashStringHelper *id,
toString(AdaGFXTextPrintMode::TruncateExceedingCentered),
};
const FormSelectorOptions selector(NR_ELEMENTS(textModes), textModes);
constexpr int count = NR_ELEMENTS(textModes);
FormSelectorOptions selector(count, textModes);
selector.default_index = 1;
selector.addFormSelector(F("Text print Mode"), id, selectedIndex);
}
@@ -465,6 +465,7 @@ bool P095_data_struct::plugin_write(struct EventStruct *event, const String& str
(event->Par2 > 0) &&
(event->Par2 <= 100)) {
P095_CONFIG_BACKLIGHT_PERCENT = event->Par2; // Set but don't store
_backlightPercentage = event->Par2; // Also set to current
displayOnOff(true);
} else {
success = false;
@@ -13,6 +13,7 @@ const __FlashStringHelper* ST77xx_type_toString(const ST77xx_type_e& device) {
case ST77xx_type_e::ST7735s_80x160_M5: return F("ST7735 80 x 160px (Color inverted)");
# if P116_EXTRA_ST7735
case ST77xx_type_e::ST7735s_135x240: return F("ST7735 135 x 240px");
case ST77xx_type_e::ST7735s_172x320: return F("ST7735 172 x 320px");
# endif // if P116_EXTRA_ST7735
case ST77xx_type_e::ST7789vw_240x320: return F("ST7789 240 x 320px");
case ST77xx_type_e::ST7789vw_240x240: return F("ST7789 240 x 240px");
@@ -72,6 +73,12 @@ void ST77xx_type_toResolution(const ST77xx_type_e& device,
x = 135;
y = 240;
break;
# if P116_EXTRA_ST7735
case ST77xx_type_e::ST7735s_172x320:
x = 172;
y = 320;
break;
# endif // if P116_EXTRA_ST7735
case ST77xx_type_e::ST7796s_320x480:
x = 320;
y = 480;
@@ -175,6 +182,13 @@ bool P116_data_struct::plugin_init(struct EventStruct *event) {
initRoptions = INITR_BLACKTAB135x240; // 135x240px
}
// fall through
case ST77xx_type_e::ST7735s_172x320:
if (initRoptions == 0xFF) {
initRoptions = INITR_BLACKTAB172x320; // 172x320px
}
// fall through
# endif // if P116_EXTRA_ST7735
case ST77xx_type_e::ST7735s_80x160:
+1
View File
@@ -101,6 +101,7 @@ enum class ST77xx_type_e : uint8_t {
# endif // if P116_EXTRA_ST7789
# if P116_EXTRA_ST7735
ST7735s_135x240 = 12u,
ST7735s_172x320 = 13u,
# endif // if P116_EXTRA_ST7735
};
+158
View File
@@ -0,0 +1,158 @@
#include "../PluginStructs/P177_data_struct.h"
#ifdef USES_P177
P177_data_struct::P177_data_struct(struct EventStruct *event) {
_sendEvents = P177_GENERATE_EVENTS == 1;
_rawData = P177_RAW_DATA == 1;
_ignoreNegative = P177_IGNORE_NEGATIVE == 1;
}
P177_data_struct::~P177_data_struct() {}
bool P177_data_struct::plugin_ten_per_second(struct EventStruct *event) {
bool is_ok;
uint8_t byteData;
if (P177_SensorMode_e::IdleMode == _sensorMode) {
_cycles--;
if (_cycles) { // Skip until counted down to 0
return false;
}
// we're ignoring the 'bit 3' status info, as it's unclear if it's 0-based or 1-based bit 3...
// a 100 msec 'delay' (10/sec) after the start of a read should be enough to stabilize the data
# if P177_CHECK_READY_BIT
byteData = I2C_read8_reg(P177_I2C_ADDR, P177_COMMAND_REG, &is_ok);
if (is_ok && (0 == bitRead(byteData, 3))) // Not currently reading
# endif // if P177_CHECK_READY_BIT
{
I2C_write8_reg(P177_I2C_ADDR, P177_COMMAND_REG, P177_START_READ);
_sensorMode = P177_SensorMode_e::SensingMode;
_cycles = P177_SKIP_CYCLES; // Restart timer after a read is started
}
# if P177_LOG
addLog(LOG_LEVEL_INFO, strformat(F("P177 : 1 Sensormode: %d, ok: %d, status: 0x%02x"),
static_cast<uint8_t>(_sensorMode), is_ok, byteData));
# endif // if P177_LOG
return false;
}
if (P177_SensorMode_e::SensingMode == _sensorMode) {
byteData = I2C_read8_reg(P177_I2C_ADDR, P177_COMMAND_REG, &is_ok);
# if P177_LOG
addLog(LOG_LEVEL_INFO, strformat(F("P177 : 2 Sensormode: %d, ok: %d, status: 0x%02x"),
static_cast<uint8_t>(_sensorMode), is_ok, byteData));
# endif // if P177_LOG
// if (!is_ok || (1 == bitRead(byteData, 3))) { // Currently reading
// return false;
// }
_sensorMode = P177_SensorMode_e::ReportingMode;
}
# if P177_LOG
addLog(LOG_LEVEL_INFO, concat(F("P177 : 3 Sensormode: "), static_cast<uint8_t>(_sensorMode)));
# endif // if P177_LOG
uint32_t prData{};
uint32_t tmData{};
# if P177_LOG
String log = F("P177 : RAW data: ");
# endif // if P177_LOG
size_t i = 0;
for (; i < 3; ++i) { // first 3 bytes pressure
prData <<= 8;
byteData = I2C_read8_reg(P177_I2C_ADDR, P177_DATA_REG_1 + i);
prData += byteData;
# if P177_LOG
log += strformat(F("0x%02X "), byteData);
# endif // if P177_LOG
}
# if P177_LOG
log += strformat(F("prData: 0x%06X, "), prData);
# endif // if P177_LOG
for (; i < P177_DATA_BYTES; ++i) { // 2 more bytes temperature
tmData <<= 8;
byteData = I2C_read8_reg(P177_I2C_ADDR, P177_DATA_REG_1 + i);
tmData += byteData;
# if P177_LOG
log += strformat(F("0x%02X "), byteData);
# endif // if P177_LOG
}
# if P177_LOG
log += strformat(F(" tmData: 0x%04X"), tmData);
addLog(LOG_LEVEL_INFO, log);
# endif // if P177_LOG
_sensorMode = P177_SensorMode_e::IdleMode; // Start a new cycle
const bool pressureChanged = (prData != _rawPressure);
if (!pressureChanged && (tmData == _rawTemperature)) {
return false;
}
_rawPressure = prData;
_rawTemperature = tmData;
_updated = true;
if (_sendEvents && pressureChanged) {
plugin_read(event);
sendData(event);
_updated = true; // Is reset in plugin_read()
}
return true;
}
bool P177_data_struct::plugin_read(struct EventStruct *event) {
if (!_updated) {
// Needed to get the 1st value, or can get the latest value when sampled too frequently.
plugin_ten_per_second(event);
}
if (_updated) {
int tmpPressure = _rawPressure; // Unsigned to signed
int tmpTemperature = _rawTemperature;
ESPEASY_RULES_FLOAT_TYPE _pressure = tmpPressure;
ESPEASY_RULES_FLOAT_TYPE _temperature = tmpTemperature;
if (tmpPressure >= (1 << 23)) { // Negative value?
if (_ignoreNegative) {
_pressure = 0.0;
} else {
_pressure = tmpPressure - (1 << 24);
}
}
if (tmpTemperature >= (1 << 15)) { // Negative value?
_temperature = tmpTemperature - (1 << 16);
}
if (!essentiallyZero(_temperature)) {
_temperature /= 256.0; // Move less significant bits
}
if (!_rawData) {
_pressure *= (P177_PRESSURE_SCALE_FACTOR / static_cast<ESPEASY_RULES_FLOAT_TYPE>(1 << 23));
if (P177_TEMPERATURE_OFFSET != 0) {
_temperature += (P177_TEMPERATURE_OFFSET / 10.0); // In 0.1 degree steps
}
}
UserVar.setFloat(event->TaskIndex, 0, _temperature);
UserVar.setFloat(event->TaskIndex, 1, _pressure);
_updated = false;
return true;
}
return false;
}
#endif // ifdef USES_P177
+59
View File
@@ -0,0 +1,59 @@
#ifndef PLUGINSTRUCTS_P177_DATA_STRUCT_H
#define PLUGINSTRUCTS_P177_DATA_STRUCT_H
#include "../../_Plugin_Helper.h"
#ifdef USES_P177
# include "../Helpers/I2C_access.h"
# define P177_LOG 0 // Set to 1 to enable raw data logging at INFO level
# define P177_CHECK_READY_BIT 0 // Set to 1 to read bit 3 of command register (once we know which bit 3...)
# define P177_I2C_ADDR 0x7F // Fixed address
# define P177_COMMAND_REG 0x30
# define P177_START_READ 0x0A
# define P177_DATA_REG_1 0x06
# define P177_DATA_BYTES 5
# define P177_SKIP_CYCLES 5 // Skip this number of 10/sec cycles when in IdleMode
# define P177_PRESSURE_SCALE_FACTOR PCONFIG_LONG(0) // Pressure scaling factor
# define P177_TEMPERATURE_OFFSET PCONFIG(0) // Temperature compensation in 0.1 degree steps
# define P177_GENERATE_EVENTS PCONFIG(1) // To generate an event on Pressure change
# define P177_RAW_DATA PCONFIG(2) // Present raw data
# define P177_IGNORE_NEGATIVE PCONFIG(3) // Negative pressure rounded to 0
enum class P177_SensorMode_e : uint8_t {
IdleMode = 0u,
SensingMode = 1u,
ReportingMode = 2u,
};
/*******************************************
* P177 Plugin taskdata struct
******************************************/
struct P177_data_struct : public PluginTaskData_base {
public:
P177_data_struct(struct EventStruct *event);
~P177_data_struct();
bool plugin_ten_per_second(struct EventStruct *event);
bool plugin_read(struct EventStruct *event);
private:
uint32_t _rawPressure{};
uint32_t _rawTemperature{};
P177_SensorMode_e _sensorMode = P177_SensorMode_e::IdleMode;
uint8_t _cycles = 1; // Start cycle immediately
bool _updated = false;
bool _sendEvents;
bool _rawData;
bool _ignoreNegative;
};
#endif // ifdef USES_P177
#endif // ifndef PLUGINSTRUCTS_P177_DATA_STRUCT_H
+4 -1
View File
@@ -957,7 +957,10 @@ void handle_devices_TaskSettingsPage(taskIndex_t taskIndex, uint8_t page)
// show selected device name and delete button
addHtml(getPluginNameFromDeviceIndex(DeviceIndex));
addHelpButton(concat(F("Plugin"), Settings.getPluginID_for_task(taskIndex).value));
const uint8_t pid = Settings.getPluginID_for_task(taskIndex).value;
if (pid <= 101) { // Up to P101 seem to be listed in the old Wiki, so lets keep pointing there too
addHelpButton(concat(F("Plugin"), Settings.getPluginID_for_task(taskIndex).value));
}
addRTDPluginButton(Settings.getPluginID_for_task(taskIndex));
addFormTextBox(F("Name"), F("TDN"), getTaskDeviceName(taskIndex), NAME_FORMULA_LENGTH_MAX); // ="taskdevicename"
+1 -1
View File
@@ -155,7 +155,7 @@ void handle_hardware() {
addHtml(F("<form method='post'>"));
html_table_class_normal();
addFormHeader(F("Hardware Settings"), F("ESPEasy#Hardware_page"), F("Hardware/Hardware.html"));
addFormHeader(F("Hardware Settings"), F(""), F("Hardware/Hardware.html"));
addFormSubHeader(F("Wifi Status LED"));
addFormPinSelect(PinSelectPurpose::Status_led, formatGpioName_output(F("LED")), F("pled"), Settings.Pin_status_led);
+1 -1
View File
@@ -400,7 +400,7 @@ String getKnownI2Cdevice(uint8_t address) {
result += F("LiquidLevel");
break;
case 0x7f:
result += F("Arduino PME");
result += F("Arduino PME,XDB401");
break;
}
#endif // LIMIT_BUILD_SIZE
+1 -1
View File
@@ -70,7 +70,7 @@ void handle_pinstates() {
html_table_class_multirow();
html_TR();
html_table_header(F("Plugin"), F("Official_plugin_list"), 0);
html_table_header(F("Plugin"), F("RTDPlugin/_Plugin.html#list-of-official-plugins"), 0);
html_table_header(F("GPIO"));
html_table_header(F("Mode"));
html_table_header(F("Value/State"));
+1 -1
View File
@@ -90,7 +90,7 @@ void handle_rules() {
selector.addSelector(
F("set"),
choice);
addHelpButton(F("Tutorial_Rules"));
// addHelpButton(F("Tutorial_Rules")); // Old documentation is just that: Old and out-dated.
addRTDHelpButton(F("Rules/Rules.html"));
}
+1 -1
View File
@@ -46,7 +46,7 @@ void handle_sysvars() {
html_TR();
html_table_header(F("System Variables"));
html_table_header(F("Normal"));
html_table_header(F("URL encoded"), F("ESPEasy_System_Variables"), 0);
html_table_header(F("URL encoded"), F("RTDReference/SystemVariable.html"), 0);
addTableSeparator(F("Custom Variables"), 3, 3);
+2 -2
View File
@@ -47,7 +47,7 @@ void handle_tools() {
html_TR_TD();
addSubmitButton();
addHelpButton(F("ESPEasy_Command_Reference"));
// addHelpButton(F("ESPEasy_Command_Reference")); // Old documentation is just that: Old and out-dated.
addRTDHelpButton(F("Reference/Command.html"));
html_TR_TD();
@@ -154,7 +154,7 @@ void handle_tools() {
addFormSubHeader(F("Firmware"));
html_TR_TD_height(30);
addWideButton(F("update"), F("Update Firmware"), EMPTY_STRING, otaEnabled);
addHelpButton(F("EasyOTA"));
addHelpButton(F("RTDTools/Tools.html#id1"));
html_TD();
addHtml(F("Load a new firmware "));