From dc1d5f77afb0a90281ffabfde8a91706c6d6203e Mon Sep 17 00:00:00 2001 From: PgSocks Date: Sun, 25 Dec 2022 01:13:25 -0600 Subject: [PATCH] Add Set SDK Mode message --- src/robomaster.c | 8 ++++++++ src/robomaster.h | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/robomaster.c b/src/robomaster.c index 520c554..49179a1 100644 --- a/src/robomaster.c +++ b/src/robomaster.c @@ -66,6 +66,14 @@ set_sdk_connection_req_new( return message_new(session, 0x3F, SET_SDK_CONNECTION_CMDID, sizeof(msg), &msg); } +const Message +set_sdk_mode_req_new( + Client session, + bool enable ) { + const struct SetSdkModeReq msg = { enable }; + return message_new(session, 0x3F, SET_SDK_MODE_CMDID, sizeof(msg), &msg); +} + const Message set_system_led_req_new ( Client session, diff --git a/src/robomaster.h b/src/robomaster.h index 2bf6e18..55a553b 100644 --- a/src/robomaster.h +++ b/src/robomaster.h @@ -115,7 +115,7 @@ enum CONNECTION { CONNECTION_WIFI_AP = 0, CONNECTION_WIFI_STA = 1, CONNECTION_USB_RNDIS = 2 -} +}; struct PACKED SetSdkConnectionReq { uint8_t control; @@ -138,6 +138,20 @@ const Message set_sdk_connection_req_new( uint32_t ip_address, uint16_t port ); +static const uint8_t SET_SDK_MODE_CMDID = 0xd1; + +struct PACKED SetSdkModeReq { + uint8_t enable; +}; + +struct PACKED SetSdkModeResp { + uint8_t retcode; +}; + +const Message set_sdk_mode_req_new( + Client session, + bool enable ); + static const uint8_t GET_VERSION_CMDID = 0x01; // NOTE: No GetVersion request body