refactor: unified controller state by state_mgr
This commit is contained in:
+13
-9
@@ -14,6 +14,7 @@
|
||||
#include "pico/multicore.h"
|
||||
#include "pico/util/queue.h"
|
||||
#include "config.h"
|
||||
#include "state_mgr.h"
|
||||
#include "usb.h"
|
||||
|
||||
#define INPUT_CHANNELS 4
|
||||
@@ -116,20 +117,23 @@ void audio_loop() {
|
||||
pkt[8] = buf_len; // 这 4 个字节的作用未知,调整没有效果
|
||||
pkt[9] = buf_len; // audio buffer length 只有调整这个字节生效。
|
||||
pkt[10] = packetCounter++;
|
||||
pkt[11] = 0x12 | 0 << 6 | 1 << 7;
|
||||
pkt[12] = SAMPLE_SIZE;
|
||||
memcpy(pkt + 13, haptic_buf, SAMPLE_SIZE);
|
||||
#if !DISABLE_SPEAKER_PROC
|
||||
pkt[77] = (plug_headset ? 0x16 : 0x13) | 0 << 6 | 1 << 7; // Speaker: 0x13
|
||||
pkt[11] = 0x10 | 0 << 6 | 1 << 7;
|
||||
pkt[12] = 63;
|
||||
state_set(pkt + 13,63);
|
||||
// memcpy(pkt + 13, state_data, sizeof(state_data));
|
||||
pkt[76] = 0x12 | 0 << 6 | 1 << 7;
|
||||
pkt[77] = SAMPLE_SIZE;
|
||||
memcpy(pkt + 78, haptic_buf, SAMPLE_SIZE);
|
||||
pkt[142] = (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[143] = 200;
|
||||
critical_section_enter_blocking(&opus_cs);
|
||||
memcpy(pkt + 79, opus_buf, 200);
|
||||
memcpy(pkt + 144, opus_buf, 200);
|
||||
critical_section_exit(&opus_cs);
|
||||
#endif
|
||||
bt_write(pkt, sizeof(pkt), true);
|
||||
|
||||
bt_write(pkt, sizeof(pkt));
|
||||
haptic_buf_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user