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

[P073] Add support for 74HC595 displays #5091

Open
wants to merge 27 commits into
base: mega
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
70df6a1
[P073] Add support for 74HC595 displays
tonhuisman Jul 26, 2024
06c09b3
[P073] Disable debug log
tonhuisman Jul 26, 2024
ee029cb
[P073] Make build fit again (part 1)
tonhuisman Jul 27, 2024
85f0a71
[P073] Make build fit again (part 2)
tonhuisman Jul 27, 2024
48ffe22
[P094] Remove from Collection D for ESP8266 buildsize
tonhuisman Jul 28, 2024
d8173d9
[P073] Move most code to PluginStruct files, explicit compile-time de…
tonhuisman Jul 28, 2024
602dd5d
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Jul 28, 2024
ba7a997
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 6, 2024
07b95d7
[P073] Make 7-segment font functions publicly available
tonhuisman Aug 6, 2024
9759ec6
[P073] Separate 74HC595 multiplexed displays, code improvements
tonhuisman Aug 6, 2024
fc49d9c
[P073] Update documentation
tonhuisman Aug 6, 2024
bca88f3
[P073] Disable 74HC595 displays for now
tonhuisman Aug 6, 2024
dd31fc0
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 9, 2024
4700baf
[P073] Add double-buffering for 74HC595 displays
tonhuisman Aug 9, 2024
00735ad
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Aug 23, 2024
7210e8e
[P073] Make some functions available externally, fix 74HC595 matrix d…
tonhuisman Aug 23, 2024
5c11982
[P073] Fine-tuning and allow to include 74HC595 in ESP8266 Custom builds
tonhuisman Aug 24, 2024
9aca590
[P073] Make P073_revert7bits() available for global use
tonhuisman Sep 1, 2024
a58fec9
[P073] Fix copy/paste error
tonhuisman Sep 1, 2024
b3f5363
[P073] Use more efficient bit-revert algorithm, as suggested
tonhuisman Sep 2, 2024
bf5b003
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Sep 27, 2024
b9e4880
[P073] Add option for time-blinking the second dot instead of the colon
tonhuisman Sep 27, 2024
11c2a30
[P073] Use DIRECT_PIN_IO for TM1637 displays for better timing accuracy
tonhuisman Sep 28, 2024
1270445
[P073] Update documentation
tonhuisman Sep 28, 2024
564d9c8
[P073] Should use the public function
tonhuisman Sep 28, 2024
a9a5aad
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 1, 2024
a8a111a
Merge branch 'mega' into feature/P073-add-support-for-74hc595-displays
tonhuisman Oct 31, 2024
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
67 changes: 43 additions & 24 deletions docs/source/Plugin/P073.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ Used libraries: |P073_usedlibraries|
Description
-----------

The 7 segment display plugin allows to display date, time, temperatures, numbers, text and self-created shapes on a 7 segment LED display, using either a TM1637 or MAX7219 driver.
The 7 segment display plugin allows to display date, time, temperatures, numbers, text and self-created shapes on a 7 segment LED display, using a TM1637, MAX7219 or 74HC595 driver.

Depending on the available space in the release, some features may not be available.

Currently 3 fonts are available for presenting text on the display, where the character shapes are somewhat different, and a choice can be made on what font is the most appropriate for the intended purpose. The numbers in the fonts are all equal.

When text to be displayed can't fit on the width of the display (4, 6 or 8 digits), scrolling text can be used so longer messages are shown like a ticker-tape display.
When text to be displayed can't fit on the width of the display (2, 3, 4, 5, 6, 7 or 8 digits), scrolling text can be used so longer messages are shown like a ticker-tape display. Scrolling is always from right to left, and optionally starts with an empty display, so text can be read as it scrolls in.

Optionally, periods in text can be shown on the dots of the display, when available (not all 7 segment display have dots).

For temperature display commands, ``7dt,<temp>`` and ``7ddt,<temp1>,<temp2>``, the degree symbol after the temperature can be turned off so there's room for 1 more digit of temperature on the display.
For temperature display commands, ``7dt,<temp>`` and ``7ddt,<temp1>,<temp2>``, the degree symbol after the temperature can be turned off so there's room for 1 more digit of temperature on the display. The degree symbol is always turned off for 2 and 3 digit displays.

