Small robot refactor

This commit is contained in:
Adrian Zankich 2013-12-02 18:59:28 -08:00
parent 9e92514efe
commit 6cbeb71d00
1 changed files with 7 additions and 3 deletions

View File

@ -20,9 +20,7 @@ type Robot struct {
func (r *Robot) Start() {
r.initName()
for k, _ := range r.Commands {
r.RobotCommands = append(r.RobotCommands, k)
}
r.initCommands()
r.initConnections()
r.initDevices()
r.startConnections()
@ -39,6 +37,12 @@ func (r *Robot) initName() {
}
}
func (r *Robot) initCommands() {
for k, _ := range r.Commands {
r.RobotCommands = append(r.RobotCommands, k)
}
}
func (r *Robot) initConnections() {
r.connections = make([]*Connection, len(r.Connections))
fmt.Println("Initializing connections...")