rename haptics buf_len to audio buf_len
This commit is contained in:
+8
-5
@@ -105,20 +105,23 @@ void audio_loop() {
|
|||||||
pkt[0] = REPORT_ID;
|
pkt[0] = REPORT_ID;
|
||||||
pkt[1] = reportSeqCounter << 4;
|
pkt[1] = reportSeqCounter << 4;
|
||||||
reportSeqCounter = (reportSeqCounter + 1) & 0x0F;
|
reportSeqCounter = (reportSeqCounter + 1) & 0x0F;
|
||||||
pkt[2] = 0x11 | (1 << 7);
|
pkt[2] = 0x11 | 0 << 6 | 1 << 7;
|
||||||
pkt[3] = 7;
|
pkt[3] = 7;
|
||||||
pkt[4] = 0b11111110;
|
pkt[4] = 0b11111110;
|
||||||
const auto buf_len = get_config().haptics_buffer_length;
|
const auto buf_len = get_config().audio_buffer_length;
|
||||||
pkt[5] = buf_len;
|
pkt[5] = buf_len;
|
||||||
pkt[6] = buf_len;
|
pkt[6] = buf_len;
|
||||||
pkt[7] = buf_len;
|
pkt[7] = buf_len;
|
||||||
pkt[8] = buf_len;
|
pkt[8] = buf_len; // 这 4 个字节的作用未知,调整没有效果
|
||||||
pkt[9] = buf_len; // buffer length
|
pkt[9] = buf_len; // audio buffer length 只有调整这个字节生效。
|
||||||
pkt[10] = packetCounter++;
|
pkt[10] = packetCounter++;
|
||||||
pkt[11] = 0x12 | (1 << 7);
|
pkt[11] = 0x12 | 0 << 6 | 1 << 7;
|
||||||
pkt[12] = SAMPLE_SIZE;
|
pkt[12] = SAMPLE_SIZE;
|
||||||
memcpy(pkt + 13, haptic_buf, SAMPLE_SIZE);
|
memcpy(pkt + 13, haptic_buf, SAMPLE_SIZE);
|
||||||
pkt[77] = (plug_headset ? 0x16 : 0x13) | 0 << 6 | 1 << 7; // Speaker: 0x13
|
pkt[77] = (plug_headset ? 0x16 : 0x13) | 0 << 6 | 1 << 7; // Speaker: 0x13
|
||||||
|
// L Headset Mono: 0x14
|
||||||
|
// L Headset R Speaker: 0x15
|
||||||
|
// Headset: 0x16
|
||||||
pkt[78] = 200;
|
pkt[78] = 200;
|
||||||
critical_section_enter_blocking(&opus_cs);
|
critical_section_enter_blocking(&opus_cs);
|
||||||
memcpy(pkt + 79, opus_buf, 200);
|
memcpy(pkt + 79, opus_buf, 200);
|
||||||
|
|||||||
+2
-2
@@ -71,8 +71,8 @@ void config_valid() {
|
|||||||
body->polling_rate_mode = 0;
|
body->polling_rate_mode = 0;
|
||||||
printf("[Config] polling_rate_mode is invalid\n");
|
printf("[Config] polling_rate_mode is invalid\n");
|
||||||
}
|
}
|
||||||
if (body->haptics_buffer_length < 16 || body->haptics_buffer_length > 128) {
|
if (body->audio_buffer_length < 16 || body->audio_buffer_length > 128) {
|
||||||
body->haptics_buffer_length = 64;
|
body->audio_buffer_length = 64;
|
||||||
printf("[Config] haptics_buffer_length is invalid\n");
|
printf("[Config] haptics_buffer_length is invalid\n");
|
||||||
}
|
}
|
||||||
if (body->controller_mode > 2) {
|
if (body->controller_mode > 2) {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ struct __attribute__((packed)) Config_body {
|
|||||||
uint8_t disable_inactive_disconnect; // bool: 0 disable,1 enable
|
uint8_t disable_inactive_disconnect; // bool: 0 disable,1 enable
|
||||||
uint8_t disable_pico_led; // bool
|
uint8_t disable_pico_led; // bool
|
||||||
uint8_t polling_rate_mode; // 0: 250Hz, 1: 500Hz, 2: real-time
|
uint8_t polling_rate_mode; // 0: 250Hz, 1: 500Hz, 2: real-time
|
||||||
uint8_t haptics_buffer_length; // [16,128]
|
uint8_t audio_buffer_length; // [16,128]
|
||||||
uint8_t controller_mode; // 0: DS5, 1: DSE, 2: Auto
|
uint8_t controller_mode; // 0: DS5, 1: DSE, 2: Auto
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user