Skip to content

Commit 2954204

Browse files
committed
add: hw_revision in getVersion
1 parent 5f9f679 commit 2954204

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/Arduino_AlvikCarrier.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,24 @@ int Arduino_AlvikCarrier::begin(){
153153

154154
beginBehaviours();
155155

156+
// hw revision check
157+
if (color_sensor_used == APDS9960_VERSION){
158+
hw_revision = HW_REVISION_1_3;
159+
}
160+
else{
161+
hw_revision = HW_REVISION_1_6;
162+
}
156163

157164
return 0;
158165
}
159166

160-
void Arduino_AlvikCarrier::getVersion(uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte){
167+
void Arduino_AlvikCarrier::getVersion(uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte, const bool hw_revision_on_version){
161168
high_byte = version_high;
162169
mid_byte = version_mid;
163170
low_byte = version_low;
171+
if (hw_revision_on_version){
172+
high_byte = high_byte & 0x0F | (hw_revision<<4);
173+
}
164174
}
165175

166176

src/Arduino_AlvikCarrier.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class Arduino_AlvikCarrier{
8282
uint8_t version_high;
8383
uint8_t version_mid;
8484
uint8_t version_low;
85+
uint8_t hw_revision;
8586

8687

8788
uint8_t kinematics_movement;
@@ -128,7 +129,8 @@ class Arduino_AlvikCarrier{
128129
int begin(); // initialize the robot
129130

130131

131-
void getVersion(uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte); // get firmware version
132+
void getVersion(uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte,
133+
const bool hw_revision_on_version = true); // get firmware version
132134

133135

134136
// Color sensor, APDS9960

src/definitions/robot_definitions.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ const float MOTION_FX_PERIOD = (1000U / MOTION_FX_FREQ);
9595
#define VERSION_BYTE_MID 1
9696
#define VERSION_BYTE_LOW 1
9797

98+
#define HW_REVISION_1_3 0 // apds9960 1.3 - 1.5
99+
#define HW_REVISION_1_6 1 // apds9999 1.6
100+
98101
// Battery stats
99102
#define BATTERY_ALERT_MINIMUM_CHARGE 20.0
100103
#define BATTERY_ALERT_STOP_CHARGE 10.0
101104

102105

103-
104106
#endif

0 commit comments

Comments
 (0)