Merge remote-tracking branch 'letscontrolit/mega' into bugfix/WiFi_state_machine

This commit is contained in:
TD-er
2026-01-05 23:09:55 +01:00
26 changed files with 403 additions and 81 deletions
+4 -4
View File
@@ -37,7 +37,7 @@ jobs:
make html
cd ..
zip -r -qq ESPEasy_docs.zip docs/build/*
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
with:
name: Documentation
path: ESPEasy_docs.zip
@@ -88,7 +88,7 @@ jobs:
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ matrix.chip }}
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
with:
# FIXME Workaround to (temporarily) not use # in the artifact name, see https://github.com/actions/upload-artifact/issues/473
name: Bin-${{ steps.string.outputs.uppercase }}-${{ matrix.env }}-${{ steps.date.outputs.builddate }}_PR_${{ github.event.number }}_${{ github.run_id }} # Sort by ESP type
@@ -110,7 +110,7 @@ jobs:
run: |
echo "builddate=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v6
uses: actions/download-artifact@v7
with:
path: artifacts/Binaries/bin/
pattern: Bin-*
@@ -119,7 +119,7 @@ jobs:
run: |
cd artifacts/Binaries/
ls -R
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
with:
# FIXME Workaround to (temporarily) not use # in the artifact name, see https://github.com/actions/upload-artifact/issues/473
name: ESPEasy-all-Binaries-${{ steps.date.outputs.builddate }}_PR_${{ github.event.number }}_${{ github.run_id }}
+4 -4
View File
@@ -58,7 +58,7 @@ jobs:
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ matrix.chip }}
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
with:
name: Bin-${{ steps.string.outputs.uppercase }}-${{ matrix.env }}
path: |
@@ -85,7 +85,7 @@ jobs:
cd dist
zip -r -qq ../ESPEasy_dist.zip *
cd ..
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
with:
name: Distribution
path: |
@@ -129,13 +129,13 @@ jobs:
run: |
echo "builddate=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Download all successfully compiled artifacts
uses: actions/download-artifact@v6
uses: actions/download-artifact@v7
with:
path: artifacts/bin/
pattern: Bin-*
merge-multiple: true
- name: Download dist and docs zip files
uses: actions/download-artifact@v6
uses: actions/download-artifact@v7
with:
path: distribution/
name: Distribution
+54 -6
View File
@@ -1,4 +1,4 @@
.. include:: ../Plugin/_plugin_substitutions_p05x.repl
.. include:: ../Plugin/_plugin_substitutions_p05x.repl
.. _P057_page:
|P057_typename|
@@ -26,10 +26,59 @@ Supported hardware
|P057_usedby|
.. Commands available
.. ^^^^^^^^^^^^^^^^^^
Introduction
------------
.. .. include:: P057_commands.repl
The HT16K33 16 port generic I/O chip can be configured to act as a LED driver or as a maxtrix-keyboard input. This plugin describes settings for it to be used as a LED / 7-segment display driver.
Configuration
-------------
.. image:: P057_DeviceConfiguration.png
Task settings
~~~~~~~~~~~~~
* **Name** The name of the task. This should be unique for all devices that are configured. (Initially empty)
* **Enabled** For the device to work it has to be enabled. When checked, the device will be started as soon as the ESP starts. If desired, the device can also be enabled from f.e. a rule by using the ``TaskEnable,<tasknr>`` or ``TaskEnable,<taskname>`` command, or disabled using the corresponding ``TaskDisable,<tasknr>|<taskname>`` commands.
I2C options
^^^^^^^^^^^
* **I2C Address**: Select the address the chip is set for, available options:
.. image:: P057_I2CAddressOptions.png
The available settings here depend on the build and hardware configuration 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
~~~~~~~~~~~~~~~
7-Seg. Clock
~~~~~~~~~~~~
* **Clock Type**: Select wether the time should be automatically displayed, in either 24h or 12h format, or ``none``, so other information can be shown, using the commands below.
* **Seg. for Xx:xx**: Choose the segment to be used for the 10-hour digit. Usually 0.
* **Seg. for xX:xx**: Choose the segment to be used for the hour digit. Usually 1.
* **Seg. for xx:Xx**: Choose the segment to be used for the 10-minutes digit. Usually 3 (when a colon is included).
* **Seg. for xx:xX**: Choose the segment to be used for the minutes digit. Usually 4 (when a colon is included).
* **Seg. for Colon**: Choose the segment to be used for the colon sign (if any). usually 2. And the value to be used for lighting up the colon. Usually (also) 2.
Commands available
^^^^^^^^^^^^^^^^^^
.. include:: P057_commands.repl
.. Events
.. ~~~~~~
@@ -42,8 +91,7 @@ Change log
.. versionchanged:: 2.0
...
|added|
Major overhaul for 2.0 release.
|added| 2025-12-29 Documentation added.
.. versionadded:: 1.0
...
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

+50
View File
@@ -0,0 +1,50 @@
.. csv-table::
:header: "Command Syntax", "Extra information"
:widths: 20, 30
"
| ``m,<param>[,<param>,<param>...]``
","
| Light up leds on the display, description of params below, all values treated as decimal.
| This is a low-level command, giving exact control over what led/segment is lit.
"
"
| ``mx,<param>[,<param>,<param>...]``
","
| Light up leds on the display, description of params below, all values treated as hexadecimal.
| This is a low-level command, giving exact control over what led/segment is lit.
"
"
| ``mnum,<param>[,<param>,<param>...]``
","
| Light up segments on the display, description of params below, all values to be used as numeric content for a 7-segment display.
"
"
| ``mprint,<text>``
","
| Light up numeric digits on a 7-segment display. If a colon is configured, and another character would land on that segment, then the colon-segment is skipped, a colon would be shown on the colon segment.
| This would be the standard command to display numeric data on the display, when not used in Clock-mode.
"
"
| ``mbr,<0..255>``
","
| Set the brightness of the display in given range, 0 is off, 255 is max. brightness.
"
"
| ``<param>``
","
| A ``<param>`` can be one of these:
| ``<value>`` : A numeric (or hexadecimal, without any prefix, for ``MX`` command) value, that is displayed starting on segment 0, auto-incrementing the segment for multiple values in a single command.
| ``<seg>=<value>`` : Address an explicit segment with a value.
| ``clear`` : Set all values to 0, turning off all leds/segments.
| ``test`` : Fill the leds/segments with a test-pattern.
| ``log`` : Write the current led-buffer values to the log (INFO level).
"
+14
View File
@@ -90,6 +90,18 @@ Statistic data is only visible if the plugin is configured and enabled.
This shows the latest data received and some statistics.
Data options
^^^^^^^^^^^^
(These options are only available if build is without ``LIMIT_BUILD_SIZE`` set)
* **Receive binary data**: When enabled accepts any character for input. Does not terminate on a CR character received, but on end of data (no more bytes available), or when using the **Fixed length input data** setting.
* **Fixed length input data**: When 0 this feature is disabled. When set > 0 (max. length 255 characters), reading is stopped after this number of characters. Best used for reading binary data.
* **Event with hex. data (no prefix)**: When checked will generate the event with the received data converted to hexadecimal data (length is doubled), without a prefix (often hex data is prefixed with ``0x``). Data is still filtered (when enabled) and proxied *without* conversion!
.. include:: DataAcquisition.repl
* **Interval** By default, Interval will be set to 60 sec.
@@ -226,6 +238,8 @@ Change log
.. versionchanged:: 2.0
...
|added| 2025-12-23 Add support for binary data, fixed length input and convert event data to hex.
|added| 2024-02-25 Add support for ``serialproxy_test`` command and retrieving the separate groups from parsed regex.
|added| 2023-03-22 Add support for writing any binary data out via the serial port.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 51 KiB

+4 -1
View File
@@ -28,9 +28,10 @@ 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, 135 x 240, 170 x 320 and 172 x 320 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.
* **ST77xx** (unknown if this is ST7735 or ST7789) with resolution of 170 x 320, 240 x 320, 240 x 280 pixels.
The plugin can be configured to show predefined text, a reservation for up to 24 lines is made, but only the lines that can fit on-screen will be shown, or via commands, sent via http or from rules, text or graphical elements like lines, rectangles, circles, pixels, etc., can be shown.
@@ -146,6 +147,8 @@ Available options:
* *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.
* *ST77xx 170 x 320px*: Added to support ST7789v3 / ST7735 displays with this specific resolution.
* *ST77xx 240 x 320px*: Added to support ST7789v3 / ST7735 displays with this specific resolution.
* *ST77xx 240 x 280px*: Added to support ST7789v3 / ST7735 displays 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.
@@ -56,9 +56,9 @@
.. |P003_compileinfo| replace:: `.`
.. |P003_usedlibraries| replace:: `.`
.. |P004_name| replace:: :cyan:`1-Wire Temperature`
.. |P004_name| replace:: :cyan:`DS18xxx/MAX31xxx/1-Wire Temperature`
.. |P004_type| replace:: :cyan:`Environment`
.. |P004_typename| replace:: :cyan:`Environment - 1-Wire Temperature`
.. |P004_typename| replace:: :cyan:`Environment - DS18xxx/MAX31xxx/1-Wire Temperature`
.. |P004_porttype| replace:: `1-Wire`
.. |P004_status| replace:: :green:`NORMAL` :yellow:`CLIMATE`
.. |P004_github| replace:: P004_Dallas.ino
@@ -93,7 +93,7 @@
.. |P087_type| replace:: :cyan:`Communication`
.. |P087_typename| replace:: :cyan:`Communication - SerialProxy`
.. |P087_porttype| replace:: `Serial`
.. |P087_status| replace:: :yellow:`COLLECTION C`
.. |P087_status| replace:: :yellow:`COLLECTION C` :yellow:`ENERGY`
.. |P087_github| replace:: P087_SerialProxy.ino
.. _P087_github: https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P087_SerialProxy.ino
.. |P087_usedby| replace:: `.`
+1 -1
View File
@@ -21,7 +21,7 @@ import sphinx_bootstrap_theme
# -- Project information -----------------------------------------------------
project = u'ESP Easy'
copyright = u'2018-2025, ESP Easy'
copyright = u'2018-2026, ESP Easy'
author = u'Grovkillen, TD-er & Friends'
# The short X.Y version
+74 -4
View File
@@ -206,6 +206,22 @@ static const uint8_t PROGMEM
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
320 >> 8, 320 & 0xFF }, // XEND = 320
Rcmd2black240x320[] = { // 7735R init, part 2 (mini 240x320)
2, // 2 commands in list:
ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 240, // XEND = 240
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
320 >> 8, 320 & 0xFF }, // XEND = 320
Rcmd2black240x280[] = { // 7735R init, part 2 (mini 240x280)
2, // 2 commands in list:
ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 240, // XEND = 240
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
280 >> 8, 280 & 0xFF }, // XEND = 240
#endif // if ST7735_EXTRA_INIT
Rcmd3[] = { // 7735R init, part 3 (red or green tab)
@@ -292,6 +308,20 @@ 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_BLACKTAB240x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_240;
displayInit(Rcmd2black240x320);
const uint8_t data = 0x00;
sendCommand(ST77XX_INVON, &data, 0);
sendCommand(ST77XX_INVON, &data, 0); // Write twice...
} else if (options == INITR_BLACKTAB240x280) {
_height = ST7735_TFTHEIGHT_280;
_width = ST7735_TFTWIDTH_240;
displayInit(Rcmd2black240x280);
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
@@ -339,7 +369,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) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320)) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320) || (tabcolor == INITR_BLACKTAB240x320) || (tabcolor == INITR_BLACKTAB240x280)) {
madctl = ST77XX_MADCTL_MY | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -368,6 +398,16 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_width = ST7735_TFTWIDTH_170;
_colstart = 35;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x280) {
_height = ST7735_TFTHEIGHT_280;
_width = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 20;
#endif // if ST7735_EXTRA_INIT
} else {
_height = ST7735_TFTHEIGHT_160;
@@ -380,7 +420,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) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320)) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320) || (tabcolor == INITR_BLACKTAB240x320) || (tabcolor == INITR_BLACKTAB240x280)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -409,6 +449,16 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_height = ST7735_TFTWIDTH_170;
_colstart = 35;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x320) {
_width = ST7735_TFTHEIGHT_320;
_height = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x280) {
_width = ST7735_TFTHEIGHT_280;
_height = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 20;
#endif // if ST7735_EXTRA_INIT
} else {
_width = ST7735_TFTHEIGHT_160;
@@ -421,7 +471,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) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320)) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320) || (tabcolor == INITR_BLACKTAB240x320) || (tabcolor == INITR_BLACKTAB240x280)) {
madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -450,6 +500,16 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_width = ST7735_TFTWIDTH_170;
_colstart = 35;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x320) {
_height = ST7735_TFTHEIGHT_320;
_width = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x280) {
_height = ST7735_TFTHEIGHT_280;
_width = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 20;
#endif // if ST7735_EXTRA_INIT
} else {
_height = ST7735_TFTHEIGHT_160;
@@ -462,7 +522,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) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320)) {
} else if ((tabcolor == INITR_BLACKTAB135x240) || (tabcolor == INITR_BLACKTAB172x320) || (tabcolor == INITR_BLACKTAB170x320) || (tabcolor == INITR_BLACKTAB240x320) || (tabcolor == INITR_BLACKTAB240x280)) {
madctl = ST77XX_MADCTL_RGB;
#endif // if ST7735_EXTRA_INIT
} else {
@@ -491,6 +551,16 @@ void Adafruit_ST7735::setRotation(uint8_t m) {
_height = ST7735_TFTWIDTH_170;
_colstart = 35;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x320) {
_width = ST7735_TFTHEIGHT_320;
_height = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 0;
} else if (tabcolor == INITR_BLACKTAB240x280) {
_width = ST7735_TFTHEIGHT_280;
_height = ST7735_TFTWIDTH_240;
_colstart = 0;
_rowstart = 20;
#endif // if ST7735_EXTRA_INIT
} else {
_width = ST7735_TFTHEIGHT_160;
+2
View File
@@ -33,6 +33,8 @@
#define INITR_BLACKTAB135x240 0x07
#define INITR_BLACKTAB172x320 0x08
#define INITR_BLACKTAB170x320 0x09
#define INITR_BLACKTAB240x320 0x0A
#define INITR_BLACKTAB240x280 0x0B
// Some register settings
#define ST7735_MADCTL_BGR 0x08
+2
View File
@@ -36,9 +36,11 @@
#define ST7735_TFTWIDTH_135 135
#define ST7735_TFTWIDTH_172 172
#define ST7735_TFTWIDTH_170 170
#define ST7735_TFTWIDTH_240 240
#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_280 280
#define ST7735_TFTHEIGHT_320 320
#define ST_CMD_DELAY 0x80 // special signifier for command lists
+1 -1
View File
@@ -24,7 +24,7 @@
# define PLUGIN_004
# define PLUGIN_ID_004 4
# define PLUGIN_NAME_004 "Environment - 1-Wire Temperature"
# define PLUGIN_NAME_004 "Environment - DS18xxx/MAX31xxx/1-Wire Temperature"
# define PLUGIN_VALUENAME1_004 "Temperature"
# define P004_ERROR_NAN 0
+37 -22
View File
@@ -11,6 +11,8 @@
/**
* Changelog:
* 2025-12-22 tonhuisman: Add support for receiving binary data, fixed length receive and sending events with hex data
* Moved most #define variables to P087_data_struct.h
* 2025-01-12 tonhuisman: Add support for MQTT AutoDiscovery (not supported for Serial Proxy)
* 2024-02-27 tonhuisman: Always process the regular expression like 'Global Match' to enable retrieving the available values
* 2024-02-26 tonhuisman: Apply log-string and other code optimizations
@@ -38,19 +40,6 @@
# define PLUGIN_NAME_087 "Communication - Serial Proxy"
# define P087_BAUDRATE PCONFIG_LONG(0)
# define P087_BAUDRATE_LABEL PCONFIG_LABEL(0)
# define P087_SERIAL_CONFIG PCONFIG_LONG(1)
# define P087_QUERY_VALUE 0 // Temp placement holder until we know what selectors are needed.
# define P087_NR_OUTPUT_OPTIONS 1
# define P087_NR_OUTPUT_VALUES 1
# define P087_QUERY1_CONFIG_POS 3
# define P087_DEFAULT_BAUDRATE 38400
// Plugin settings:
// Validate:
// - [0..9]
@@ -168,6 +157,14 @@ boolean Plugin_087(uint8_t function, struct EventStruct *event, String& string)
addFormSubHeader(F("Statistics"));
P087_html_show_stats(event);
# ifndef LIMIT_BUILD_SIZE
addFormSubHeader(F("Data options"));
addFormCheckBox(F("Receive binary data"), P087_READ_BIN_LABEL, P087_CONFIG_GET_READ_BIN);
addFormNumericBox(F("Fixed length input data"), P087_FIXED_LENGTH_LABEL, P087_CONFIG_GET_FIXED_LENGTH, 0, 255);
addUnit(F("0 = off, max. 255"));
addFormCheckBox(F("Event with hex. data (no prefix)"), P087_EVENT_HEX_LABEL, P087_CONFIG_GET_EVENT_HEX);
# endif // ifndef LIMIT_BUILD_SIZE
success = true;
break;
}
@@ -175,6 +172,11 @@ boolean Plugin_087(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_WEBFORM_SAVE: {
P087_BAUDRATE = getFormItemInt(P087_BAUDRATE_LABEL);
P087_SERIAL_CONFIG = serialHelper_serialconfig_webformSave();
# ifndef LIMIT_BUILD_SIZE
P087_CONFIG_SET_READ_BIN(isFormItemChecked(P087_READ_BIN_LABEL));
P087_CONFIG_SET_FIXED_LENGTH(getFormItemInt(P087_FIXED_LENGTH_LABEL));
P087_CONFIG_SET_EVENT_HEX(isFormItemChecked(P087_EVENT_HEX_LABEL));
# endif // ifndef LIMIT_BUILD_SIZE
P087_data_struct *P087_data =
static_cast<P087_data_struct *>(getPluginTaskData(event->TaskIndex));
@@ -207,6 +209,15 @@ boolean Plugin_087(uint8_t function, struct EventStruct *event, String& string)
if (P087_data->init(port, serial_rx, serial_tx, P087_BAUDRATE, static_cast<uint8_t>(P087_SERIAL_CONFIG))) {
LoadCustomTaskSettings(event->TaskIndex, P087_data->_lines, P87_Nlines, 0);
P087_data->post_init();
# ifndef LIMIT_BUILD_SIZE
P087_data->setHandleBinary(P087_CONFIG_GET_READ_BIN);
P087_data->setEventAsHex(P087_CONFIG_GET_EVENT_HEX);
if (P087_CONFIG_GET_FIXED_LENGTH > 0) {
P087_data->setMaxLength(P087_CONFIG_GET_FIXED_LENGTH);
}
P087_data->setFixedLength(P087_CONFIG_GET_FIXED_LENGTH);
# endif // ifndef LIMIT_BUILD_SIZE
success = true;
serialHelper_log_GpioDescription(port, serial_rx, serial_tx);
} else {
@@ -216,17 +227,15 @@ boolean Plugin_087(uint8_t function, struct EventStruct *event, String& string)
}
case PLUGIN_FIFTY_PER_SECOND: {
if (Settings.TaskDeviceEnabled[event->TaskIndex]) {
P087_data_struct *P087_data =
static_cast<P087_data_struct *>(getPluginTaskData(event->TaskIndex));
P087_data_struct *P087_data =
static_cast<P087_data_struct *>(getPluginTaskData(event->TaskIndex));
if ((nullptr != P087_data) && P087_data->loop()) {
Scheduler.schedule_task_device_timer(event->TaskIndex, millis() + 10);
delay(0); // Processing a full sentence may take a while, run some
// background tasks.
}
success = true;
if ((nullptr != P087_data) && P087_data->loop()) {
Scheduler.schedule_task_device_timer(event->TaskIndex, millis() + 10);
delay(0); // Processing a full sentence may take a while, run some
// background tasks.
}
success = true;
break;
}
@@ -237,6 +246,12 @@ boolean Plugin_087(uint8_t function, struct EventStruct *event, String& string)
if ((nullptr != P087_data) && P087_data->getSentence(event->String2)) {
if (Plugin_087_match_all(event->TaskIndex, event->String2)) {
// sendData(event);
# ifndef LIMIT_BUILD_SIZE
if (P087_data->isEventAsHex() && !event->String2.isEmpty()) { // Convert to hex without prefix
event->String2 = formatToHex_array(reinterpret_cast<const uint8_t *>(&event->String2[0]), event->String2.length());
}
# endif // ifndef LIMIT_BUILD_SIZE
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_DEBUG, event->String2);
# endif // ifndef BUILD_NO_DEBUG
+12 -6
View File
@@ -152,6 +152,8 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
ST77xx_type_toString(ST77xx_type_e::ST7735s_135x240),
ST77xx_type_toString(ST77xx_type_e::ST7735s_172x320),
ST77xx_type_toString(ST77xx_type_e::ST77xxs_170x320),
ST77xx_type_toString(ST77xx_type_e::ST77xxs_240x320),
ST77xx_type_toString(ST77xx_type_e::ST77xxs_240x280),
# endif // if P116_EXTRA_ST7735
ST77xx_type_toString(ST77xx_type_e::ST7789vw_240x320),
ST77xx_type_toString(ST77xx_type_e::ST7789vw_240x240),
@@ -173,6 +175,8 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
static_cast<int>(ST77xx_type_e::ST7735s_135x240),
static_cast<int>(ST77xx_type_e::ST7735s_172x320),
static_cast<int>(ST77xx_type_e::ST77xxs_170x320),
static_cast<int>(ST77xx_type_e::ST77xxs_240x320),
static_cast<int>(ST77xx_type_e::ST77xxs_240x280),
# endif // if P116_EXTRA_ST7735
static_cast<int>(ST77xx_type_e::ST7789vw_240x320),
static_cast<int>(ST77xx_type_e::ST7789vw_240x240),
@@ -188,8 +192,8 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
constexpr int optCount4 = NR_ELEMENTS(optionValues4);
const FormSelectorOptions selector(optCount4, options4, optionValues4);
selector.addFormSelector(F("TFT display model"),
F("type"),
P116_CONFIG_FLAG_GET_TYPE);
F("type"),
P116_CONFIG_FLAG_GET_TYPE);
}
addFormSubHeader(F("Layout"));
@@ -277,16 +281,18 @@ boolean Plugin_116(uint8_t function, struct EventStruct *event, String& string)
# endif // if ADAGFX_FONTS_INCLUDED
uint32_t lSettings = 0;
uint16_t _type = getFormItemInt(F("type"));
bitWrite(lSettings, P116_CONFIG_FLAG_NO_WAKE, !isFormItemChecked(F("NoDisplay"))); // Bit 0 NoDisplayOnReceivingText,
// reverse logic, default=checked!
bitWrite(lSettings, P116_CONFIG_FLAG_INVERT_BUTTON, isFormItemChecked(F("buttonInverse"))); // Bit 1 buttonInverse
bitWrite(lSettings, P116_CONFIG_FLAG_CLEAR_ON_EXIT, isFormItemChecked(F("clearOnExit"))); // Bit 2 ClearOnExit
bitWrite(lSettings, P116_CONFIG_FLAG_USE_COL_ROW, isFormItemChecked(F("colrow"))); // Bit 3 Col/Row addressing
set4BitToUL(lSettings, P116_CONFIG_FLAG_MODE, getFormItemInt(F("mode"))); // Bit 4..7 Text print mode
set4BitToUL(lSettings, P116_CONFIG_FLAG_ROTATION, getFormItemInt(F("rotate"))); // Bit 8..11 Rotation
set4BitToUL(lSettings, P116_CONFIG_FLAG_FONTSCALE, getFormItemInt(F("fontscale"))); // Bit 12..15 Font scale
set4BitToUL(lSettings, P116_CONFIG_FLAG_TYPE, getFormItemInt(F("type"))); // Bit 16..19 Hardwaretype
set4BitToUL(lSettings, P116_CONFIG_FLAG_MODE, getFormItemInt(F("mode"))); // Bit 4..7 Text print mode
set4BitToUL(lSettings, P116_CONFIG_FLAG_ROTATION, getFormItemInt(F("rotate"))); // Bit 8..11 Rotation
set4BitToUL(lSettings, P116_CONFIG_FLAG_FONTSCALE, getFormItemInt(F("fontscale"))); // Bit 12..15 Font scale
set4BitToUL(lSettings, P116_CONFIG_FLAG_TYPE, _type); // Bit 16..19 Hardwaretype
set2BitToUL(lSettings, P116_CONFIG_FLAG_TYPE2, (_type >> 4)); // Bit 29..30 Hardwaretype extension
set4BitToUL(lSettings, P116_CONFIG_FLAG_CMD_TRIGGER, getFormItemInt(F("commandtrigger"))); // Bit 20..23 Command trigger
bitWrite(lSettings, P116_CONFIG_FLAG_BACK_FILL, !isFormItemChecked(F("backfill"))); // Bit 28 Back fill text (inv)
+3
View File
@@ -1899,6 +1899,9 @@ To create/register a plugin, you have to :
#ifndef USES_P085
#define USES_P085 // AcuDC24x
#endif
#if !defined(USES_P087) && defined(ESP32)
#define USES_P087 // SerialProxy
#endif
#ifndef USES_P089
#define USES_P089 // Ping
#endif
+6 -1
View File
@@ -1566,7 +1566,7 @@ bool AdafruitGFX_helper::processCommand(const String& string) {
break;
case adagfx_commands_e::tpm: // tpm: Text Print Mode
if ((argCount == 1) && ((nParams[0] < 0) || (nParams[0] >= static_cast<int>(AdaGFXTextPrintMode::MAX)))) {
if ((argCount == 1) && !((nParams[0] < 0) || (nParams[0] >= static_cast<int>(AdaGFXTextPrintMode::MAX)))) {
_textPrintMode = static_cast<AdaGFXTextPrintMode>(nParams[0]);
_display->setTextWrap(_textPrintMode == AdaGFXTextPrintMode::ContinueToNextLine);
success = true;
@@ -2636,6 +2636,11 @@ void AdafruitGFX_helper::printText(const char *string,
_display->getTextBounds(newString, _x, _y, &xText, &yText, &wText, &hText); // Calculate length
if ((hText < hChar1) && _columnRowMode) { // If the text-height is lower than the default height
yText -= (hChar1 - hText); // Subtract height-difference between A and current height
hText = hChar1; // Use default height
}
if ((maxWidth > 0) && ((_x - xOffset) + maxWidth <= res_x)) {
res_x = (_x - xOffset) + maxWidth;
_w = maxWidth;
+47 -26
View File
@@ -106,42 +106,53 @@ bool P087_data_struct::loop() {
while (available > 0 && !fullSentenceReceived) {
// Look for end marker
char c = easySerial->read();
uint8_t c = easySerial->read();
--available;
if (available == 0) {
available = easySerial->available();
delay(0);
}
const size_t length = sentence_part.length();
# ifdef LIMIT_BUILD_SIZE
const bool addCharacter = (10u != c);
const bool finished = (13u == c);
# else // ifdef LIMIT_BUILD_SIZE
const bool addCharacter = (10u != c) || handle_binary; // Skip LF in ascii-mode
bool finished = (13u == c) && !handle_binary; // Done on CR in ascii-mode
switch (c) {
case 13:
{
const size_t length = sentence_part.length();
bool valid = length > 0;
if (0 != fixed_length) {
finished = (length == fixed_length);
for (size_t i = 0; i < length && valid; ++i) {
if ((sentence_part[i] > 127) || (sentence_part[i] < 32)) {
sentence_part = EMPTY_STRING;
++sentences_received_error;
valid = false;
}
}
if (valid) {
fullSentenceReceived = true;
last_sentence = sentence_part;
sentence_part = EMPTY_STRING;
}
break;
if (finished) {
available = 0; // Forced exit
}
case 10:
}
# endif // ifdef LIMIT_BUILD_SIZE
// Ignore LF
break;
default:
sentence_part += c;
break;
if (finished) {
bool valid = length > 0;
for (size_t i = 0; i < length && valid
# ifndef LIMIT_BUILD_SIZE
&& !handle_binary // Skip valid-ascii check
# endif // ifndef LIMIT_BUILD_SIZE
; ++i) {
if ((sentence_part[i] > 127) || (sentence_part[i] < 32)) {
sentence_part = EMPTY_STRING;
++sentences_received_error;
valid = false;
}
}
if (valid) {
fullSentenceReceived = true;
last_sentence = sentence_part;
sentence_part = EMPTY_STRING;
}
}
else if (addCharacter) {
sentence_part += static_cast<char>(c);
}
if (max_length_reached()) { fullSentenceReceived = true; }
@@ -152,6 +163,16 @@ bool P087_data_struct::loop() {
++sentences_received;
length_last_received = last_sentence.length();
}
# ifndef LIMIT_BUILD_SIZE
else if (handle_binary && last_sentence.isEmpty() && !sentence_part.isEmpty()) { // Receive binary data (no end-marker)
fullSentenceReceived = true;
last_sentence = sentence_part;
sentence_part = EMPTY_STRING;
++sentences_received;
length_last_received = last_sentence.length();
}
# endif // ifndef LIMIT_BUILD_SIZE
return fullSentenceReceived;
}
+49
View File
@@ -21,6 +21,31 @@
# define P87_Nchars 128
# define P87_MAX_CAPTURE_INDEX 32
# define P087_BAUDRATE PCONFIG_LONG(0)
# define P087_BAUDRATE_LABEL PCONFIG_LABEL(0)
# define P087_SERIAL_CONFIG PCONFIG_LONG(1)
# define P087_QUERY_VALUE 0 // Temp placement holder until we know what selectors are needed.
# define P087_NR_OUTPUT_OPTIONS 1
# define P087_NR_OUTPUT_VALUES 1
# define P087_QUERY1_CONFIG_POS 3
# define P087_DEFAULT_BAUDRATE 38400
# define P087_READ_BIN_LABEL PCONFIG_LABEL(1)
# define P087_EVENT_HEX_LABEL PCONFIG_LABEL(2)
# define P087_FIXED_LENGTH_LABEL PCONFIG_LABEL(3)
# define P087_CONFIG_FLAGS PCONFIG_ULONG(2)
# define P087_FLAG_READ_BIN 0
# define P087_FLAG_EVENT_HEX 1
# define P087_FLAG_FIXED_LENGTH 2 // 8 bit
# define P087_CONFIG_SET_READ_BIN(S) (bitWrite(P087_CONFIG_FLAGS, P087_FLAG_READ_BIN, (S)))
# define P087_CONFIG_GET_READ_BIN (bitRead(P087_CONFIG_FLAGS, P087_FLAG_READ_BIN))
# define P087_CONFIG_SET_EVENT_HEX(S) (bitWrite(P087_CONFIG_FLAGS, P087_FLAG_EVENT_HEX, (S)))
# define P087_CONFIG_GET_EVENT_HEX (bitRead(P087_CONFIG_FLAGS, P087_FLAG_EVENT_HEX))
# define P087_CONFIG_SET_FIXED_LENGTH(S) (set8BitToUL(P087_CONFIG_FLAGS, P087_FLAG_FIXED_LENGTH, (S)))
# define P087_CONFIG_GET_FIXED_LENGTH (get8BitFromUL(P087_CONFIG_FLAGS, P087_FLAG_FIXED_LENGTH))
enum P087_Filter_Comp {
Equal = 0,
@@ -115,6 +140,25 @@ public:
bool plugin_get_config_value(struct EventStruct *event,
String & string);
# ifndef LIMIT_BUILD_SIZE
void setHandleBinary(bool state) {
handle_binary = state;
}
void setEventAsHex(bool state) {
event_hex = state;
}
bool isEventAsHex() const {
return event_hex;
}
void setFixedLength(uint8_t value) {
fixed_length = value;
}
# endif // ifndef LIMIT_BUILD_SIZE
private:
bool max_length_reached() const;
@@ -133,6 +177,11 @@ private:
bool capture_index_used[P87_MAX_CAPTURE_INDEX] = { 0 };
bool capture_index_must_not_match[P87_MAX_CAPTURE_INDEX] = { 0 };
bool regex_empty = false;
# ifndef LIMIT_BUILD_SIZE
bool handle_binary = false;
bool event_hex = false;
uint8_t fixed_length{};
# endif // ifndef LIMIT_BUILD_SIZE
};
@@ -15,6 +15,8 @@ const __FlashStringHelper* ST77xx_type_toString(const ST77xx_type_e& device) {
case ST77xx_type_e::ST7735s_135x240: return F("ST7735 135 x 240px");
case ST77xx_type_e::ST7735s_172x320: return F("ST7735 172 x 320px");
case ST77xx_type_e::ST77xxs_170x320: return F("ST77xx 170 x 320px");
case ST77xx_type_e::ST77xxs_240x320: return F("ST77xx 240 x 320px");
case ST77xx_type_e::ST77xxs_240x280: return F("ST77xx 240 x 280px");
# 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");
@@ -83,6 +85,14 @@ void ST77xx_type_toResolution(const ST77xx_type_e& device,
x = 170;
y = 320;
break;
case ST77xx_type_e::ST77xxs_240x320:
x = 240;
y = 320;
break;
case ST77xx_type_e::ST77xxs_240x280:
x = 240;
y = 280;
break;
# endif // if P116_EXTRA_ST7735
case ST77xx_type_e::ST7796s_320x480:
x = 320;
@@ -201,6 +211,20 @@ bool P116_data_struct::plugin_init(struct EventStruct *event) {
initRoptions = INITR_BLACKTAB170x320; // 170x320px
}
// fall through
case ST77xx_type_e::ST77xxs_240x320:
if (initRoptions == 0xFF) {
initRoptions = INITR_BLACKTAB240x320; // 240x320px
}
// fall through
case ST77xx_type_e::ST77xxs_240x280:
if (initRoptions == 0xFF) {
initRoptions = INITR_BLACKTAB240x280; // 240x280px
}
// fall through
# endif // if P116_EXTRA_ST7735
case ST77xx_type_e::ST7735s_80x160:
+5 -1
View File
@@ -57,12 +57,14 @@
# define P116_CONFIG_FLAG_TYPE 16 // Flag-offset to store 4 bits for Hardwaretype, uses bits 16, 17, 18 and 19
# define P116_CONFIG_FLAG_CMD_TRIGGER 20 // Flag-offset to store 4 bits for Command trigger, uses bits 20, 21, 22 and 23
# define P116_CONFIG_FLAG_BACK_FILL 28 // Flag: Background fill when printing text
# define P116_CONFIG_FLAG_TYPE2 29 // Flag-offset to store 2 more bits for Hardwaretype, uses bits 29 and 30
// Getters
# define P116_CONFIG_FLAG_GET_MODE (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_MODE))
# define P116_CONFIG_FLAG_GET_ROTATION (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_ROTATION))
# define P116_CONFIG_FLAG_GET_FONTSCALE (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_FONTSCALE))
# define P116_CONFIG_FLAG_GET_TYPE (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_TYPE))
# define P116_CONFIG_FLAG_GET_TYPE (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_TYPE) \
+ (get2BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_TYPE2) << 4))
# define P116_CONFIG_FLAG_GET_CMD_TRIGGER (get4BitFromUL(P116_CONFIG_FLAGS, P116_CONFIG_FLAG_CMD_TRIGGER))
# define P116_CONFIG_GET_COLOR_FOREGROUND (P116_CONFIG_COLORS & 0xFFFF)
# define P116_CONFIG_GET_COLOR_BACKGROUND ((P116_CONFIG_COLORS >> 16) & 0xFFFF)
@@ -103,6 +105,8 @@ enum class ST77xx_type_e : uint8_t {
ST7735s_135x240 = 12u,
ST7735s_172x320 = 13u,
ST77xxs_170x320 = 14u,
ST77xxs_240x320 = 15u,
ST77xxs_240x280 = 16u,
# endif // if P116_EXTRA_ST7735
};
+7 -1
View File
@@ -137,7 +137,13 @@ void handle_metrics_devices() {
addHtml(F("{valueName=\""));
addHtml(Cache.getTaskDeviceValueName(x, varNr));
addHtml(F("\"} "));
addHtml(formatUserVarNoCheck(&TempEvent, varNr));
const String value(formatUserVarNoCheck(&TempEvent, varNr));
if (value.isEmpty()) {
addHtml('0'); // Return 0 for not-set values
} else {
addHtml(value);
}
addHtml('\n');
}
}