aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elegoo.pb.go50
-rw-r--r--elegoo.proto2
-rw-r--r--elegoo/elegoo.ino4
-rw-r--r--elegoo/elegoo.pb.c6
-rw-r--r--elegoo/elegoo.pb.h6
-rw-r--r--fsm.go2
6 files changed, 35 insertions, 35 deletions
diff --git a/elegoo.pb.go b/elegoo.pb.go
index 9e41ff7..9450be6 100644
--- a/elegoo.pb.go
+++ b/elegoo.pb.go
@@ -59,7 +59,7 @@ func (m *Speed) GetR() int32 {
type Command struct {
Speed *Speed `protobuf:"bytes,1,opt,name=Speed" json:"Speed,omitempty"`
Stop bool `protobuf:"varint,3,opt,name=Stop" json:"Stop,omitempty"`
- Direction uint32 `protobuf:"varint,4,opt,name=Direction" json:"Direction,omitempty"`
+ Look uint32 `protobuf:"varint,4,opt,name=Look" json:"Look,omitempty"`
StopAfter uint32 `protobuf:"varint,5,opt,name=StopAfter" json:"StopAfter,omitempty"`
}
@@ -82,9 +82,9 @@ func (m *Command) GetStop() bool {
return false
}
-func (m *Command) GetDirection() uint32 {
+func (m *Command) GetLook() uint32 {
if m != nil {
- return m.Direction
+ return m.Look
}
return 0
}
@@ -220,26 +220,26 @@ func init() {
func init() { proto.RegisterFile("elegoo.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 322 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x52, 0x4f, 0x4b, 0xc3, 0x30,
- 0x1c, 0x25, 0xae, 0xab, 0xf5, 0xb7, 0x15, 0x66, 0x40, 0x28, 0xe2, 0x61, 0x56, 0x90, 0x5e, 0xdc,
- 0x61, 0xfa, 0x05, 0xb4, 0x53, 0x14, 0x77, 0xfa, 0x55, 0x2f, 0xde, 0xe2, 0xf6, 0x9b, 0x14, 0xd6,
- 0xa4, 0x64, 0x41, 0xf0, 0xe2, 0xc7, 0xf1, 0x73, 0x4a, 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 0x7d, 0x40, 0xf4, 0x7b, 0x79,
+ 0x05, 0x61, 0x67, 0xef, 0x12, 0x4d, 0x96, 0x27, 0xbd, 0xf2, 0x5f, 0x28, 0xf4, 0x22, 0xdb, 0xc0,
+ 0x4b, 0xdd, 0x50, 0x69, 0xaa, 0xa6, 0xf5, 0x15, 0x0f, 0xc4, 0x5d, 0xf8, 0x16, 0x34, 0x55, 0xad,
+ 0xde, 0x43, 0xf7, 0xf6, 0xd7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x9b, 0xf8, 0x59, 0x0b,
+ 0x02, 0x00, 0x00,
}
diff --git a/elegoo.proto b/elegoo.proto
index 51a550c..ab54a1b 100644
--- a/elegoo.proto
+++ b/elegoo.proto
@@ -12,7 +12,7 @@ message Speed {
message Command {
Speed Speed = 1;
bool Stop = 3;
- uint32 Direction = 4; // deg: 0 right .. 180 left
+ uint32 Look = 4; // deg: 0 right .. 180 left
uint32 StopAfter = 5; // milliseconds
}
diff --git a/elegoo/elegoo.ino b/elegoo/elegoo.ino
index 0911979..7b866e2 100644
--- a/elegoo/elegoo.ino
+++ b/elegoo/elegoo.ino
@@ -65,8 +65,8 @@ void onPacket(const uint8_t* buf, size_t size) {
if (cmd.Stop) {
stop();
}
- if (cmd.Direction > 0) {
- servo.write(cmd.Direction);
+ if (cmd.Look > 0) {
+ servo.write(cmd.Look);
}
if (cmd.StopAfter > 0) {
timer.after(cmd.StopAfter, stop);
diff --git a/elegoo/elegoo.pb.c b/elegoo/elegoo.pb.c
index 93fd007..d25b96a 100644
--- a/elegoo/elegoo.pb.c
+++ b/elegoo/elegoo.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.9 at Mon Dec 11 22:16:39 2017. */
+/* Generated by nanopb-0.3.9 at Mon Dec 11 22:33:35 2017. */
#include "elegoo.pb.h"
@@ -19,8 +19,8 @@ const pb_field_t elegoo_Speed_fields[3] = {
const pb_field_t elegoo_Command_fields[5] = {
PB_FIELD( 1, MESSAGE , SINGULAR, STATIC , FIRST, elegoo_Command, Speed, Speed, &elegoo_Speed_fields),
PB_FIELD( 3, BOOL , SINGULAR, STATIC , OTHER, elegoo_Command, Stop, Speed, 0),
- PB_FIELD( 4, UINT32 , SINGULAR, STATIC , OTHER, elegoo_Command, Direction, Stop, 0),
- PB_FIELD( 5, UINT32 , SINGULAR, STATIC , OTHER, elegoo_Command, StopAfter, Direction, 0),
+ PB_FIELD( 4, UINT32 , SINGULAR, STATIC , OTHER, elegoo_Command, Look, Stop, 0),
+ PB_FIELD( 5, UINT32 , SINGULAR, STATIC , OTHER, elegoo_Command, StopAfter, Look, 0),
PB_LAST_FIELD
};
diff --git a/elegoo/elegoo.pb.h b/elegoo/elegoo.pb.h
index 9160145..7581dcd 100644
--- a/elegoo/elegoo.pb.h
+++ b/elegoo/elegoo.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.9 at Mon Dec 11 22:16:39 2017. */
+/* Generated by nanopb-0.3.9 at Mon Dec 11 22:33:35 2017. */
#ifndef PB_ELEGOO_ELEGOO_PB_H_INCLUDED
#define PB_ELEGOO_ELEGOO_PB_H_INCLUDED
@@ -42,7 +42,7 @@ typedef struct _elegoo_UltraSonic {
typedef struct _elegoo_Command {
elegoo_Speed Speed;
bool Stop;
- uint32_t Direction;
+ uint32_t Look;
uint32_t StopAfter;
/* @@protoc_insertion_point(struct:elegoo_Command) */
} elegoo_Command;
@@ -82,7 +82,7 @@ typedef struct _elegoo_Event {
#define elegoo_UltraSonic_Direction_tag 2
#define elegoo_Command_Speed_tag 1
#define elegoo_Command_Stop_tag 3
-#define elegoo_Command_Direction_tag 4
+#define elegoo_Command_Look_tag 4
#define elegoo_Command_StopAfter_tag 5
#define elegoo_Event_Head_tag 1
#define elegoo_Event_Sensor_tag 2
diff --git a/fsm.go b/fsm.go
index d9433f1..dfe04a5 100644
--- a/fsm.go
+++ b/fsm.go
@@ -53,7 +53,7 @@ func (f *FSM) Start() {
}
func (f *FSM) initalState() stateFn {
- f.commands <- &Command{Direction: 90}
+ f.commands <- &Command{Look: 90}
return f.readDistance
}