refactor: Port image upload pipelines to py-opendisplay client#36
Open
stuart-c-ai wants to merge 5 commits into
Open
refactor: Port image upload pipelines to py-opendisplay client#36stuart-c-ai wants to merge 5 commits into
stuart-c-ai wants to merge 5 commits into
Conversation
Contributor
|
What about the support for deep sleep devices? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked PR Dependency
Important
This Pull Request represents Stage 3 of our sequential migration to the new
py-opendisplayBLE library. It depends on and includes the changes from Stage 2.Please ensure that PR #35: refactor: Migrate BLE device connection and operations to py-opendisplay is merged before this PR is reviewed or merged.
Description & Goal
The goal of this stage is to port the image upload pipelines in
upload.pyto the officialpy-opendisplay==7.3.0client library. It replaces custom image encoding, dithering, zlib compression, and our legacy localBLEImageUploaderclass with the library's nativeOpenDisplayDevice.upload_image()capabilities.By porting the upload logic to the library, we delegate the complex MTU-bound packet splitting, direct-write protocol sequence, compression checks, and color plane mapping directly to the client library. This dramatically reduces the complexity of our local custom component while guaranteeing exact compatibility with all display modes.
What was Done & Why
1. Direct Library Upload Delegation
custom_components/opendisplay/upload.pyupload_to_ble_blockandupload_to_ble_directto instantiateOpenDisplayDevice, perform an initialconn.interrogate(), and callconn.upload_image()to transmit the payload.2. Dithering & Refresh Mode Mapping
custom_components/opendisplay/upload.pyopendisplay.DitherModeand local refresh type configurations toopendisplay.RefreshMode.3. Cleanup of Obsolete Helper Instantiations
custom_components/opendisplay/upload.pyBLEImageUploaderclass, obsolete metadata wrappers (BLEDeviceMetadata), and unnecessary BLE helper imports.4. Home Assistant Tag Preview Maintenance
custom_components/opendisplay/upload.pySIGNAL_TAG_IMAGE_UPDATEto broadcast the dithered processed image (returned byconn.upload_image()) back to Home Assistant's tag image preview.