Skip to content

Commit 9d7a19c

Browse files
authored
Merge pull request #227 from BlueAndi/feature/SerialMuxProt2.4.0
SerialMuxProt updated to v2.4.0
2 parents 3f51be6 + 1a8becc commit 9d7a19c

File tree

7 files changed

+108
-12
lines changed

7 files changed

+108
-12
lines changed

lib/APPConvoyFollower/src/SerialMuxChannels.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/******************************************************************************
4141
* Includes
4242
*****************************************************************************/
43-
4443
#include <Arduino.h>
4544
#include <SerialMuxProtServer.hpp>
4645

@@ -159,6 +158,9 @@ typedef struct _Command
159158

160159
} __attribute__((packed)) Command;
161160

161+
static_assert(sizeof(Command) <= MAX_DATA_LEN,
162+
"Command struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
163+
162164
/** Struct of the "Command Response" channel payload. */
163165
typedef struct _CommandResponse
164166
{
@@ -172,6 +174,9 @@ typedef struct _CommandResponse
172174
};
173175
} __attribute__((packed)) CommandResponse;
174176

177+
static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN,
178+
"CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
179+
175180
/** Struct of the "Speed" channel payload. */
176181
typedef struct _SpeedData
177182
{
@@ -180,6 +185,9 @@ typedef struct _SpeedData
180185
int32_t center; /**< Center motor speed [mm/s] */
181186
} __attribute__((packed)) SpeedData;
182187

