Skip to content

Commit

Permalink
Drop unnecessary api parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Nov 28, 2013
1 parent d0176c3 commit 77dd6db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down
5 changes: 1 addition & 4 deletions examples/sphero_api.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package main

import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot-sphero"
)

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
}
Expand Down

0 comments on commit 77dd6db

Please sign in to comment.