Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from project-march/feature/PM-285-control-led
Browse files Browse the repository at this point in the history
Feature: control RGB LED
  • Loading branch information
RutgerVanBeek authored May 20, 2020
2 parents 17262fe + 85ed8ad commit f1699fe
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 541 deletions.
14 changes: 7 additions & 7 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
16 changes: 16 additions & 0 deletions include/color.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef COLOR_H
#define COLOR_H
#include <Arduino.h>

struct Color
{
Color(uint8_t red, uint8_t green, uint8_t blue) : r(red), g(green), b(blue)
{
}

const uint8_t r;
const uint8_t g;
const uint8_t b;
};

#endif // COLOR_H
3 changes: 2 additions & 1 deletion lib/ros_lib/march_shared_resources/GaitInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace march_shared_resources
_type_type type;
typedef const char* _gait_name_type;
_gait_name_type gait_name;
enum { UNKNOWN = -1 };
enum { STOP = 0 };
enum { GAIT = 1 };
enum { PAUSE = 2 };
Expand Down Expand Up @@ -77,7 +78,7 @@ namespace march_shared_resources
}

const char * getType(){ return "march_shared_resources/GaitInstruction"; };
const char * getMD5(){ return "f655c02301e6cc940112aec0256d56ae"; };
const char * getMD5(){ return "c548bd1201c18293dcff8514a06fc253"; };

};

Expand Down
2 changes: 1 addition & 1 deletion lib/ros_lib/march_shared_resources/GaitNameAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace march_shared_resources
}

const char * getType(){ return "march_shared_resources/GaitNameAction"; };
const char * getMD5(){ return "17daf8d4908f7456b080321810756286"; };
const char * getMD5(){ return "3d9dbfcd7eb406596122704f6e675e77"; };

};

Expand Down
2 changes: 1 addition & 1 deletion lib/ros_lib/march_shared_resources/GaitNameActionGoal.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace march_shared_resources
}

const char * getType(){ return "march_shared_resources/GaitNameActionGoal"; };
const char * getMD5(){ return "0608001a75969b5f789ca36c4a8c7c0c"; };
const char * getMD5(){ return "c3fcbf5324c7c2a9996a8ed899520f78"; };

};

Expand Down
19 changes: 18 additions & 1 deletion lib/ros_lib/march_shared_resources/GaitNameGoal.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ namespace march_shared_resources
public:
typedef const char* _name_type;
_name_type name;
typedef const char* _old_name_type;
_old_name_type old_name;
typedef const char* _subgait_name_type;
_subgait_name_type subgait_name;

GaitNameGoal():
name(""),
old_name(""),
subgait_name("")
{
}
Expand All @@ -31,6 +34,11 @@ namespace march_shared_resources
offset += 4;
memcpy(outbuffer + offset, this->name, length_name);
offset += length_name;
uint32_t length_old_name = strlen(this->old_name);
varToArr(outbuffer + offset, length_old_name);
offset += 4;
memcpy(outbuffer + offset, this->old_name, length_old_name);
offset += length_old_name;
uint32_t length_subgait_name = strlen(this->subgait_name);
varToArr(outbuffer + offset, length_subgait_name);
offset += 4;
Expand All @@ -51,6 +59,15 @@ namespace march_shared_resources
inbuffer[offset+length_name-1]=0;
this->name = (char *)(inbuffer + offset-1);
offset += length_name;
uint32_t length_old_name;
arrToVar(length_old_name, (inbuffer + offset));
offset += 4;
for(unsigned int k= offset; k< offset+length_old_name; ++k){
inbuffer[k-1]=inbuffer[k];
}
inbuffer[offset+length_old_name-1]=0;
this->old_name = (char *)(inbuffer + offset-1);
offset += length_old_name;
uint32_t length_subgait_name;
arrToVar(length_subgait_name, (inbuffer + offset));
offset += 4;
Expand All @@ -64,7 +81,7 @@ namespace march_shared_resources
}

const char * getType(){ return "march_shared_resources/GaitNameGoal"; };
const char * getMD5(){ return "e4f9d9eca41dac8a80cbbd410479e54f"; };
const char * getMD5(){ return "80ea09d68b3242bfdc28492fd72d785d"; };

};

Expand Down
Loading

0 comments on commit f1699fe

Please sign in to comment.