Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P044] Led settings and events without client, merged into [P020] #4283

Merged
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
9410058
[P044] Uncrustify format source
tonhuisman Oct 1, 2022
86dc1f8
[P044] Make Led pin configurable
tonhuisman Oct 1, 2022
7ed1cc8
[P044] Correct auto-complete typo
tonhuisman Oct 1, 2022
9f4c038
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 2, 2022
603e6a8
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 8, 2022
3bb189d
[Plugins] Call PLUGIN_WEBFORM_PRE_SERIAL_PARAMS before serial setting…
tonhuisman Oct 8, 2022
547f571
[Plugins] Call PLUGIN_WEBFORM_PRE_SERIAL_PARAMS before serial setting…
tonhuisman Oct 8, 2022
bb66f34
[P020] Merge [P044] code into [P020], so P020 van emulate P044
tonhuisman Oct 8, 2022
7fb2382
[P020/P044] Migrate settings also on plugin start without prior save …
tonhuisman Oct 9, 2022
986d53a
[P020] Code improvement
tonhuisman Oct 9, 2022
dc8ef70
[P020/P044] Add option for including P1 data in #data event
tonhuisman Oct 11, 2022
07592e5
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Oct 16, 2022
ea65240
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Oct 28, 2022
fee72ce
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Nov 2, 2022
a027541
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Nov 26, 2022
471f65e
Merge branch 'feature/P044-led-and-events-without-client' of https://…
tonhuisman Nov 29, 2022
5455c28
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Nov 29, 2022
7c1c9a7
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Dec 3, 2022
7a357d7
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Dec 11, 2022
22e3ddd
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Dec 14, 2022
2c12f5a
[UI] Add Separator character input selector
tonhuisman Dec 14, 2022
a6292b7
[P020/P044] Add feature to replace spaces and newlines in received data
tonhuisman Dec 14, 2022
47ef2b8
[P020] Add plugin documentation
tonhuisman Dec 14, 2022
80a175e
[P037] Implement replacement character input selector, update documen…
tonhuisman Dec 14, 2022
e0b3250
[UI] Fix unsupported feature compilation error, fix signed/unsigned w…
tonhuisman Dec 14, 2022
7573e46
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Dec 16, 2022
b20af2b
[P044] Only show usable settings
tonhuisman Dec 16, 2022
5530e94
[P044] Update plugin documentation (based on P020)
tonhuisman Dec 16, 2022
a2299f9
Merge branch 'mega' into feature/P044-led-and-events-without-client
TD-er Dec 23, 2022
ec611d1
Merge branch 'mega' into feature/P044-led-and-events-without-client
TD-er Dec 23, 2022
8f81cf0
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Jan 3, 2023
b2358e0
[Build] Adjust Custom ESP8266 as already planned to fix build failure
tonhuisman Jan 3, 2023
a270a25
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jan 14, 2023
5e68eec
[P020/P044] Adjustments to complete the merge
tonhuisman Jan 14, 2023
064912d
[P020] Add extra check before sending P1 data
tonhuisman Jan 15, 2023
57666f6
[P020] Revert extra check before sending P1 data, minor improvements
tonhuisman Jan 17, 2023
537d35c
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jan 28, 2023
89c280f
Merge branch 'feature/P044-led-and-events-without-client' of https://…
tonhuisman Feb 18, 2023
03ddf0e
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Feb 18, 2023
a3bb6da
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Feb 21, 2023
61955c8
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Mar 14, 2023
073ad87
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Mar 21, 2023
151cf5e
[StringConverter] Add parseHexTextString()
tonhuisman Mar 21, 2023
a0ae909
[P020] Add command `serialsendmix`
tonhuisman Mar 21, 2023
8da4362
[StringConverter] Improvements to parseHexTextString()
tonhuisman Mar 22, 2023
c8573b5
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Mar 23, 2023
e2ae659
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Mar 23, 2023
a4fdcaf
Merge branch 'feature/P044-led-and-events-without-client' of https://…
tonhuisman Mar 23, 2023
8ffc8da
[P020] Add command documentation
tonhuisman Mar 23, 2023
6df4649
[P020] Correct some typos in documentation
tonhuisman Mar 25, 2023
188f6f4
[StringConverter] Add parseHexTextData() to handle 0x00
tonhuisman Mar 25, 2023
05337a5
[P020] Use parseHextTextData() to handle 0x00 in data
tonhuisman Mar 25, 2023
0c99aaa
[P020] Update documentation for 0x00..0xFF hex data support in serial…
tonhuisman Mar 25, 2023
b817f18
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Mar 25, 2023
2aba1bf
[P020] Update changelog
tonhuisman Mar 25, 2023
ed0d0a1
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Mar 31, 2023
18cfc86
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Apr 1, 2023
5063421
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Apr 9, 2023
c287448
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Apr 11, 2023
73938e3
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Apr 11, 2023
e6a44a3
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman May 12, 2023
bd1a6f5
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman May 14, 2023
5df32fd
Merge branch 'feature/P044-led-and-events-without-client' of https://…
tonhuisman May 22, 2023
29f6357
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman May 22, 2023
d5d31a7
[P020] Unification of Ser2Net log messages
tonhuisman May 22, 2023
aef7909
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Jun 1, 2023
20a5668
[Build] Manually apply WiFi build fixes (missing includes)
tonhuisman Jun 1, 2023
3e41ad7
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jun 2, 2023
5b37962
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jun 23, 2023
fb853a4
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jun 24, 2023
e3f8adf
[ESPEasySerial] Add shortName option to be used as eventname
tonhuisman Jun 24, 2023
ca6669c
[Helpers] Implement ESPEasySerial shortName option to be used as even…
tonhuisman Jun 24, 2023
280ad63
[P020] Increase max. buffer size
tonhuisman Jun 24, 2023
2968737
[P020] Update documentation for new options
tonhuisman Jun 24, 2023
60f4dd5
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Jun 27, 2023
83cda20
Merge branch 'feature/P044-led-and-events-without-client' of https://…
tonhuisman Aug 7, 2023
57505e8
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 7, 2023
f0d9f6a
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 12, 2023
eb12171
[P020] Fix receiving P1 data
tonhuisman Aug 12, 2023
6e3fd62
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 13, 2023
19a619e
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 13, 2023
b383418
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 14, 2023
2e498be
[P020] Fix merge conflict
tonhuisman Aug 17, 2023
9d0dd10
[P020] Allow some extra time-out while receiving P1 data, add missing…
tonhuisman Aug 17, 2023
16f7c9e
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 26, 2023
5fb0975
[P044/P020] Improved defaults for P1 WiFigateway
tonhuisman Aug 26, 2023
4f5783a
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Sep 17, 2023
6a0b131
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Sep 26, 2023
83f224c
Merge branch 'mega' into feature/P044-led-and-events-without-client
tonhuisman Oct 4, 2023
1413ae2
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 12, 2023
2e4ef9a
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Dec 2, 2023
40762e4
[P020][P044] Minor improvements, update with latest mega changes
tonhuisman Dec 2, 2023
d4c6cb9
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Dec 28, 2023
d5606e3
[P020] Replace WiFiServer->available() by accept() (for IDF >= 5)
tonhuisman Dec 28, 2023
68a0578
Merge branch 'mega' into feature/P044-led-and-events-without-client
TD-er Dec 28, 2023
97bb276
Merge branch 'mega' into feature/P044-led-and-events-without-client
TD-er Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 97 additions & 7 deletions docs/source/Plugin/P020.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,120 @@ Supported hardware

|P020_usedby|

Configuration
-------------

.. image:: P020_DeviceConfiguration.png

* **Name** In the Name field a unique name should be entered.

* **Enabled** When unchecked the plugin is not enabled.

Sensor
^^^^^^

See: :ref:`SerialHelper_page`

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

* **TCP Port**: The port for an external network client to read the data from, range 1..65535. The used port number must be unique within the device.

* **Baud Rate / Serial config**: See *Serial helper configuration*, above.

* **Event Processing**: Select the type of data that is expected, to enable correct preprocessing. Available options:

.. image:: P020_EventProcessingOptions.png

* *None*: No special processing, what is received is sent out to the network client, not generating an event.

* *Generic*: No special processing, received data is sent to the network client, and an event ``!Serial#<message>``, containing the message as is, is generated. Spaces and newlines are processed as configured below.

* *RFLink*: Specifically designed for receiving serial data from RFLink devices, it follows this process:

* Remove the regular RFLink ``20;xx;`` prefix
* Check for prefix ``ESPEASY;``, if found, remove the prefix and generate event ``RFLink#<message>``. The ``<message>`` will contain commands to be handled by ESPEasy.
* If previous prefix is not found, generate event ``!RFLink#<message>``, containing the entire received data. Spaces and newlines are processed as configured below.

*Also see the* **Multiple lines processing** *option, below.*