Configuration
^^^^^^^^^^^^^^
Expand All @@ -47,14 +47,39 @@ Configuration

* **1st/2nd/3rd GPIO**: How the display is connected can be configured here. Description per module type is in the Notes below the GPIO fields.

For the MAX7219 displays, the DIN-Pin and CLK-Pin can be shared when multiple displays are connected, but each display's CS-Pin must be connected to a unique GPIO of the unit.
For the MAX7219 and 74HC595 displays, the DIN/SDI/DIO-Pin and (S)CLK-Pin can be shared when multiple displays are connected, but each display's CS/LOAD/RCLK-Pin must be connected to a unique GPIO of the unit.

For TM1637 display possibly the DIN-Pin GPIO's can be shared, but that's untested, so it is more safe to use separate GPIOs for each display.

**Display Type**: Select the type of display that's connected. 4 models are supported:
* **Display Type**: Select the type of display that's connected. 5 models are supported:

.. image:: P073_DisplayTypes.png

* **Nr. of digits**: If the **Display Type** *74HC595* is selected, and the page is submitted, this setting is made visible to select the number of digits available in the display used. These are the available options:

.. image:: P073_NrOfDigitsOptions.png

* *2*: 2 digits, the smallest supported display

* *2+2*: 2 displays using 2 digits connected sequentially (SDO of first display to SDI of second display), making a total of 4 digits.

* *3*: 3 digits. The 2 and 3 digits displays use 2 or 3 74HC505 chips sequentially, to control a single digit per chip.

* *4 multiplexed*: 4 digits. The 4, 6 and 8 digit display use a multiplexed setup, using 2 74HC595 chips per board, 1 controlling the digit leds, and 1 controlling the digit selected. These multiplexed displays need to be refreshed continuously to properly display the intended data, causing some extra load on the ESP.

* *2+3 / 3+2*: 2 displays with 2 and 3 digits or 3 and 2 digits connected sequentially (SDO to SDI), effectively giving a usable display of 5 digits.

* *6 multiplexed*: 6 digits, multiplexed display.

* *3+3*: 6 digits, 2 boards with 3 digits connected sequentially (SDO to SDI).

* *3+4 / 4+3*: 7 digits, 2 boards with 3 and 4 digits connected sequentially (SDO to SDI).

* *4+4*: 8 digits, 2 boards with 4 digits connected sequentially (SDO to SDI).

* *8 multiplexed*: 8 digits, multiplexed display. This display, and the 4+4 combination, also supports the ``7ddt`` command for displaying dual temperatures.


* **Display Output**: Here the type of output can be selected:

.. image:: P073_DisplayOutput.png
Expand All @@ -71,13 +96,13 @@ For TM1637 display possibly the DIN-Pin GPIO's can be shared, but that's unteste

*Date*: Displays the current date.

*NB: Clock and Date outputs assume the NTP option is enabled in Tools/Advanced.*
*NB: Clock and Date outputs assume a time-source is available, f.e. the via NTP or External Time Source settings in Tools/Advanced, by connecting a GPS module, or via the ESPEasy P2P network.*

The Clock and Date outputs are updated every second, and the blinking selections are 1 second on then 1 second off.

Clock and Date formats are optimized for each Display Type to fill the display efficiently.
Clock and Date formats are optimized for each Display Type to fill the display efficiently, but won't properly fit on the 2 and 3 digit displays.

* **Brightness**: The brightness level of the display can be set here. 0 is 'Default' brightness, 1..15 from low to high brightness.
* **Brightness**: The brightness level of the display can be set here. 0 is 'Default' brightness, 1..15 from low to high brightness. Displays using 74HC595 ignore this **Brightness** setting!

* **Font set**: Select the font set from this list:

Expand Down Expand Up @@ -108,10 +133,12 @@ Options

* **Text show periods as dot**: Enables the use of the display dots when periods are included in ``7dtext,<text>`` command.

