diff --git a/robot.go b/robot.go index c6c5429c..e204d886 100644 --- a/robot.go +++ b/robot.go @@ -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...")