* *P1 WiFi Gateway*: Process the data, received from a P1 Energy meter, that does a checksum validation, as included in the message. No separate data values are available in ESPEasy, these are usually handled by Home automation systems that support the P1 protocol via TCP network communication. An event ``<TaskName>#Data`` is generated when a valid P1 packet is received.

Replacing spaces or newlines should be **disabled** for the P1 protocol data to be handled properly as these replacements will disturb the checksum calculation, and also, the **Multiple lines processing** should be disabled if the data is to be handled as P1 protocol data, as that does contain newlines.

.. spacer

* **P1 #data event with message**: When enabled, the *P1 WiFi Gateway* Event Processing option will include the received message. **WARNING** This may easily cause memory overflow exceptions, especially when running on ESP8266 or other low-memory situations!

When selecting the **Event processing** options *Generic* or *RFLink*, after submitting the page will show extra options for the events generated:

.. image:: P020_EventOptions.png

**TODO**: Complete this documentation...
* **Use Serial Port as eventname**: Instead of the default ``!Serial#<data>`` event, the name of the configured serial port will be used: (**Only** available for *Generic* Event processing)

.. Commands available
.. ^^^^^^^^^^^^^^^^^^
.. spacer

.. .. include:: P020_commands.repl
* *(Unchecked)* -> ``Serial``
* *HW Serial0* -> ``serial0``
* *HW Serial0 swap* -> ``serial0``
* *HW Serial1* -> ``serial1``
* *HW Serial2* -> ``serial2``
* *SW Serial* -> ``serialsw``
* *I2C Serial* -> ``seriali2c``
* *USB HWCDC* -> ``serialhwcdc``
* *USB CDC* -> ``serialcdc``

.. Events
.. ~~~~~~
.. spacer

.. .. include:: P020_events.repl
* **Append Task Number to eventname**: Will append the task number to the event name, f.e. ``Serial8`` or ``RFLink12`` when task 8 or 12 is in use for this plugin. Can be combined with **Use Serial Port as eventname** if that is option is shown, resulting f.e. in ``serial0swap6`` etc. (Only available for *Generic* and *RFLink* Event processing)

.. spacer

* **Replace spaces in event by**: Here a single character can be selected to replace all spaces during receiving the data.
* **Replace newlines in event by**: Here a single character can be selected to replace all newlines during receiving the data. When enabled, all linefeeds are replaced, and all carriage returns (if any) are discarded.

.. image:: P020_ReplaceCharInEventOptions.png

The available set of replacement characters is ``, ; : . ! ^ | / \`` (comma, semicolon, colon, period, exclamation, caret, pipe, slash and backslash). When set to None, no replacement will be done.

* **Process events without client**: By default, if no network client is connected, no serial data will be received and processed either. Enabling this option enables receiving data and generating events without a TCP client connected.

* **Multiple lines processing**: When enabled, all received data will be split at a linefeed and sent out/event generated as separate messages.

* **RX Receive timeout (mSec)**: If parts of serial data packets are somewhat delayed, but should still be handled as a single message, then the delay to wait for the next part can be configured here. 0 disables the delay.

* **Reset target after init**: Select a GPIO pin that should be pulled low once during initialization of the plugin, used to synchronize the external serial data source with the plugin.

* **RX Buffer size (bytes)**: To not overburden the memory use of the plugin, the buffer size is set rather low. Some serial devices, like energy meters may require a larger buffer if the message exceeds this size. Range: 256..1024.

Led
^^^

* **Led enabled**: To enable a *data is being processed* activity led.

* **Led pin**: The GPIO pin the Led is connected to.

* **Led inverted**: Iverts the on/off state for the Led.

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

The Data Acquisition and Send to Controller settings are standard available configuration items. Send to Controller only when one or more Controllers are configured. *Single event with all values* option is not applicable for this plugin.


Commands
~~~~~~~~

.. include:: P020_commands.repl

Change log
----------

.. versionchanged:: 2.0
...

|changed| 2022-12-13: Merge of P020 and P044 to reduce code size and combine features, as P044 was initially started as a spin-off from P020, but not evolved with the P020 features.

|added|
Major overhaul for 2.0 release.

Expand Down
Binary file added docs/source/Plugin/P020_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 added docs/source/Plugin/P020_EventOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/source/Plugin/P020_commands.repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.. csv-table::
:header: "Command", "Extra information"
:widths: 20, 30

"
``serialsend,<content to send>``

