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

Conversation

uwekaditz
Copy link
Contributor

@uwekaditz uwekaditz commented Jul 24, 2023

Add ticker as scroll option, solves issue #4188
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

Setting and support for oledframedcmd,restore,<0|<nn>> subcommand par2: (0=all|Line Content)

  • If the 0|<nn> parameter is set to 0 all line contents will be restored from the settings.
  • Otherwise the parameter corresponds with the same lines as the plugin configuration has, and only the content of this line will be restored from the settings.

Setting and support for oledframedcmd,scroll,<1..6> subcommand, par2: (casted to ePageScrollSpeeds)

  • The 1..6 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.

Minor change in debug messages:

  • addLogMove() for dynamic messages
  • delay(5) added if several debug message are issued in succession (the RS232 was too slow!)

@uwekaditz
Copy link
Contributor Author

uwekaditz commented Jul 24, 2023

@tonhuisman I checked my code with your PRs #4554 and #4722.
It worked but I disabled the preview in P036_DisplayPage() if scroll is set to Ticker.

@tonhuisman
Copy link
Contributor

I disabled the preview in P036_DisplayPage() if scroll is set to Ticker.

That sounds like a smart plan 👍

uwekaditz and others added 6 commits July 25, 2023 21:49
…y, Start page updates after network has connected in PLUGIN_ONCE_A_SECOND

BUG: Calculation for ticker IdxStart and IdxEnd was wrong for 64x48 display
CHG: Start page updates after network has connected in PLUGIN_ONCE_A_SECOND, faster than waiting for the next PLUGIN_READ
- Individual font setting can only enlarge or maximize the font, if more than 1 line should be displayed (it was buggy not only for ticker!)
- CalculateIndividualFontSettings() must be called until the font fits (it was buggy not only for ticker!)
- Compiler error for '#ifdef P036_FONT_CALC_LOG'

if (log1.reserve(140)) { // estimated
delay(10); // otherwise it is may be to fast for the serial monitor
log1.clear();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • delay() calls should be really required, or else limited to 1 msec,, and only to avoid the watchdog stepping in (after 30 seconds)
  • no need to clear() a freshly declared String, that's already empty...

@uwekaditz
Copy link
Contributor Author

uwekaditz commented Aug 11, 2023

The delay() function is only used for debug purpose.
It's normally hidden by the compiler switches #ifdef P036_CHECK_INDIVIDUAL_FONT and #ifdef P036_FONT_CALC_LOG.

Without the delay I encountered problems while writing debug messages to the serial output using addLogMove() or addLog().
If the messages were longer or more frequently something else corrupted the already lined up strings (see examples below captured by hterm @ 115200 baud).
With the delay() (time calculated by the serial speed and the number of bytes) everything looks fine.

Without delay:

1197 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:0 LinesPerFrame:2
1198 : Info   : IndividualFontSeings: ltxt:1sultdxForBsttULio:tFoUsed:0eN LrFe:1 lp:2 lSpace:0
1202 : Info   : IndividualFontSettings: result.NeneNo5 .Ior3 Info   : IndividualFontSettings: result.NextLineNo:3 result.IdxForBiggestntUsed:0 LineNo:2 LinesPerFrame:1 FrameNo:2 lTop:2 lSpace:0
1205 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:3 LinesPerFrame:2
1206 : Info   : IndividualFontSettings: result.NextLineNo:4 result.IdxForBiggestFontUsed:0 LineNo:3 LinesPerFrame:1 FrameNo:3 lTop:2 lSpace:0
1208 : Info   : IndividualFontSettings: result.NextLineNo:6 result.IdxForBiggestFontUsed:3 LineNo:4 LinesPerFrame:2 FrameNo:4 lTop:1 lSpace:3
1209 : Info   : IndividualFontSettings: result.NextLineNo:8 result.IdxForBiggestFontUsed:3 LineNo:6 LinesPerFrame:2 FrameNo:5 lTop:1 lSpace:3
1210 : Info   : IndividualFontSettings: result.NextLineNo:10 result.IdxForBiggestFontUsed:3 LineNo:8 LinesPerFrame:2 FrameNo:6 lTop:1 lSpace:3
1212 : Info   : IndividualFontSettings: result.NextLý•ÿ result.IdxForBiggestFontUsed:3 LineNo:10 LinesPerFrame:2 FrameNo:7 lTop:1 lSpace:3

With a delay of 10 ms:

1107 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:0 LinesPerFrame:2
1118 : Info   : IndividualFontSettings: result.NextLineNo:1 result.IdxForBiggestFontUsed:0 LineNo:0 LinesPerFrame:1 FrameNo:0 lTop:2 lSpace:0
1129 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:1 LinesPerFrame:2
1140 : Info   : IndividualFontSettings: result.NextLineNo:2 result.IdxForBiggestFontUsed:0 LineNo:1 LinesPerFrame:1 FrameNo:1 lTop:2 lSpace:0
1151 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:2 LinesPerFrame:2
1163 : Info   : IndividualFontSettings: result.NextLineNo:3 result.IdxForBiggestFontUsed:0 LineNo:2 LinesPerFrame:1 FrameNo:2 lTop:2 lSpace:0
1174 : Info   : IndividualFontSettings: result.NextLineNo:255 result.IdxForBiggestFontUsed:0 LineNo:3 LinesPerFrame:2
1185 : Info   : IndividualFontSettings: result.NextLineNo:4 result.IdxForBiggestFontUsed:0 LineNo:3 LinesPerFrame:1 FrameNo:3 lTop:2 lSpace:0
1196 : Info   : IndividualFontSettings: result.NextLineNo:6 result.IdxForBiggestFontUsed:3 LineNo:4 LinesPerFrame:2 FrameNo:4 lTop:1 lSpace:3
1207 : Info   : IndividualFontSettings: result.NextLineNo:8 result.IdxForBiggestFontUsed:3 LineNo:6 LinesPerFrame:2 FrameNo:5 lTop:1 lSpace:3
1219 : Info   : IndividualFontSettings: result.NextLineNo:10 result.IdxForBiggestFontUsed:3 LineNo:8 LinesPerFrame:2 FrameNo:6 lTop:1 lSpace:3
1230 : Info   : IndividualFontSettings: result.NextLineNo:12 result.IdxForBiggestFontUsed:3 LineNo:10 LinesPerFrame:2 FrameNo:7 lTop:1 lSpace:3

@TD-er
Copy link
Member

TD-er commented Aug 25, 2023

@uwekaditz Can you fix the merge conflicts, so we can further test this code?

@uwekaditz
Copy link
Contributor Author

I will solve the merge conflicts on Monday because over the weekend I'll be busy.

@uwekaditz
Copy link
Contributor Author

I will solve the merge conflicts on Monday because over the weekend I'll be busy.

The merge conflicts are soldved.
@tonhuisman By the way I found following issues:

  • P036_data_struct.h, line 26
    # ifdef P036_FEATURE_DISPLAY_PREVIEW changed to # ifndef P036_FEATURE_DISPLAY_PREVIEW

  • The preview on the page Devices is not updated by displaying a new frame (page) on the display.
    Is that intentional?
    If the page Devices is reloaded manually the actual display content is shown.

@tonhuisman
Copy link
Contributor

  • P036_data_struct.h, line 26
    # ifdef P036_FEATURE_DISPLAY_PREVIEW changed to # ifndef P036_FEATURE_DISPLAY_PREVIEW

The intent is to enable this feature by default, so first I have to check if it wasn't defined already, to keep that setting (we're working on a build service where plugins, controllers and features can be selected, both on and off 😉)
Looks like the same bug is in line 29 😊, that should also be #ifndef...

  • The preview on the page Devices is not updated by displaying a new frame (page) on the display.
    Is that intentional?
    If the page Devices is reloaded manually the actual display content is shown.

That's a known 'feature' (wouldn't call it an 'issue' 🤔, as it's by design), the Devices page is updated (from a small piece of javascript in the page, so you should allow that to run...) with the frequency of the shortest Interval of all your active devices.
You can improve that by adding a task, f.e. the SysInfo plugin, and give that a short interval time.

@uwekaditz
Copy link
Contributor Author

uwekaditz commented Aug 27, 2023

Line 29 is fine, it's already #ifndef P036_FEATURE_ALIGN_PREVIEW

@tonhuisman
Copy link
Contributor

Hmm, I'm looking at current mega code... 🤔

@uwekaditz
Copy link
Contributor Author

Hmm, I'm looking at current mega code... 🤔

I was wrong with my comment.
I changed #ifdef P036_FEATURE_ALIGN_PREVIEW into #ifndef P036_FEATURE_ALIGN_PREVIEW

uwekaditz and others added 5 commits August 28, 2023 18:43
…_WRITE)

- Sometimes exception if the content was updated by an IR command (P016),
but sending the command by Tools->Command->Submit never resulted in an exception!
- Wrong eventId if new line content received
- Typo in comment
@TD-er TD-er merged commit 156d79e into letscontrolit:mega Sep 17, 2023
154 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants