Skip to content

Commit

Permalink
Bump version and add support
Browse files Browse the repository at this point in the history
  • Loading branch information
samccone committed Jan 3, 2018
1 parent 98ec349 commit 5575dad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ F_CPU = 16500000 # in Hz

LED_COUNT ?= 2
# used in usbconfig.h
DEVICE_VERSION_MAJOR = 1
DEVICE_VERSION_MAJOR = 2
DEVICE_VERSION_MINOR = 0

USE_CANDLE = 0
Expand Down
14 changes: 13 additions & 1 deletion software/src/weblight-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,25 @@

async setDeviceColor(r, g, b) {
if (this.device.opened) {
let payload;

if (this.device.usbVersionMajor === 2) {
payload = new Uint8Array([0xFF, r, g, b])
} else if (this.device.usbVersionMajor === 1) {
payload = new Uint8Array([r, g, b]);
}

if (payload == null) {
throw new Error(`Unknown USB version ${this.device.usbVersionMajor}`);
}

await this.device.controlTransferOut({
requestType: 'vendor',
recipient: 'device',
request: 1,
value: 0,
index: 0,
}, new Uint8Array([r, g, b]));
}, payload);
this.$.lightPicker.value = rgbToHex(r, g, b);
}
}
Expand Down

0 comments on commit 5575dad

Please sign in to comment.