``<content to send>``: Text that will be sent (nearly) unprocessed. Only the regular variable replacements will be applied before sending the content to the serial port.
","
Using this command, either from rules, via http or mqtt, the text that is provided as content is completely sent to the serial port. No extra data is added, other than any (system) variables that are included, being replaced.
"
"
``ser2netclientsend,<content to send>``

``<content to send>``: Text that will be sent (nearly) unprocessed. Only the regular variable replacements will be applied before sending the content to the network client.
","
This command will only send data to the network client, when there is an active connection.

Using this command, either from rules, via http or mqtt, the text that is provided as content is completely sent to the network client. No extra data is added, other than any (system) variables that are included, being replaced.
"
"
``serialsendmix,'<content to send>'[,...]``

``<content to send>``: Text and/or hex byte(s) (having 0x prefix) that will be sent (nearly) unprocessed. Only the regular variable replacements will be applied before sending the content to the serial port.
","

This command requires quotes to be used if spaces or commas are part of the content.

Any data can be sent, even if it can not be typed in a text content, by specifying that as a separate argument: ``serialsendmix,'text, optionally including spaces or commas',0xXX,'0xXXxx XX,xx-XX:xx'``

``'text, optionally including spaces or commas'``: Any text content to be sent to the serial port. Can contain variables. Quotes are only required if spaces or commas (separators) are used.

``0xXX``: A single character in hexadecimal notation (range: 0x00..0xFF), that is appended to the data to send.

``'0xXXxx XX,xx-XX:xx'``: A sequence of hexadecimal values (range: 0x00..0xFF), that *can* be separated by a space, comma, dash, colon, semicolon or period, or are just entered adjecent. Only the first 2 characters should be ``0x`` or ``0X``, the rest is interpreted as hex bytes, and appended to the string to send. Quotes are only required if space or comma separators are used.
Using this command, either from rules, via http or mqtt, the text that is provided as content is completely sent to the serial port. No extra data is added, other than any (system) variables that are included, being replaced.
"
8 changes: 7 additions & 1 deletion docs/source/Plugin/P037.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,17 @@ Option: Limit events being generated

* **Max. # events in event queue**: As a protection against event-overflow this configures a check for the queue-length, so if more than the selected number of events is still in the queue, new events will be discarded until some events are processed, and the remaining is less than this count. When set to 0 this check is disabled.

Option: Modify separater character in events
Option: Modify separator character in events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* **To replace by comma in event**: Select a character that is to be replaced by a comma, before it is put into the event-queue. There is a limited set of characters that can be replaced, to avoid ending up with malformed events.

Available options:

.. image:: P037_ReplaceByCommaOptions.png

The available set of replacement characters is ``! @ $ % ^ & * ; : . | / \`` (exclamation, at, dollar, percent, caret, ampersand, semicolon, colon, period, pipe, slash and backslash). When set to None, no replacement will be done.

This can be used to 'transform' the content of a JSON message so the used separator is a comma, for easier use in rules.

Topic Subscriptions
Expand Down
Binary file added docs/source/Plugin/P037_ReplaceByCommaOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 32 additions & 7 deletions docs/source/Plugin/P044.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,55 @@ Supported hardware

|P044_usedby|

.. note:: This plugin is now merged (back) into :ref:`P020_page` where it initially was forked off from, with using some predefined settings.

Configuration
-------------

.. image:: P044_DeviceConfiguration.png

* **Name** In the Name field a unique name should be entered.

* **Enabled** When unchecked the plugin is not enabled.

Sensor
^^^^^^

See: :ref:`SerialHelper_page`

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

* **TCP Port**: The port for an external network client to read the data from, range 1..65535. The used port number must be unique within the device.

**TODO**: Complete this documentation...
* **Baud Rate / Serial config**: See *Serial helper configuration*, above.

.. Commands available
.. ^^^^^^^^^^^^^^^^^^
* **P1 #data event with message**: When enabled, the *P1 WiFi Gateway* Event Processing option will include the received message. **WARNING** This may easily cause memory overflow exceptions, especially when running on ESP8266 or other low-memory situations!

.. .. include:: P044_commands.repl
* **Process events without client**: By default, if no network client is connected, no serial data will be received and processed either. Enabling this option enables receiving data and generating events without a TCP client connected.

.. Events
.. ~~~~~~
* **RX Receive timeout (mSec)**: If parts of serial data packets are somewhat delayed, but should still be handled as a single message, then the delay to wait for the next part can be configured here. 0 disables the delay.

* **Reset target after init**: Select a GPIO pin that should be pulled low once during initialization of the plugin, used to synchronize the external serial data source with the plugin.

Led
^^^

* **Led enabled**: To enable a *data is being processed* activity led.

* **Led pin**: The GPIO pin the Led is connected to.

* **Led inverted**: Iverts the on/off state for the Led.

.. .. include:: P044_events.repl

Change log
----------

.. versionchanged:: 2.0
...

|changed| 2022-10-08: Merge of P020 and P044 to reduce code size and combine features, as P044 was initially started as a spin-off from P020, but not evolved with the P020 features.

|added|
Major overhaul for 2.0 release.

Expand Down
Binary file added docs/source/Plugin/P044_DeviceConfiguration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/Reference/Command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ P019 :ref:`P019_page`
.. include:: ../Plugin/P019_commands.repl


.. P020 :ref:`P020_page`
.. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
P020 :ref:`P020_page`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. .. include:: ../Plugin/P020_commands.repl
.. include:: ../Plugin/P020_commands.repl


P021 :ref:`P021_page`
Expand Down
23 changes: 12 additions & 11 deletions lib/ESPEasySerial/ESPEasySerialPort.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
#include "ESPEasySerialPort.h"

const __FlashStringHelper* ESPEasySerialPort_toString(ESPEasySerialPort port)
const __FlashStringHelper* ESPEasySerialPort_toString(ESPEasySerialPort port, bool shortName)
{
switch (port) {
case ESPEasySerialPort::not_set: break;
#if USES_I2C_SC16IS752
case ESPEasySerialPort::sc16is752: return F("I2C Serial");
case ESPEasySerialPort::sc16is752: return shortName ? F("seriali2c") : F("I2C Serial");
#endif // if USES_I2C_SC16IS752
#ifdef ESP8266
case ESPEasySerialPort::serial0_swap: return F("HW Serial0 swap");
case ESPEasySerialPort::serial0_swap: return shortName ? F("serial0swap") : F("HW Serial0 swap");
#endif // ifdef ESP8266
case ESPEasySerialPort::serial0: return F("HW Serial0");
case ESPEasySerialPort::serial0: return shortName ? F("serial0") : F("HW Serial0");
#if SOC_UART_NUM > 1
case ESPEasySerialPort::serial1: return F("HW Serial1");
case ESPEasySerialPort::serial1: return shortName ? F("serial1") : F("HW Serial1");
#endif // if SOC_UART_NUM > 1
#if SOC_UART_NUM > 2
case ESPEasySerialPort::serial2: return F("HW Serial2");
case ESPEasySerialPort::serial2: return shortName ? F("serial2") : F("HW Serial2");
#endif // if SOC_UART_NUM > 2
#if USES_SW_SERIAL
case ESPEasySerialPort::software: return F("SW Serial");
case ESPEasySerialPort::software: return shortName ? F("serialsw") : F("SW Serial");
#endif // if USES_SW_SERIAL
#if USES_HWCDC
case ESPEasySerialPort::usb_hw_cdc: return F("USB HWCDC");
case ESPEasySerialPort::usb_hw_cdc: return shortName ? F("serialhwcdc") : F("USB HWCDC");
#endif // if USES_HWCDC
#if USES_USBCDC
case ESPEasySerialPort::usb_cdc_0: return F("USB CDC");
// case ESPEasySerialPort::usb_cdc_1: return F("USB CDC1");
case ESPEasySerialPort::usb_cdc_0: return shortName ? F("serialcdc") : F("USB CDC");

// case ESPEasySerialPort::usb_cdc_1: return F("USB CDC1");
#endif // if USES_USBCDC
case ESPEasySerialPort::MAX_SERIAL_TYPE: break;

Expand Down Expand Up @@ -103,7 +104,7 @@ bool validSerialPort(ESPEasySerialPort port)
#endif // if USES_HWCDC
#if USES_USBCDC
case ESPEasySerialPort::usb_cdc_0:
// case ESPEasySerialPort::usb_cdc_1:
// case ESPEasySerialPort::usb_cdc_1:
#endif // if USES_USBCDC
return true;

Expand Down
2 changes: 1 addition & 1 deletion lib/ESPEasySerial/ESPEasySerialPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum class ESPEasySerialPort : uint8_t {
};


const __FlashStringHelper* ESPEasySerialPort_toString(ESPEasySerialPort port);
const __FlashStringHelper* ESPEasySerialPort_toString(ESPEasySerialPort port, bool shortName = false);

bool isHWserial(ESPEasySerialPort port);

Expand Down
Loading