Skip to content

Commit

Permalink
Added response union
Browse files Browse the repository at this point in the history
  • Loading branch information
gabryelreyes committed Jan 16, 2024
1 parent 67d39be commit 76826f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/RemoteControl/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ void App_cmdRspChannelCallback(const uint8_t* payload, const uint8_t payloadSize
if ((nullptr != payload) && (COMMAND_RESPONSE_CHANNEL_DLC == payloadSize))
{
const CommandResponse* cmdRsp = reinterpret_cast<const CommandResponse*>(payload);
LOG_DEBUG("CMD_RSP: ID: 0x%02X , RSP: 0x%02X", cmdRsp->commandId, cmdRsp->response);
LOG_DEBUG("CMD_RSP: ID: 0x%02X , RSP: 0x%02X", cmdRsp->commandId, cmdRsp->responseId);

if (0x04 == cmdRsp->commandId)
{
LOG_DEBUG("Max Speed: %d", cmdRsp->value);
LOG_DEBUG("Max Speed: %d", cmdRsp->maxMotorSpeed);
}
}
else
Expand Down
11 changes: 8 additions & 3 deletions lib/RemoteControl/src/SerialMuxChannels.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ typedef struct _Command
/** Struct of the "Command Response" channel payload. */
typedef struct _CommandResponse
{
uint8_t commandId; /**< Command ID */
uint8_t response; /**< Response to the command */
int16_t value; /**< Value of the response */
uint8_t commandId; /**< Command ID */
uint8_t responseId; /**< Response to the command */

/** Response Payload. */
union
{
int16_t maxMotorSpeed; /**< Max speed. */
};
} __attribute__((packed)) CommandResponse;

/** Struct of the "Speed" channel payload. */
Expand Down

0 comments on commit 76826f2

Please sign in to comment.