Compare commits

..

1 Commits

Author SHA1 Message Date
Martyn 0dae7447a5 single-colour plasma, I hope 2021-01-03 11:19:15 +01:00
5 changed files with 12 additions and 25 deletions

View File

@ -1,7 +1,3 @@
# LEDController # LEDController
Testing out sending e1.31 sACM packets to strings of ws2812b Testing out sending e1.31 sACM packets to strings of ws2812b
Seems to be working nicely.
Used for my streaming setup on https://twitch.tv/iMartynOnTwitch

View File

@ -1,5 +1,5 @@
kind: pipeline kind: pipeline
type: kubernetes type: docker
name: linux-amd64-taggedver name: linux-amd64-taggedver
platform: platform:
@ -39,7 +39,7 @@ trigger:
--- ---
kind: pipeline kind: pipeline
type: kubernetes type: docker
name: linux-amd64-devel-master name: linux-amd64-devel-master
platform: platform:

View File

@ -32,11 +32,6 @@ var previousEffect queue.QueueItem
var msDelay = 0 var msDelay = 0
func isColorSet(c RGBcolor) bool {
// Any color so long as it's NOT black!
return c[0] != 0 || c[1] != 0 || c[2] != 0
}
func foreverLoop() { func foreverLoop() {
for /*ever*/ { for /*ever*/ {
time.Sleep(time.Duration(msDelay) * time.Millisecond) //25fps time.Sleep(time.Duration(msDelay) * time.Millisecond) //25fps
@ -174,11 +169,7 @@ func main() {
case "line": case "line":
rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, true, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.ZigZag(PanelWidth, PanelHeight))) rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, true, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.ZigZag(PanelWidth, PanelHeight)))
case "plasma": case "plasma":
if isColorSet(currentEffect.SeedColour) {
rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, true, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.PlasmaPanelSingleColor(PanelWidth, PanelHeight, currentEffect.Speed, currentEffect.SeedColour)))
} else {
rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, true, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.PlasmaPanel(PanelWidth, PanelHeight, currentEffect.Speed))) rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, true, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.PlasmaPanel(PanelWidth, PanelHeight, currentEffect.Speed)))
}
case "red": case "red":
rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, false, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.RedPanel(PanelWidth, PanelHeight))) rearranged = remapping.SliceRearrange(PanelWidth, PanelHeight, false, remapping.XYGridToLinear(PanelWidth, PanelHeight, patterns.RedPanel(PanelWidth, PanelHeight)))
case "random": case "random":

View File

@ -118,9 +118,9 @@ func singleColorPlasmaFromFloatVal(val float64, baseColor RGBcolor) (byte, byte,
var g byte var g byte
var b byte var b byte
val = positiveModF(val) val = positiveModF(val)
r = byte(math.Trunc(float64(baseColor[0]) * val)) r = baseColor[0] * val
g = byte(math.Trunc(float64(baseColor[1]) * val)) g = baseColor[1] * val
b = byte(math.Trunc(float64(baseColor[2]) * val)) b = baseColor[2] * val
return r, g, b return r, g, b
} }

View File

@ -58,7 +58,7 @@ func PatternHandler(response http.ResponseWriter, request *http.Request) {
if vars["color"] != "" { if vars["color"] != "" {
var c queue.RGBcolor var c queue.RGBcolor
for cn, cv := range colornames.Map { for cn, cv := range colornames.Map {
if cn == strings.ToLower(vars["color"]) { if cn == strings.ToLower(vars["name"]) {
c[0] = cv.R c[0] = cv.R
c[1] = cv.G c[1] = cv.G
c[2] = cv.B c[2] = cv.B
@ -174,9 +174,9 @@ func HandleHTTP(queueChannel chan queue.QueueItem, Port int, overrideChannel cha
r.HandleFunc("/colorpattern/{color}/{pattern}/", PatternHandler) r.HandleFunc("/colorpattern/{color}/{pattern}/", PatternHandler)
r.HandleFunc("/colorpattern/{color}/{pattern}/{duration}", PatternHandler) r.HandleFunc("/colorpattern/{color}/{pattern}/{duration}", PatternHandler)
r.HandleFunc("/colorpattern/{color}/{pattern}/{duration}/{speed}", PatternHandler) r.HandleFunc("/colorpattern/{color}/{pattern}/{duration}/{speed}", PatternHandler)
r.HandleFunc("/colour/{name}", ColourHandler) r.HandleFunc("/bloop/{name}", ColourHandler)
r.HandleFunc("/colour/{name}/override={override}", ColourHandler) r.HandleFunc("/bloop/{name}/override={override}", ColourHandler)
r.HandleFunc("/colour/{name}/{duration}", ColourHandler) r.HandleFunc("/bloop/{name}/{duration}", ColourHandler)
r.HandleFunc("/color/{name}", ColourHandler) r.HandleFunc("/color/{name}", ColourHandler)
r.HandleFunc("/color/{name}/override={override}", ColourHandler) r.HandleFunc("/color/{name}/override={override}", ColourHandler)
r.HandleFunc("/color/{name}/{duration}", ColourHandler) r.HandleFunc("/color/{name}/{duration}", ColourHandler)