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

Berry: add scroll method to Leds_matrix #22693

Merged
merged 1 commit into from
Dec 21, 2024
Merged

Conversation

Staars
Copy link
Contributor

@Staars Staars commented Dec 21, 2024

Description:

Adds new method to the Leds_matrix class for scrolling the pixel buffer in all directions. Support for RGB mode only, not RGBW.

Usage:
<my_matrix>.scroll(int: direction, bytes: outshift[,bytes: inshift])

  • directions are 0 - up, 1 - left, 2 - down, 3 - right , 0/2 will shift a row and 1/3 shift a column
  • outshift is a mandatory bytes buffer, that must at least have the size of column or row (depending on direction) * 3 (bytes per pixel). Providing such a buffer as boiler plate code prevents reallocations in the scroll routine.
  • inshift is optional and has the same size requirements. Can be used for "endless" text scrolling.

The application code can be quite small. Here is an excerpt from a text scroller, where we scroll out from an offscreen buffer and use that date to scroll in the main screen:

self.offscreenController.matrix.scroll(1, self.clockfaceManager.outShiftBuffer) # 1 - to left, output - inOutBuf, no input buffer
self.matrixController.matrix.scroll(1, self.trashOutBuf, self.clockfaceManager.outShiftBuffer) # 1 - to left, unused output, input inOutBuf
 self.matrixController.leds.show();

In my testing with the Ulanzi clock performance was quite okay, although this is only pure Berry code and this could possibly be optimised later with a native function.

scroll.mov

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.0.241206
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit 6745bc1 into arendst:development Dec 21, 2024
59 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.

2 participants