fix: controller auto mode

This commit is contained in:
awalol
2026-05-08 19:31:24 +08:00
parent f8f86a29ef
commit 1014a13ed0
3 changed files with 14 additions and 7 deletions
+12 -6
View File
@@ -341,15 +341,21 @@ static void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
} }
} else if (channel == hid_control_cid) { } else if (channel == hid_control_cid) {
if (check_dse) { if (check_dse) {
check_dse = false; if (packet[0] == 0xA3 && packet[1] == 0x70) {
if (packet[0] == 0x02) { printf("Connected DSE Controller\n");
is_dse = false; check_dse = false;
}else if (size > 1){
is_dse = true; is_dse = true;
}
#if !ENABLE_SERIAL #if !ENABLE_SERIAL
tud_connect(); tud_connect();
#endif #endif
}else if (packet[0] == 0x02) {
printf("Connected DS5 Controller\n");
check_dse = false;
is_dse = false;
#if !ENABLE_SERIAL
tud_connect();
#endif
}
} }
if (packet[0] == 0xA3) { if (packet[0] == 0xA3) {
uint8_t report_id = packet[1]; uint8_t report_id = packet[1];
+1
View File
@@ -16,6 +16,7 @@ constexpr uint32_t CONFIG_MAGIC = 0x66ccff00;
constexpr uint16_t CONFIG_VERSION = 1; constexpr uint16_t CONFIG_VERSION = 1;
constexpr uint32_t CONFIG_FLASH_OFFSET = PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE; constexpr uint32_t CONFIG_FLASH_OFFSET = PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE;
static Config config{}; static Config config{};
bool is_dse = false;
// 编译期保护 // 编译期保护
// 判断Config结构体是否能放进flash 256bytes // 判断Config结构体是否能放进flash 256bytes
+1 -1
View File
@@ -33,6 +33,6 @@ const Config_body& get_config();
void set_config(const uint8_t *new_config, const uint16_t len); void set_config(const uint8_t *new_config, const uint16_t len);
void config_valid(); void config_valid();
void set_config(const Config_body &new_config); void set_config(const Config_body &new_config);
static bool is_dse = false; extern bool is_dse;
#endif //DS5_BRIDGE_CONFIG_H #endif //DS5_BRIDGE_CONFIG_H