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

[P036] Add ticker as scroll option #4746

Merged
merged 48 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
067383b
Merge branch 'pr/4239' into UweKaditz
uwekaditz Sep 1, 2022
df02ec7
Merge branch 'UweKaditz' of https://github.com/uwekaditz/ESPEasy into…
uwekaditz Oct 31, 2022
97f38ba
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Nov 12, 2022
0830969
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Nov 26, 2022
b276007
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Dec 3, 2022
c3dfe64
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Dec 8, 2022
4420055
Merge remote-tracking branch 'upstream/mega' into pr/4411
uwekaditz Dec 10, 2022
97ec535
Merge branch 'pr/4411' into UweKaditz
uwekaditz Dec 10, 2022
f2dcfa8
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Dec 19, 2022
84b244d
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Dec 24, 2022
b980b8c
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Jan 6, 2023
2f642e1
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Jan 17, 2023
7754f5e
Merge remote-tracking branch 'github-desktop-TD-er/bugfix/factory_res…
uwekaditz Jan 22, 2023
a9b3f00
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Jan 26, 2023
bc44fe9
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Jan 28, 2023
ab46299
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Feb 8, 2023
dee1e34
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Feb 13, 2023
b7e7938
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Feb 18, 2023
cf9f46d
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Feb 20, 2023
721c434
Merge tag 'mega-20230304' into UweKaditz
uwekaditz Mar 5, 2023
7b5d903
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Mar 9, 2023
b126cad
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Mar 25, 2023
af7e0c3
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Apr 1, 2023
f9a8962
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Apr 2, 2023
af6f3a4
Merge remote-tracking branch 'upstream/mega' into UweKaditz
uwekaditz Jul 6, 2023
e29b8eb
Merge branch 'UweKaditz' of https://github.com/uwekaditz/ESPEasy into…
uwekaditz Jul 22, 2023
202345d
Merge remote-tracking branch 'github-desktop-TD-er/mega' into UweKaditz
uwekaditz Jul 24, 2023
2972660
[P036] Add ticker as scroll option
uwekaditz Jul 24, 2023
f958b0a
Compiler error if P036_SendEvent was not set
uwekaditz Jul 24, 2023
639fa9d
Calculation for ticker IdxStart and IdxEnd was wrong for 64x48 displa…
uwekaditz Jul 25, 2023
c936594
Merge branch 'mega' into UweKaditz
uwekaditz Jul 25, 2023
e986e42
Merge branch 'UweKaditz' of https://github.com/uwekaditz/ESPEasy into…
uwekaditz Jul 25, 2023
5020ebb
Merge branch 'mega' into UweKaditz
uwekaditz Jul 29, 2023
09bffa7
Merge branch 'mega' into UweKaditz
uwekaditz Aug 8, 2023
87afa61
Some bug fixes (only 1 line displayed)
uwekaditz Aug 10, 2023
4f43b2f
Removed unnecessary clear() functions
uwekaditz Aug 11, 2023
5d0070f
Merge branch 'mega' into UweKaditz
uwekaditz Aug 13, 2023
f42bacc
Merge branch 'mega' into UweKaditz
uwekaditz Aug 14, 2023
fa27d8b
Merge branch 'mega' into UweKaditz
uwekaditz Aug 22, 2023
cadc50d
Merge branch 'mega' into UweKaditz
uwekaditz Aug 24, 2023
dccd13f
Merged with mega from 2023-08-25
uwekaditz Aug 27, 2023
d761bb7
Merge branch 'UweKaditz' of https://github.com/uwekaditz/ESPEasy into…
uwekaditz Aug 27, 2023
8885c07
Wrong #ifdef P036_SEND_EVENTS
uwekaditz Aug 27, 2023
964a357
CHG: Disable scrolling or ticker if new line content received (PLUGIN…
uwekaditz Aug 28, 2023
260a588
CHG: Code reduced if P036_ENABLE_TICKER is not used
uwekaditz Aug 28, 2023
8469b1d
Merge branch 'mega' into UweKaditz
uwekaditz Aug 29, 2023
a667439
Merge branch 'mega' into UweKaditz
uwekaditz Sep 4, 2023
780c1b9
Merge branch 'mega' into UweKaditz
uwekaditz Sep 8, 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
14 changes: 12 additions & 2 deletions docs/source/Plugin/P036.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ Device Settings

.. image:: P036_ScrollOptions.png

* **Scroll**: Switching between pages can be "instant" or "scrolling". Please note that scrolling will need more resources of the ESP, which can have an effect on other active tasks of the node.
* **Scroll**: Switching between pages can be "instant", "scrolling" or a "ticker" band. Please note that scrolling will need more resources of the ESP, which can have an effect on other active tasks of the node.
For the ``Ticker`` there are some restrictions:
* Depending on the build used (NORMAL and CUSTOM) this option is available
* only one line is displaying the ticker string
* all line contents are parsed and combined to this ticker string, the parsing happens only at each ticker start (using the setting ``Interval``)
* the optional split token ``<|>`` is replaced by three spaces
* the gaps between the ticker items must be set by the ``line content`` (tailing spaces)
* the starting alignment (left, center, right) depends on the setting ``Align content (global)``
* the font is taken from the setting ``Modify font`` of the first line, the ``Alignment`` settings of the lines are ignored (always right aligned)
* the ticker speed depends on the length of the ticker string and the setting ``Interval`` setting
* the footer is automatically hidden

* **GPIO <- Display button**: Setting up a ``Display Button``, allows to configure a Display Timeout and wake the display on demand, either by a button, or by using some presence detection.

Expand Down Expand Up @@ -125,7 +135,7 @@ The user defined texts may also contain a split token ``<|>`` to display the lin

* **Alignment**: For each line, the alignment to be used can be selected, or the global setting can be used.

* **Interval** By default, Interval will be set to 0. If set to a non-zero value, the pre-configured content will be updated automatically using that interval (seconds).
* **Interval** By default, Interval will be set to 0. It needs to be set to a non-zero value, to switch between the frames using that interval (seconds).


General
Expand Down
Binary file modified docs/source/Plugin/P036_ScrollOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion docs/source/Plugin/P036_commands.repl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

The updated line text is not stored in the settings itself, but kept in memory.
After a reboot the stored plugin settings will be used.
The line text can also be restored from the settings by the command ``restore``.

All template notations can be used, like system variables, or reference to a task value.

Expand All @@ -50,6 +51,7 @@
This command is to display a specific frame (aka page), or the next frame. When reaching the last frame, a 'next' (0) will display the first frame.

The <framenr> parameter corresponds to the desired frame (1..<number of frames>) to display. The number of frames is determined by dividing the lines in use (at least one line in that frame with some data), by the number of Lines per Frame. So practically, the range is 1..3 when all lines are used and 4 Lines per Frame is set, or 1..12 if Line per frames is set to 1. The number of frames is updated if a frame would initially be empty, and an external source places text on a line of that frame (see above).
If scroll is set to ``ticker`` only <framenr> = 1 is supported, it starts the ticker from the beginning.

When omitting <framenr>, or providing 0, the next frame is displayed.

Expand All @@ -59,6 +61,7 @@
``oledframedcmd,linecount,<1..4>``
","
This command changes the number of lines in each frame. When the next frame is to be displayed, the frames are recalculated and the sequence is restarted at the first frame.
If scroll is set to ``ticker`` this command is not supported.

If Generate events for 'Linecount' is selected, a ``<taskname#linecount=<lines>`` event is generated on initialization of the plugin and when changing the setting.
"
Expand All @@ -85,4 +88,18 @@
Set the user defined header nr. 2 with any desired text value.

Use ``$<sysvar>$`` instead of ``%<sysvar>%`` to use system variables.
"
"
"
``oledframedcmd,restore,<line>``
","
If the <line> parameter is set to 0 all line contents will be restored from the settings.
Otherwise the <line> parameter corresponds with the same lines as the plugin configuration has,
and only the content of this line will be restored from the settings.
"
"
``oledframedcmd,scroll,<speed>``
","
The <speed> parameter corresponds with the line number of the scroll parameter of the settings (1=Very slow ... 6=Ticker).
After applying the new scroll speed the display restarts with the first page.
"

9 changes: 9 additions & 0 deletions lib/esp8266-oled-ssd1306/OLEDDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,15 @@ uint16_t OLEDDisplay::getStringWidth(const String& strUser) {
return width;
}

uint8_t OLEDDisplay::getCharWidth(const char c) {
uint8_t firstChar = pgm_read_byte(fontData + FIRST_CHAR_POS);
if (utf8ascii(c) == 0)
return 0;
if (c < firstChar)
return 0;
return pgm_read_byte(fontData + JUMPTABLE_START + (c- firstChar) * JUMPTABLE_BYTES + JUMPTABLE_WIDTH);
}

void OLEDDisplay::setTextAlignment(OLEDDISPLAY_TEXT_ALIGNMENT textAlignment) {
this->textAlignment = textAlignment;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/esp8266-oled-ssd1306/OLEDDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ class OLEDDisplay : public Print {
// Convencience method for the const char version
uint16_t getStringWidth(const String& text);

// Returns the width of c with the already set fontData
// returns a 0 if c is non-ascii
// in this case the next char must be converted
uint8_t getCharWidth(const char c);

// Specifies relative to which anchor point
// the text is rendered. Available constants:
// TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER_BOTH
Expand Down
1 change: 1 addition & 0 deletions src/Custom-sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ static const char DATA_ESPEASY_DEFAULT_MIN_CSS[] PROGMEM = {
// #define USES_P036 // FrameOLED
// #define P036_FEATURE_DISPLAY_PREVIEW 1 // Enable Preview feature, shows on-display content on Devices overview page
// #define P036_FEATURE_ALIGN_PREVIEW 1 // Enable center/right-align feature when preview is enabled (auto-disabled for 1M builds)
// #define P036_ENABLE_TICKER 1 // Enable ticker function
// #define USES_P037 // MQTTImport
// #define P037_MAPPING_SUPPORT 1 // Enable Value mapping support
// #define P037_FILTER_SUPPORT 1 // Enable filtering support
Expand Down
Loading