[FL-2244] Companion reboot fix (#988)
* bt: don't open rpc session if it is busy * bq27220: fix incorrect checksum calculation Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
2876499c4f
commit
6b78a8ccfe
@ -199,13 +199,18 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
|
|||||||
furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK);
|
furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK);
|
||||||
if(bt->profile == BtProfileSerial) {
|
if(bt->profile == BtProfileSerial) {
|
||||||
// Open RPC session
|
// Open RPC session
|
||||||
FURI_LOG_I(TAG, "Open RPC connection");
|
|
||||||
bt->rpc_session = rpc_session_open(bt->rpc);
|
bt->rpc_session = rpc_session_open(bt->rpc);
|
||||||
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
|
if(bt->rpc_session) {
|
||||||
rpc_session_set_buffer_is_empty_callback(
|
FURI_LOG_I(TAG, "Open RPC connection");
|
||||||
bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty);
|
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
|
||||||
rpc_session_set_context(bt->rpc_session, bt);
|
rpc_session_set_buffer_is_empty_callback(
|
||||||
furi_hal_bt_serial_set_event_callback(RPC_BUFFER_SIZE, bt_serial_event_callback, bt);
|
bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty);
|
||||||
|
rpc_session_set_context(bt->rpc_session, bt);
|
||||||
|
furi_hal_bt_serial_set_event_callback(
|
||||||
|
RPC_BUFFER_SIZE, bt_serial_event_callback, bt);
|
||||||
|
} else {
|
||||||
|
FURI_LOG_W(TAG, "RPC is busy, failed to open new session");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update battery level
|
// Update battery level
|
||||||
PowerInfo info;
|
PowerInfo info;
|
||||||
|
@ -47,7 +47,7 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = {
|
|||||||
.conn_int_min = 0x08,
|
.conn_int_min = 0x08,
|
||||||
.conn_int_max = 0x18,
|
.conn_int_max = 0x18,
|
||||||
.slave_latency = 0,
|
.slave_latency = 0,
|
||||||
.supervisor_timeout = 50,
|
.supervisor_timeout = 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -47,7 +47,7 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = {
|
|||||||
.conn_int_min = 0x08,
|
.conn_int_min = 0x08,
|
||||||
.conn_int_max = 0x18,
|
.conn_int_max = 0x18,
|
||||||
.slave_latency = 0,
|
.slave_latency = 0,
|
||||||
.supervisor_timeout = 50,
|
.supervisor_timeout = 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
|
|||||||
|
|
||||||
delay_us(10000);
|
delay_us(10000);
|
||||||
|
|
||||||
uint8_t checksum = bq27220_get_checksum(&buffer[1], 4);
|
uint8_t checksum = bq27220_get_checksum(buffer, 4);
|
||||||
buffer[0] = checksum;
|
buffer[0] = checksum;
|
||||||
buffer[1] = 6;
|
buffer[1] = 6;
|
||||||
ret = furi_hal_i2c_write_mem(
|
ret = furi_hal_i2c_write_mem(
|
||||||
|
Loading…
Reference in New Issue
Block a user