jacdac-ts
Advanced tools
Comparing version 1.33.2 to 1.33.3
@@ -8,2 +8,3 @@ import { JDEventSource } from "./eventsource"; | ||
private _color; | ||
private _announces; | ||
constructor(service: JDService, command: number); | ||
@@ -13,4 +14,5 @@ get color(): number; | ||
blink(from: number, to: number, interval: number, repeat: number): Promise<void>; | ||
handlePacket(pkt: Packet): void; | ||
processAnnouncement(): void; | ||
processPacket(pkt: Packet): void; | ||
} | ||
//# sourceMappingURL=ledcontroller.d.ts.map |
{ | ||
"name": "jacdac-ts", | ||
"version": "1.33.2", | ||
"version": "1.33.3", | ||
"description": "JavaScript/TypeScript library to interact with Jacdac devices", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -775,2 +775,5 @@ import { Packet } from "./packet" | ||
} | ||
// update status led | ||
this.statusLight?.processAnnouncement() | ||
} | ||
@@ -855,3 +858,3 @@ | ||
) | ||
pkt.device.statusLight?.handlePacket(pkt) | ||
pkt.device.statusLight?.processPacket(pkt) | ||
} | ||
@@ -858,0 +861,0 @@ |
@@ -18,2 +18,3 @@ import { CHANGE, ControlCmdPack } from "./constants" | ||
private _color: number | ||
private _announces = 0 | ||
@@ -34,2 +35,4 @@ constructor( | ||
this._color = color | ||
this._announces = 0 | ||
if (this._color !== undefined) { | ||
@@ -56,3 +59,14 @@ const data = jdpack( | ||
handlePacket(pkt: Packet) { | ||
processAnnouncement() { | ||
if (this._color === undefined) return | ||
this._announces++ | ||
if (this._announces > 2) { | ||
// jacdac will blink at least once per announce cycle | ||
this._color = undefined | ||
this._announces = 0 | ||
this.emit(CHANGE) | ||
} | ||
} | ||
processPacket(pkt: Packet) { | ||
const [toRed, toGreen, toBlue] = jdunpack< | ||
@@ -59,0 +73,0 @@ [number, number, number, number] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50253434
225672