Merge d77c2e324b
into 0f972f1cc3
This commit is contained in:
commit
71e1de9da2
1 changed files with 7 additions and 1 deletions
|
@ -61,6 +61,7 @@ enum advertising_type {
|
||||||
|
|
||||||
static struct zmk_ble_profile profiles[ZMK_BLE_PROFILE_COUNT];
|
static struct zmk_ble_profile profiles[ZMK_BLE_PROFILE_COUNT];
|
||||||
static uint8_t active_profile;
|
static uint8_t active_profile;
|
||||||
|
static uint8_t last_profile;
|
||||||
|
|
||||||
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
|
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
|
||||||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
||||||
|
@ -265,6 +266,10 @@ static int ble_save_profile(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmk_ble_prof_select(uint8_t index) {
|
int zmk_ble_prof_select(uint8_t index) {
|
||||||
|
if (index == 255) {
|
||||||
|
index = last_profile;
|
||||||
|
}
|
||||||
|
|
||||||
if (index >= ZMK_BLE_PROFILE_COUNT) {
|
if (index >= ZMK_BLE_PROFILE_COUNT) {
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
@ -274,6 +279,7 @@ int zmk_ble_prof_select(uint8_t index) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
last_profile = active_profile;
|
||||||
active_profile = index;
|
active_profile = index;
|
||||||
ble_save_profile();
|
ble_save_profile();
|
||||||
|
|
||||||
|
@ -644,7 +650,7 @@ static void zmk_ble_ready(int err) {
|
||||||
LOG_ERR("Bluetooth init failed (err %d)", err);
|
LOG_ERR("Bluetooth init failed (err %d)", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
last_profile = active_profile;
|
||||||
update_advertising();
|
update_advertising();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue