-
-
Notifications
You must be signed in to change notification settings - Fork 23
feat: prepared buffers #102
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
Conversation
a45def5
to
b954be0
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #102 +/- ##
==========================================
+ Coverage 33.38% 33.55% +0.17%
==========================================
Files 55 56 +1
Lines 1839 1925 +86
Branches 261 277 +16
==========================================
+ Hits 614 646 +32
- Misses 1135 1187 +52
- Partials 90 92 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
820cf35
to
cf56aeb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for preparing and reusing pre-encoded buffer operations to speed up repeated drawing on StreamDeck devices.
- Introduce a
PreparedBuffer
abstraction with JSON‐safe wrapping/unwrapping - Extend the
StreamDeck
interface withprepareFill*
methods and asendPreparedBuffer
operation - Refactor LCD and button services to produce and consume prepared buffers
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
File | Description |
---|---|
packages/core/src/preparedBuffer.ts | Define PreparedBuffer type and wrapBufferToPreparedBuffer /unwrapPreparedBufferToBuffer utilities |
packages/core/src/types.ts | Add sendPreparedBuffer and prepareFillKey/Panel/LcdRegionBuffer signatures to StreamDeck |
packages/core/src/services/buttonsLcdDisplay/default.ts | Refactor default button LCD service to support buffer preparation and JSON‐safe wrapping |
Comments suppressed due to low confidence (1)
packages/core/src/preparedBuffer.ts:1
- Add unit tests for
wrapBufferToPreparedBuffer
andunwrapPreparedBufferToBuffer
to verify correct encoding/decoding behavior and error conditions.
import type { DeviceModelId } from './id.js'
The aim of this is to better support users who want to do rapid drawing of the same buffers, such as to achieving flashing or gif behaviour.
This is a performance optimisation by allowing them to 'prepare' a draw, which does all the buffer preparation and jpeg encoding necessary, and then repeatedly send the draw when wanted much cheaper than before.
The prepared buffer can be optionally made json safe, where the buffers will be encoded as a string at the cost of requiring it to be decoded each time it is drawn