Skip to content

Commit

Permalink
Merge pull request letscontrolit#5043 from tonhuisman/feature/Various…
Browse files Browse the repository at this point in the history
…-improvements-and-fixes-2024-05

Various improvements and fixes, May 2024
  • Loading branch information
TD-er authored May 18, 2024
2 parents ea9adbb + d2dc7ec commit c14fffe
Show file tree
Hide file tree
Showing 23 changed files with 171 additions and 137 deletions.
12 changes: 6 additions & 6 deletions docs/source/Plugin/AdaGFX_values.repl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Get the currently active Window Id, expected range: 0..255.
"
"
``[<taskname>#iswin,<windowId>]``
``[<taskname>#iswin.<windowId>]``
","
Is the request Window Id valid, expected result: 1 = true, 0 = false.
"
Expand All @@ -33,12 +33,12 @@
Get the height of the currently active Window and rotation, expected range 0..<largest display dimension>.
"
"
``[<taskname>#length,^"<text to measure>^"]``
``[<taskname>#length.^"<text to measure>^"]``
","
Get the length of the text in pixels for the current font and text scaling. Needs quotes if text contains space(s), comma(s) or quote(s).
"
"
``[<taskname>#textheight,^"<text to measure>^"]``
``[<taskname>#textheight.^"<text to measure>^"]``
","
Get the height of the text in pixels for the current font and text scaling. Needs quotes if the text contains space(s), comma(s) or quote(s).
"
Expand Down Expand Up @@ -68,15 +68,15 @@
.. code:: none

on centertime do // NB: Comments & extra spaces should be removed to reduce rules size!
if [st7796#iswin,%eventvalue1|2%]=1 // default window: 2
if [st7796#iswin.%eventvalue1|2%]=1 // default window: 2
let,120,[st7796#win] // store current window
st77xx,win,%eventvalue1|2% // switch to window
let,121,[st7796#txs] // store textscaling
st77xx,txs,3 // set text scaling
let,122,[st7796#rot] // store rotation
st77xx,rot,%eventvalue2|0% // set rotation, default: 0
let,123,([st7796#width]-[st7796#length,%systm_hm%])/2 // (width - textlength)/2
let,124,([st7796#height]-[st7796#textheight,%systm_hm%])/2 // (height - textheight)/2
let,123,([st7796#width]-[st7796#length.%systm_hm%])/2 // (width - textlength)/2
let,124,([st7796#height]-[st7796#textheight.%systm_hm%])/2 // (height - textheight)/2
st77xx,txtfull,[int#123],[int#124],3,red,black,%systm_hm% // Display time red on black
st77xx,rot,%v122% // restore rotation
st77xx,txs,%v121% // restore text scaling
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Plugin/P011_config_values.repl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
:widths: 20, 30

"
``[<taskname>#D,<port>]``
``[<taskname>#D.<port>]``

``<port>`` : Range 0..13, corresponding with D0..D13 on the PME.
","
Returns the current status (0/1) from the requested Digital port (pin) of the Pro Mini Extender.
"
"
``[<taskname>#A,<port>]``
``[<taskname>#A.<port>]``

``<port>`` : Range 0..3 and 6..7, corresponding with A0..A7 on the PME.
","
Expand Down
62 changes: 58 additions & 4 deletions docs/source/Plugin/P034.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: ../Plugin/_plugin_substitutions_p03x.repl
.. include:: ../Plugin/_plugin_substitutions_p03x.repl
.. _P034_page:

|P034_typename|
Expand All @@ -21,10 +21,64 @@ Maintainer: |P034_maintainer|

Used libraries: |P034_usedlibraries|

Supported hardware
------------------
.. Supported hardware
.. ------------------
.. .. |P034_usedby|
Introduction
------------


Specifications:
* Temperature (-20 to +60C)
* Humidity (20-95 % rel. humidity)

Settings
--------

.. image:: P034_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 settings here depend on the build used. At least the **Force Slow I2C speed** option is available, but selections for the I2C Multiplexer can also be shown. For details see the :ref:`Hardware_page`

Device Settings
^^^^^^^^^^^^^^^

This device has no further configuration settings.

Data Acquisition
^^^^^^^^^^^^^^^^

This group of settings, **Single event with all values**, **Send to Controller** and **Interval** 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. It is the frequency used to read sensor values and send these to any Controllers configured for this device.

Values
^^^^^^

The names for the values are initially set to a default name, but can be changed if desired. Also, a formula can be entered to re-calculate the value before display/sending to a controller, and the number of decimals can be changed, for Temperature, usually 1 decimal is enough to be displayed (value will be rounded).




Where to buy
------------

.. csv-table::
:header: "Store", "Link"
:widths: 5, 40

"AliExpress","`Link 1 ($) <http://s.click.aliexpress.com/e/cg1fhDDI>`_"

|affiliate|

|P034_usedby|

.. Commands available
.. ^^^^^^^^^^^^^^^^^^
Expand Down
71 changes: 0 additions & 71 deletions docs/source/Plugin/P034_DHT12.rst

This file was deleted.

Binary file added docs/source/Plugin/P034_DeviceConfiguration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/source/Plugin/P087_config_values.repl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
:widths: 20, 30

"
``[<taskname>#group,<groupnr>]``
``[<taskname>#group.<groupnr>]``
","
Get the contents from groupnr after processing received data.

NB: The regular expression parsen uses 0-based group numbers (where most other regex parsers use 1-based group numbers!)
"
"
``[<taskname>#next,<groupvalue>]``
``[<taskname>#next.<groupvalue>]``
","
Get the value of the next group that holds ``<groupvalue>``.

Expand Down Expand Up @@ -66,5 +66,5 @@
- -30
-

Requesting ``[SerialProxy#next,weight]`` will return the value ``40``.
Requesting ``[SerialProxy#next.weight]`` will return the value ``40``.
"
24 changes: 13 additions & 11 deletions docs/source/Plugin/P105.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,57 +26,59 @@ Datasheet: |P105_datasheet| |P105_datasheet2| |P105_datasheet3|
Description
-----------

The AHT10/AHT20/AHT21 sensors provide Temperature and Humidity measurements (factory calibrated), via an I2C bus connection.
The AHT10/AHT15/AHT20/AHT21/DHT20/AM2301B sensors provide Temperature and Humidity measurements (factory calibrated), via an I2C bus connection.

.. warning::

* The **AHT10** device does sometimes not 'play nice' when there are also other I2C devices on the same bus (many complaints can be found on the internet). NB: This may be hardware-, vendor-, or chip-revision-specific.
* The **AHT10** and **AHT15** devices do sometimes not 'play nice' when there are also other I2C devices on the same bus (many complaints can be found on the internet). NB: This may be hardware-, vendor-, or chip-revision-specific.

Because of this peculiarity, other sensors may be more appropriate, like the AHT20/AHT21 also supported by this plugin, or :ref:`P028_page`, :ref:`P106_page`, :ref:`P014_page`, :ref:`P034_page`, :ref:`P051_page`, :ref:`P068_page` or :ref:`P072_page`.

This plugin tries to avoid such situations (I2C bus lock) by (soft) resetting the sensor if it doesn't respond for some time.

This plugin also supports the **DHT20** and **AM2301B** sensors, as these are just **AHT20** sensors with a specific housing.

Settings
--------

.. image:: P105_DeviceConfiguration.png

**Name**: The name for this task, should be unique.
* **Name**: The name for this task, should be unique.

**Enabled**: Allows to enable/disable the device.
* **Enabled**: Allows to enable/disable the device.

I2C Options
^^^^^^^^^^^^

The available settings here depend on the build used. At least the **Force Slow I2C speed** option is available, but selections for the I2C Multiplexer can also be shown. For details see the :ref:`Hardware_page`

**I2C Address**: The address the device is using. The AHT10 sensor allows to select a secondary address by pulling the AO (sometimes marked as A0) pin to high (3.3V) to select the secondary address. That address should then be selected here too. The AHT20/AHT21 sensors only support a single I2C address, so it will be forced to the default address.
* **I2C Address**: The address the device is using. The AHT10 sensor allows to select a secondary address by pulling the AO (sometimes marked as A0) pin to high (3.3V) to select the secondary address. That address should then be selected here too. The AHT20/AHT21 based sensors only support a single I2C address, so it will be forced to the default address.

Device Settings
^^^^^^^^^^^^^^^^

If the plugin is configured for **Sensor model** AHT10 and other devices configured in a task use the I2C bus, a warning is displayed (see example below) that combining them with this device may cause issues on the I2C bus, resulting in all I2C devices no longer working as intended. This may occur immediately, or only after some time, like 10 minutes or an hour.
If the plugin is configured for **Sensor model** AHT1x and other devices configured in a task use the I2C bus, a warning is displayed (see example below) that combining them with this device may cause issues on the I2C bus, resulting in all I2C devices no longer working as intended. This may occur immediately, or only after some time, like 10 minutes or an hour.

.. image:: P105_DeviceWarning.png

**Sensor model** Selection of the connected type of hardware. (AHT2x sensors have a slightly different intialization.)
* **Sensor model** Selection of the connected type of hardware. (AHT2x based sensors have a slightly different intialization.)

Available options:

.. image:: P105_SensorModelOptions.png

**AHT10** This sensor model should better be avoided, as it doesn't always work with other devices on the same I2C bus. Also, the AHT15 can be used, but that has similar issues.
**AHT1x** AHT10/AHT15. These sensor models should better be avoided, as it doesn't always work with other devices on the same I2C bus.

**AHT20** An more modern version of the sensor.
**AHT20** An more modern version of the sensor. Use this option also when connecting a DHT20 or AM2301B sensor.

**AHT20** An more modern version of the sensor, very similar to the AHT20, in a more compact chip package.
**AHT21** An more modern version of the sensor, very similar to the AHT20, in a more compact chip package.

Data Acquisition
^^^^^^^^^^^^^^^^

This group of settings, **Single event with all values**, **Send to Controller** and **Interval** 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. It is the frequency used to read sensor values and send these to any Controllers configured for this device.
* **Interval** By default, Interval will be set to 60 sec. It is the frequency used to read sensor values and send these to any Controllers configured for this device.

Values
^^^^^^
Expand Down
Binary file modified docs/source/Plugin/P105_DeviceConfiguration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/Plugin/P105_DeviceWarning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/Plugin/P105_SensorModelOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/Plugin/_plugin_substitutions_p10x.repl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
.. |P104-Font-Katakana_typename| replace:: `Katakana font characters`


.. |P105_name| replace:: :cyan:`AHT10/AHT2x`
.. |P105_name| replace:: :cyan:`AHT1x/AHT2x/DHT20/AM2301B`
.. |P105_type| replace:: :cyan:`Environment`
.. |P105_typename| replace:: :cyan:`Environment - AHT10/AHT2x`
.. |P105_typename| replace:: :cyan:`Environment - AHT1x/AHT2x/DHT20/AM2301B`
.. |P105_porttype| replace:: `.`
.. |P105_status| replace:: :yellow:`COLLECTION A` :yellow:`CLIMATE`
.. |P105_github| replace:: P105_AHT.ino
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
platformio>=6.1.9
pygit2>=1.10.1
pygit2>=1.10.1
setuptools
13 changes: 9 additions & 4 deletions src/_P011_PME.ino
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,23 @@ boolean Plugin_011(uint8_t function, struct EventStruct *event, String& string)

case PLUGIN_GET_CONFIG_VALUE:
{
const String typ = parseString(string, 1);
const String port = parseString(string, 2);
char sep = '.';

if ((-1 == string.indexOf(sep)) && (string.indexOf(',') >= 0)) {
sep = ',';
}
const String typ = parseString(string, 1, sep);
const String port = parseString(string, 2, sep);
int32_t portnr = -1;
validIntFromString(port, portnr);

// [<taskname>#D,<port>] : Read Digital value from <port>
// [<taskname>#D.<port>] : Read Digital value from <port>
if (equals(typ, F("d")) && !port.isEmpty() && (portnr >= 0) && (portnr < PLUGIN_011_PORTS)) {
string = Plugin_011_Read(0, portnr);
success = true;
} else

// [<taskname>#A,<port>] : Read Analog value from <port>
// [<taskname>#A.<port>] : Read Analog value from <port>
if (equals(typ, F("a")) && !port.isEmpty() && (portnr >= 0) && (portnr < PLUGIN_011_A_PORTS)) {
string = Plugin_011_Read(1, portnr);
success = true;
Expand Down
15 changes: 15 additions & 0 deletions src/_P012_LCD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// #######################################################################################################

/** Changelog:
* 2023-12-26 tonhuisman: Clear the splash from the display after 5 seconds if not already overwritten
* 2023-03-07 tonhuisman: Parse text to display without trimming off leading and trailing spaces
* 2023-03: First changelog added, older changes not logged
*/
Expand Down Expand Up @@ -216,6 +217,19 @@ boolean Plugin_012(uint8_t function, struct EventStruct *event, String& string)
char deviceTemplate[P12_Nlines][P12_Nchars];
LoadCustomTaskSettings(event->TaskIndex, reinterpret_cast<uint8_t *>(&deviceTemplate), sizeof(deviceTemplate));

switch (P012_data->splashState) {
case P012_splashState_e::SplashCleared:
// Most common route
break;
case P012_splashState_e::SplashInitial:
P012_data->splashState = P012_splashState_e::SplashTimerRunning;
Scheduler.schedule_task_device_timer(event->TaskIndex, millis() + 5000);
break;
case P012_splashState_e::SplashTimerRunning:
P012_data->lcdWrite(F(" "), 0, 0); // Wipe 'ESP Easy' splash text, will reset splashState
break;
}

for (uint8_t x = 0; x < P012_data->Plugin_012_rows; x++)
{
String tmpString = deviceTemplate[x];
Expand Down Expand Up @@ -252,6 +266,7 @@ boolean Plugin_012(uint8_t function, struct EventStruct *event, String& string)
}
else if (arg1.equalsIgnoreCase(F("Clear"))) {
P012_data->lcd.clear();
P012_data->splashState = P012_splashState_e::SplashCleared;
}
}
else if (cmd.equalsIgnoreCase(F("LCD")))
Expand Down
Loading

0 comments on commit c14fffe

Please sign in to comment.