-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic infrastructure for WLED support in FCS
Includes field states as a proof of concept but will clean this up later
- Loading branch information
1 parent
8c82f35
commit f656353
Showing
7 changed files
with
277 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { WledInitParameters, WledUpdateParameters } from "@toa-lib/models"; | ||
|
||
export const buildWledInitializationPacket = (packet: WledInitParameters): string => { | ||
const wledJson = { | ||
transition: 0, | ||
bri: 255, | ||
frz: false, | ||
fx: 0, | ||
seg: packet.segments | ||
} | ||
|
||
return JSON.stringify(wledJson); | ||
} | ||
|
||
export const buildWledSetColorPacket = (packet: WledUpdateParameters): string => { | ||
const wledJson = { | ||
seg: packet.targetSegments?.map((segment) => ({ | ||
id: segment, | ||
on: true, | ||
frz: false, | ||
fx: 0, | ||
col: [ | ||
packet.color | ||
] | ||
})) | ||
} | ||
|
||
return JSON.stringify(wledJson); | ||
} |
This file contains 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
Oops, something went wrong.