Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2020-05-19 12:48:24 +02:00
parent c41fca9c5a
commit 34bb137e7b
1 changed files with 7 additions and 8 deletions

View File

@ -1,18 +1,17 @@
package webserver
import (
queue "git.martyn.berlin/martyn/LEDController/internal/queue"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
queue "git.martyn.berlin/martyn/LEDController/internal/queue"
"golang.org/x/image/colornames"
"fmt"
"net/http"
"os"
"time"
"strconv"
"strings"
"time"
)
func HealthHandler(response http.ResponseWriter, request *http.Request) {
@ -30,7 +29,7 @@ func RootHandler(response http.ResponseWriter, request *http.Request) {
fmt.Fprint(response, "Not implemented")
}
var globalQueue chan queue.QueueItem;
var globalQueue chan queue.QueueItem
func PatternHandler(response http.ResponseWriter, request *http.Request) {
vars := mux.Vars(request)
@ -68,7 +67,7 @@ func ColourHandler(response http.ResponseWriter, request *http.Request) {
e.Duration = 5000
}
var c queue.RGBcolor
for cn, cv := range(colornames.Map) {
for cn, cv := range colornames.Map {
if cn == strings.ToLower(vars["name"]) {
c[0] = cv.R
c[1] = cv.G
@ -93,7 +92,7 @@ func FadeHandler(response http.ResponseWriter, request *http.Request) {
e.Duration = 5000
}
var c queue.RGBcolor
for cn, cv := range(colornames.Map) {
for cn, cv := range colornames.Map {
if cn == strings.ToLower(vars["namefrom"]) {
c[0] = cv.R
c[1] = cv.G
@ -101,7 +100,7 @@ func FadeHandler(response http.ResponseWriter, request *http.Request) {
}
}
e.SeedColour = c
for cn, cv := range(colornames.Map) {
for cn, cv := range colornames.Map {
if cn == strings.ToLower(vars["nameto"]) {
c[0] = cv.R
c[1] = cv.G