Skip to content

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

Merged
merged 7 commits into from
May 30, 2025
Merged

feat: prepared buffers #102

merged 7 commits into from
May 30, 2025

Conversation

Julusian
Copy link
Owner

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

@Julusian Julusian force-pushed the feat/prepared-buffers branch from a45def5 to b954be0 Compare February 16, 2025 17:09
@Julusian Julusian marked this pull request as ready for review February 16, 2025 17:09
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 37.75510% with 61 lines in your changes missing coverage. Please review.

Project coverage is 33.55%. Comparing base (58b8994) to head (f8af9ed).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ckages/core/src/services/lcdSegmentDisplay/plus.ts 14.28% 11 Missing and 1 partial ⚠️
...ges/core/src/services/buttonsLcdDisplay/default.ts 52.17% 11 Missing ⚠️
packages/core/src/models/base.ts 9.09% 9 Missing and 1 partial ⚠️
packages/core/src/proxy.ts 0.00% 8 Missing ⚠️
packages/tcp/src/index.ts 0.00% 6 Missing ⚠️
packages/core/src/preparedBuffer.ts 79.16% 5 Missing ⚠️
...ckages/core/src/services/buttonsLcdDisplay/fake.ts 0.00% 4 Missing ⚠️
packages/webhid/src/index.ts 0.00% 3 Missing ⚠️
...ackages/core/src/services/lcdSegmentDisplay/neo.ts 0.00% 2 Missing ⚠️

❗ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Julusian Julusian force-pushed the feat/prepared-buffers branch from 820cf35 to cf56aeb Compare May 30, 2025 21:34
@Julusian Julusian requested a review from Copilot May 30, 2025 21:34
Copy link

@Copilot Copilot AI left a 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 with prepareFill* methods and a sendPreparedBuffer 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 and unwrapPreparedBufferToBuffer to verify correct encoding/decoding behavior and error conditions.
import type { DeviceModelId } from './id.js'

@Julusian Julusian merged commit 026cbf3 into main May 30, 2025
12 checks passed
@Julusian Julusian deleted the feat/prepared-buffers branch May 30, 2025 22:11
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