Combine cmdid and cmdset into cmd code

refactor
PgSocks 2 years ago
parent 6e10db0e07
commit 77000b525f

@ -8,7 +8,7 @@
static const uint8_t CHASSIS_HOST = 3;
static const uint8_t CHASSIS_INDEX = 6;
static const uint8_t SET_WHEEL_SPEED_CMDID = 0x20;
static const uint16_t SET_WHEEL_SPEED_CMD = 0x203F;
void
set_wheel_speed (
@ -18,7 +18,7 @@ set_wheel_speed (
int16_t w3,
int16_t w4 );
static const uint8_t CHASSIS_SPEED_MODE_CMDID = 0x21;
static const uint16_t CHASSIS_SPEED_MODE_CMD = 0x213F;
void
chassis_speed_mode (

@ -40,8 +40,13 @@ struct PACKED Header {
};
// Each command has a cmdset and cmdid that together make a cmd key
union {
uint16_t cmd;
struct {
uint8_t cmdset;
uint8_t cmdid;
};
};
};

@ -8,7 +8,7 @@
static const uint8_t SDK_HOST = 9;
static const uint8_t SDK_INDEX = 0;
static const uint8_t SET_SDK_CONNECTION_CMDID = 0xD4;
static const uint16_t SET_SDK_CONNECTION_CMD = 0xD43F;
enum CONNECTION {
CONNECTION_WIFI_AP = 0,
@ -23,18 +23,18 @@ set_sdk_connection(
uint32_t ip_address,
uint16_t port );
static const uint8_t SDK_HEARTBEAT_CMDID = 0xD5;
static const uint16_t SDK_HEARTBEAT_CMD = 0xD53F;
void
sdk_heartbeat(
Client session );
static const uint8_t SET_SDK_MODE_CMDID = 0xd1;
static const uint16_t SET_SDK_MODE_CMD = 0xD13F;
void
set_sdk_mode(Client session, bool enable);
static const uint8_t SET_SYSTEM_LED_CMDID = 0x33;
static const uint16_t SET_SYSTEM_LED_CMD = 0x333F;
enum LEDCOMP {
LEDCOMP_BOTTOM_BACK = 0x1,
@ -67,7 +67,7 @@ void set_system_led (
uint16_t t1,
uint16_t t2 );
static const uint8_t SET_ROBOT_MODE_CMDID = 0x46;
static const uint16_t SET_ROBOT_MODE_CMD = 0x463F;
enum MOVEMENTMODE {
MOVEMENTMODE_FREE,
@ -80,15 +80,13 @@ set_robot_mode (
Client session,
enum MOVEMENTMODE mode );
// cmdset 0x48
static const uint8_t SUBNODE_RESET_CMDID = 0x02;
static const uint16_t SUBNODE_RESET_CMD = 0x0248;
void
subnode_reset (
Client session );
// cmdset 0x48
static const uint8_t SUBSCRIBE_ADD_NODE_CMDID = 0x01;
static const uint16_t SUBSCRIBE_ADD_NODE_CMD = 0x0148;
void
subscribe_add_node (

Loading…
Cancel
Save