* **Hide ° for Temperatures**: Will leave out the degree symbol from the display for temperature commands ``7dt,<temp>`` (and ``7ddt,<temp1>,<temp2>`` when available), allowing 1 more digit for actual temperature display.
* **Hide ° for Temperatures**: Will leave out the degree symbol from the display for temperature commands ``7dt,<temp>`` (and ``7ddt,<temp1>,<temp2>`` when available), allowing 1 more digit for actual temperature display. This option is enabled by default on 2 and 3 digit displays.

* **Suppress leading 0 on day/hour**: When enabled, will show the hours of the time and days of the date without a leading 0 when < 10. (Not available in all builds for size reasons)

* **Use decimal dot for blink**: When enabled will use the decimal dot on the second digit for blinking, when no colon is available. Not applicable for MAX7219 and TM1637 6-digit displays, as they already use alternative blink options.

* **Scroll text > display width**: Normally the ``7dtext,<text>`` command only show the left n characters the display can hold. This option enables the Scroll Text feature, that will scroll text sent using the ``7dtext`` command (or ``7dbin`` command when available) from right to left when the content is longer than the display can show at once.

* **Scroll text in from right**: Normally the Scroll Text feature starts with the display filled with the left part of the text to scroll, with this option enabled, the display starts empty and the text is scrolled in from the right side of the display to the left, until all text is scrolled off. Then the scrolling restarts.
Expand All @@ -120,38 +147,28 @@ Options

(The Scroll options and feature are not included in the Collection builds for size reasons)

Options for MAX7219 - 8 digit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Options for 8 digit displays (MAX7219/74HC595)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* **Right align Temperature (7dt)**: By default the temperature display on the MAX7219 - 8 digit display, is shown 1 position from the right side. This option enabled right-aligns the temperature.
* **Right align Temperature (7dt)**: By default the temperature display on the 8 digit displays, is shown 1 position from the right side. This option enabled right-aligns the temperature.

Commands available
^^^^^^^^^^^^^^^^^^

.. include:: P073_commands.repl

.. Events
.. ~~~~~~

.. .. include:: P073_events.repl

Bit to segment mapping for 7dbin command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``7dbin`` command allows to show any combination of segments on the display according to a (sequence of) bit pattern(s).

.. image:: P073_7Segments.png

The mapping from bits to segments is: ``0Bhabcdefg`` (Based on the segment mapping for MAX7219 driver, for TM1637 the pattern is converted into the correct bit-order)
The mapping from bits to segments is: ``0Bhabcdefg`` (Based on the segment mapping for MAX7219 driver, for TM1637/74HC595 the pattern is converted into the correct bit-order)

ESPEasy allows decimal, hexadecimal and binary notation for numbers. This makes creating the desired display pattern easy when using the binary notation (starting with ``0B`` or ``0b``).

Switching on all horizontal segments fot a digit can be done by the command ``7dbin,0b01001001``. This can also be entered in hexadecimal notation: ``7dbin,0x49``

.. Supported hardware
.. ------------------

.. .. |P073_usedby|
Switching on all horizontal segments for a digit can be done by the command ``7dbin,0b01001001``. This can also be entered in hexadecimal notation: ``7dbin,0x49``

Change log
----------
Expand Down Expand Up @@ -186,6 +203,8 @@ Change log
|added| 2023-03-29:
Optional suppressing of leading 0 for Hour and Day in Time and Date.

|added| 2024-07-26: Support for 74HC595 displays.

.. versionadded:: 1.0
...

Expand Down
Binary file modified docs/source/Plugin/P073_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/P073_DisplayTypes.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/P073_NrOfDigitsOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/Plugin/P073_commands.repl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
``7ddt,[BME280#Temperature],[DS18b20#Temperature]``

","
To display two temperatures measured by a BME280 sensor and a DS18b20 sensor. Only applicable for the MAX7219 - 8 digit display, as the other devices don't have enough digits to show 2 temperatures.
To display two temperatures measured, f.e. by a BME280 sensor and a DS18b20 sensor. Applicable for the MAX7219 and 74HC595 8 digit displays, as the other devices don't have enough digits to show 2 temperatures.
"
"
``7dst,<hh>,<mm>,<ss>``
Expand Down
Loading