mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
update state before trying to send rfcomm message
This commit is contained in:
parent
deb81c610f
commit
1d34cc59b2
12
src/hsp_hs.c
12
src/hsp_hs.c
@ -348,18 +348,26 @@ static void hsp_run(void){
|
||||
if (hs_ok_received) break;
|
||||
|
||||
if (hs_microphone_gain >= 0){
|
||||
int gain = hs_microphone_gain;
|
||||
hs_microphone_gain = -1;
|
||||
char buffer[20];
|
||||
sprintf(buffer, "%s=%d\r\n", HSP_HS_MICROPHONE_GAIN, hs_microphone_gain);
|
||||
err = hsp_hs_send_str_over_rfcomm(rfcomm_cid, buffer);
|
||||
if (!err) hs_microphone_gain = -1;
|
||||
if (err) {
|
||||
hs_microphone_gain = gain;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (hs_speaker_gain >= 0){
|
||||
int gain = hs_speaker_gain;
|
||||
hs_speaker_gain = -1;
|
||||
char buffer[20];
|
||||
sprintf(buffer, "%s=%d\r\n", HSP_HS_SPEAKER_GAIN, hs_speaker_gain);
|
||||
err = hsp_hs_send_str_over_rfcomm(rfcomm_cid, buffer);
|
||||
if (!err) hs_speaker_gain = -1;
|
||||
if (err) {
|
||||
hs_speaker_gain = gain;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user