188+
static_assert(sizeof(SpeedData) <= MAX_DATA_LEN,
189+
"SpeedData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
190+
183191
/** Struct of the "Current Vehicle Data" channel payload. */
184192
typedef struct _VehicleData
185193
{
@@ -192,12 +200,18 @@ typedef struct _VehicleData
192200
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
193201
} __attribute__((packed)) VehicleData;
194202

203+
static_assert(sizeof(VehicleData) <= MAX_DATA_LEN,
204+
"VehicleData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
205+
195206
/** Struct of the "Status" channel payload. */
196207
typedef struct _Status
197208
{
198209
SMPChannelPayload::Status status; /**< Status */
199210
} __attribute__((packed)) Status;
200211

212+
static_assert(sizeof(Status) <= MAX_DATA_LEN,
213+
"Status struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
214+
201215
/******************************************************************************
202216
* Functions
203217
*****************************************************************************/

lib/APPConvoyLeader/src/SerialMuxChannels.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/******************************************************************************
4141
* Includes
4242
*****************************************************************************/
43-
4443
#include <Arduino.h>
4544
#include <SerialMuxProtServer.hpp>
4645

@@ -159,6 +158,9 @@ typedef struct _Command
159158

160159
} __attribute__((packed)) Command;
161160

161+
static_assert(sizeof(Command) <= MAX_DATA_LEN,
162+
"Command struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
163+
162164
/** Struct of the "Command Response" channel payload. */
163165
typedef struct _CommandResponse
164166
{
@@ -172,6 +174,9 @@ typedef struct _CommandResponse
172174
};
173175
} __attribute__((packed)) CommandResponse;
174176

177+
static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN,
178+
"CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
179+
175180
/** Struct of the "Speed" channel payload. */
176181
typedef struct _SpeedData
177182
{
@@ -180,6 +185,9 @@ typedef struct _SpeedData
180185
int32_t center; /**< Center motor speed [mm/s] */
181186
} __attribute__((packed)) SpeedData;
182187

188+
static_assert(sizeof(SpeedData) <= MAX_DATA_LEN,
189+
"SpeedData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
190+
183191
/** Struct of the "Current Vehicle Data" channel payload. */
184192
typedef struct _VehicleData
185193
{
@@ -192,12 +200,18 @@ typedef struct _VehicleData
192200
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
193201
} __attribute__((packed)) VehicleData;
194202

203+
static_assert(sizeof(VehicleData) <= MAX_DATA_LEN,
204+
"VehicleData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
205+
195206
/** Struct of the "Status" channel payload. */
196207
typedef struct _Status
197208
{
198209
SMPChannelPayload::Status status; /**< Status */
199210
} __attribute__((packed)) Status;
200211

212+
static_assert(sizeof(Status) <= MAX_DATA_LEN,
213+
"Status struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
214+
201215
/******************************************************************************
202216
* Functions
203217
*****************************************************************************/

lib/APPLineFollower/src/SerialMuxChannels.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/******************************************************************************
4141
* Includes
4242
*****************************************************************************/
43-
4443
#include <Arduino.h>
4544
#include <SerialMuxProtServer.hpp>
4645

@@ -171,6 +170,9 @@ typedef struct _Command
171170

172171
} __attribute__((packed)) Command;
173172

173+
static_assert(sizeof(Command) <= MAX_DATA_LEN,
174+
"Command struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
175+
174176
/** Struct of the "Command Response" channel payload. */
175177
typedef struct _CommandResponse
176178
{
@@ -184,20 +186,29 @@ typedef struct _CommandResponse
184186
};
185187
} __attribute__((packed)) CommandResponse;
186188

189+
static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN,
190+
"CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
191+
187192
/** Struct of the "Motor Speed Setpoints" channel payload. */
188193
typedef struct _MotorSpeed
189194
{
190195
int32_t left; /**< Left motor speed [mm/s] */
191196
int32_t right; /**< Right motor speed [mm/s] */
192197
} __attribute__((packed)) MotorSpeed;
193198

199+
static_assert(sizeof(MotorSpeed) <= MAX_DATA_LEN,
200+
"MotorSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
201+
194202
/** Struct of the "Robot Speed Setpoints" channel payload. */
195203
typedef struct _RobotSpeed
196204
{
197205
int32_t linearCenter; /**< Linear speed of the vehicle center. [mm/s] */
198206
int32_t angular; /**< Angular speed. [mrad/s] */
199207
} __attribute__((packed)) RobotSpeed;
200208

209+
static_assert(sizeof(RobotSpeed) <= MAX_DATA_LEN,
210+
"RobotSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
211+
201212
/** Struct of the "Current Vehicle Data" channel payload. */
202213
typedef struct _VehicleData
203214
{
@@ -210,18 +221,27 @@ typedef struct _VehicleData
210221
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
211222
} __attribute__((packed)) VehicleData;
212223

224+
static_assert(sizeof(VehicleData) <= MAX_DATA_LEN,
225+
"VehicleData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
226+
213227
/** Struct of the "Status" channel payload. */
214228
typedef struct _Status
215229
{
216230
SMPChannelPayload::Status status; /**< Status */
217231
} __attribute__((packed)) Status;
218232

233+
static_assert(sizeof(Status) <= MAX_DATA_LEN,
234+
"Status struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
235+
219236
/** Struct of the "Line Sensor" channel payload. */
220237
typedef struct _LineSensorData
221238
{
222239
uint16_t lineSensorData[5U]; /**< Line sensor data [digits] normalized to max 1000 digits. */
223240
} __attribute__((packed)) LineSensorData;
224241

242+
static_assert(sizeof(LineSensorData) <= MAX_DATA_LEN,
243+
"LineSensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
244+
225245
/******************************************************************************
226246
* Functions
227247
*****************************************************************************/

lib/APPRemoteControl/src/SerialMuxChannels.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/******************************************************************************
4141
* Includes
4242
*****************************************************************************/
43-
4443
#include <Arduino.h>
4544
#include <SerialMuxProtServer.hpp>
4645

@@ -171,6 +170,9 @@ typedef struct _Command
171170

172171
} __attribute__((packed)) Command;
173172

173+
static_assert(sizeof(Command) <= MAX_DATA_LEN,
174+
"Command struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
175+
174176
/** Struct of the "Command Response" channel payload. */
175177
typedef struct _CommandResponse
176178
{
@@ -184,20 +186,29 @@ typedef struct _CommandResponse
184186
};
185187
} __attribute__((packed)) CommandResponse;
186188

189+
static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN,
190+
"CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
191+
187192
/** Struct of the "Motor Speed Setpoints" channel payload. */
188193
typedef struct _MotorSpeed
189194
{
190195
int32_t left; /**< Left motor speed [mm/s] */
191196
int32_t right; /**< Right motor speed [mm/s] */
192197
} __attribute__((packed)) MotorSpeed;
193198

199+
static_assert(sizeof(MotorSpeed) <= MAX_DATA_LEN,
200+
"MotorSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
201+
194202
/** Struct of the "Robot Speed Setpoints" channel payload. */
195203
typedef struct _RobotSpeed
196204
{
197205
int32_t linearCenter; /**< Linear speed of the vehicle center. [mm/s] */
198206
int32_t angular; /**< Angular speed. [mrad/s] */
199207
} __attribute__((packed)) RobotSpeed;
200208

209+
static_assert(sizeof(RobotSpeed) <= MAX_DATA_LEN,
210+
"RobotSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
211+
201212
/** Struct of the "Current Vehicle Data" channel payload. */
202213
typedef struct _VehicleData
203214
{
@@ -210,18 +221,27 @@ typedef struct _VehicleData
210221
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
211222
} __attribute__((packed)) VehicleData;
212223

224+
static_assert(sizeof(VehicleData) <= MAX_DATA_LEN,
225+
"VehicleData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
226+
213227
/** Struct of the "Status" channel payload. */
214228
typedef struct _Status
215229
{
216230
SMPChannelPayload::Status status; /**< Status */
217231
} __attribute__((packed)) Status;
218232

233+
static_assert(sizeof(Status) <= MAX_DATA_LEN,
234+
"Status struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
235+
219236
/** Struct of the "Line Sensor" channel payload. */
220237
typedef struct _LineSensorData
221238
{
222239
uint16_t lineSensorData[5U]; /**< Line sensor data [digits] normalized to max 1000 digits. */
223240
} __attribute__((packed)) LineSensorData;
224241

242+
static_assert(sizeof(LineSensorData) <= MAX_DATA_LEN,
243+
"LineSensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
244+
225245
/******************************************************************************
226246
* Functions
227247
*****************************************************************************/

lib/APPSensorFusion/src/SerialMuxChannels.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
/******************************************************************************
4242
* Includes
4343
*****************************************************************************/
44-
4544
#include <stdint.h>
4645
#include <SerialMuxProtServer.hpp>
4746

@@ -94,6 +93,9 @@ typedef struct _SensorData
9493

9594
} __attribute__((packed)) SensorData;
9695

96+
static_assert(sizeof(SensorData) <= MAX_DATA_LEN,
97+
"SensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
98+
9799
/******************************************************************************
98100
* Functions
99101
*****************************************************************************/

lib/APPTurtle/src/SerialMuxChannels.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/******************************************************************************
4141
* Includes
4242
*****************************************************************************/
43-
4443
#include <Arduino.h>
4544
#include <SerialMuxProtServer.hpp>
4645

@@ -171,6 +170,9 @@ typedef struct _Command
171170

172171
} __attribute__((packed)) Command;
173172

173+
static_assert(sizeof(Command) <= MAX_DATA_LEN,
174+
"Command struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
175+
174176
/** Struct of the "Command Response" channel payload. */
175177
typedef struct _CommandResponse
176178
{
@@ -184,20 +186,29 @@ typedef struct _CommandResponse
184186
};
185187
} __attribute__((packed)) CommandResponse;
186188

189+
static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN,
190+
"CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
191+
187192
/** Struct of the "Motor Speed Setpoints" channel payload. */
188193
typedef struct _MotorSpeed
189194
{
190195
int32_t left; /**< Left motor speed [mm/s] */
191196
int32_t right; /**< Right motor speed [mm/s] */
192197
} __attribute__((packed)) MotorSpeed;
193198

199+
static_assert(sizeof(MotorSpeed) <= MAX_DATA_LEN,
200+
"MotorSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
201+
194202
/** Struct of the "Robot Speed Setpoints" channel payload. */
195203
typedef struct _RobotSpeed
196204
{
197205
int32_t linearCenter; /**< Linear speed of the vehicle center. [mm/s] */
198206
int32_t angular; /**< Angular speed. [mrad/s] */
199207
} __attribute__((packed)) RobotSpeed;
200208

209+
static_assert(sizeof(RobotSpeed) <= MAX_DATA_LEN,
210+
"RobotSpeed struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
211+
201212
/** Struct of the "Current Vehicle Data" channel payload. */
202213
typedef struct _VehicleData
203214
{
@@ -210,18 +221,27 @@ typedef struct _VehicleData
210221
SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */
211222
} __attribute__((packed)) VehicleData;
212223

224+
static_assert(sizeof(VehicleData) <= MAX_DATA_LEN,
225+
"VehicleData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
226+
213227
/** Struct of the "Status" channel payload. */
214228
typedef struct _Status
215229
{
216230
SMPChannelPayload::Status status; /**< Status */
217231
} __attribute__((packed)) Status;
218232

233+
static_assert(sizeof(Status) <= MAX_DATA_LEN,
234+
"Status struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
235+
219236
/** Struct of the "Line Sensor" channel payload. */
220237
typedef struct _LineSensorData
221238
{
222239
uint16_t lineSensorData[5U]; /**< Line sensor data [digits] normalized to max 1000 digits. */
223240
} __attribute__((packed)) LineSensorData;
224241

242+
static_assert(sizeof(LineSensorData) <= MAX_DATA_LEN,
243+
"LineSensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame.");
244+
225245
/******************************************************************************
226246
* Functions
227247
*****************************************************************************/

0 commit comments

Comments
 (0)