Skip to content

Commit

Permalink
fix: clear full lcd strip on streamdeck+ when drawing first 'button' …
Browse files Browse the repository at this point in the history
…to it #176
  • Loading branch information
Julusian committed Jan 11, 2025
1 parent 67db6da commit dcdd585
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions satellite/src/device-types/streamdeck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export class StreamDeckWrapper implements WrappedDevice {

#companionSupportsScaling = false

/**
* Whether the LCD has been written to outside the button bounds that needs clearing
*/
#fullLcdDirty = true

public get deviceId(): string {
return this.#deviceId
}
Expand Down Expand Up @@ -160,6 +165,14 @@ export class StreamDeckWrapper implements WrappedDevice {
return
}

// Clear the lcd segment if needed
if (this.#fullLcdDirty) {
if (abort.aborted) return

this.#fullLcdDirty = false
await this.#deck.clearLcdSegment(control.id)
}

const maxAttempts = 3
for (let attempts = 1; attempts <= maxAttempts; attempts++) {
try {
Expand Down Expand Up @@ -318,6 +331,9 @@ export class StreamDeckWrapper implements WrappedDevice {
.then(async (buffer) => {
if (signal.aborted) return

// Mark the screen as dirty, so the gaps get cleared when the first region draw happens
this.#fullLcdDirty = true

// still valid
await this.#deck.fillLcd(lcdStrip.id, buffer, {
format: 'rgba',
Expand Down

0 comments on commit dcdd585

Please sign in to comment.