Skip to content

Commit

Permalink
Revert "fix: don't wait for acks on display drawing"
Browse files Browse the repository at this point in the history
This reverts commit f1d2a38.

# Conflicts:
#	packages/node/src/models/base.ts
  • Loading branch information
Julusian committed Dec 2, 2022
1 parent d46a797 commit 98b2cbc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/node/src/models/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv
for (const display of this.displays) {
const [payload] = this.createBufferWithHeader(display, display.width, display.height, 0, 0)

this.#sendCommand(CommandIds.DrawFramebuffer, payload)
await this.#sendAndWaitIfRequired(CommandIds.DrawFramebuffer, payload, true)
}
}

Expand All @@ -117,7 +117,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv
for (let i = 0; i < buttons.length; i++) {
payload.writeUInt8(buttons[i].encoded, i * 4)
}
this.#sendCommand(CommandIds.SetColour, payload)
await this.#sendAndWaitIfRequired(CommandIds.SetColour, payload, true)
}
}, false)
}
Expand Down Expand Up @@ -193,7 +193,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv

await this.#runInQueueIfEnabled(async () => {
// Run in the queue as a single operation
this.#sendCommand(CommandIds.DrawFramebuffer, encoded)
await this.#sendAndWaitIfRequired(CommandIds.DrawFramebuffer, encoded, true)
}, false)
}

Expand Down Expand Up @@ -221,8 +221,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv

checkRGBColor(color)

const encodedValue =
(Math.round(color.red >> 3) << 11) + (Math.round(color.green >> 2) << 5) + Math.round(color.blue >> 3)
const encodedValue = (Math.round(color.red) << 11) + (Math.round(color.green) << 5) + Math.round(color.blue)

const [encoded, padding] = this.createBufferWithHeader(display, width, height, x, y)
for (let i = 0; i < width * height; i++) {
Expand All @@ -231,7 +230,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv

await this.#runInQueueIfEnabled(async () => {
// Run in the queue as a single operation
this.#sendCommand(CommandIds.DrawFramebuffer, encoded)
await this.#sendAndWaitIfRequired(CommandIds.DrawFramebuffer, encoded, true)
}, false)
}

Expand Down Expand Up @@ -334,7 +333,7 @@ export abstract class LoupedeckDeviceBase extends EventEmitter<LoupedeckDeviceEv
payload.writeUInt8(button.blue, offset + 3)
}

this.#sendCommand(CommandIds.SetColour, payload)
return this.#sendAndWaitIfRequired(CommandIds.SetColour, payload)
}

public async vibrate(pattern: LoupedeckVibratePattern): Promise<void> {
Expand Down

0 comments on commit 98b2cbc

Please sign in to comment.