Skip to content

Commit 9f13513

Browse files
committed
Moved RemoteControl Commands and responses to SerialMuxChannels
The commands depend on the channels, so it makes sense to have them together
1 parent 981d570 commit 9f13513

File tree

4 files changed

+29
-92
lines changed

4 files changed

+29
-92
lines changed

lib/ConvoyLeader/src/App.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
* Includes
3434
*****************************************************************************/
3535
#include "App.h"
36-
#include "RemoteControl.h"
3736
#include <Board.h>
3837
#include <Logging.h>
3938
#include <LogSinkPrinter.h>

lib/ConvoyLeader/src/RemoteControl.h

-87
This file was deleted.

lib/ConvoyLeader/src/SerialMuxChannels.h

+29-3
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,36 @@
7777
/** SerialMuxProt Server with fixed template argument. */
7878
typedef SerialMuxProtServer<MAX_CHANNELS> SMPServer;
7979

80+
/** RemoteControl application constants */
81+
namespace RemoteControl
82+
{
83+
/** Remote control commands. */
84+
typedef enum : uint8_t
85+
{
86+
CMD_ID_IDLE = 0, /**< Nothing to do. */
87+
CMD_ID_START_LINE_SENSOR_CALIB, /**< Start line sensor calibration. */
88+
CMD_ID_START_MOTOR_SPEED_CALIB, /**< Start motor speed calibration. */
89+
CMD_ID_REINIT_BOARD, /**< Re-initialize the board. Required for webots simulation. */
90+
CMD_ID_GET_MAX_SPEED, /**< Get maximum speed. */
91+
CMD_ID_START_DRIVING, /**< Start driving. */
92+
CMD_ID_SET_INIT_POS, /**< Set initial position. */
93+
94+
} CmdId;
95+
96+
/** Remote control command responses. */
97+
typedef enum : uint8_t
98+
{
99+
RSP_ID_OK = 0, /**< Command successful executed. */
100+
RSP_ID_PENDING, /**< Command is pending. */
101+
RSP_ID_ERROR /**< Command failed. */
102+
103+
} RspId;
104+
} /* namespace RemoteControl */
105+
80106
/** Struct of the "Command" channel payload. */
81107
typedef struct _Command
82108
{
83-
uint8_t commandId; /**< Command ID */
109+
RemoteControl::CmdId commandId; /**< Command ID */
84110

85111
/** Command payload. */
86112
union
@@ -99,8 +125,8 @@ typedef struct _Command
99125
/** Struct of the "Command Response" channel payload. */
100126
typedef struct _CommandResponse
101127
{
102-
uint8_t commandId; /**< Command ID */
103-
uint8_t responseId; /**< Response to the command */
128+
RemoteControl::CmdId commandId; /**< Command ID */
129+
RemoteControl::RspId responseId; /**< Response to the command */
104130

105131
/** Response Payload. */
106132
union

lib/ConvoyLeader/src/StartupState.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
#include "StartupState.h"
3737
#include "IdleState.h"
38-
#include "RemoteControl.h"
3938
#include <new>
4039
#include <SettingsHandler.h>
4140

0 commit comments

Comments
 (0)