Drop unnecessary api parameters
This commit is contained in:
parent
d0176c313e
commit
77dd6dbae3
4
api.go
4
api.go
|
@ -31,6 +31,10 @@ func Api(bot *Master) {
|
|||
decoder := json.NewDecoder(req.Body)
|
||||
var body map[string]interface{}
|
||||
decoder.Decode(&body)
|
||||
if len(body) == 0 {
|
||||
body = map[string]interface{}{}
|
||||
}
|
||||
body["robotname"] = params["robotname"]
|
||||
return a.executeRobotCommand(bot, params, body)
|
||||
})
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hybridgroup/gobot"
|
||||
"github.com/hybridgroup/gobot-sphero"
|
||||
)
|
||||
|
@ -9,9 +8,7 @@ import (
|
|||
var Master *gobot.Master = gobot.GobotMaster()
|
||||
|
||||
func TurnBlue(params map[string]interface{}) bool {
|
||||
name := params["name"].(string)
|
||||
device := params["device"].(string)
|
||||
sphero := Master.FindRobotDevice(name, device)
|
||||
sphero := Master.FindRobotDevice(params["robotname"].(string), "sphero")
|
||||
gobot.Call(sphero.Driver, "SetRGB", uint8(0), uint8(0), uint8(255))
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue