fixed order of setting state_of_charge
This commit is contained in:
parent
df4ec51f96
commit
b8a8ecd59d
1 changed files with 2 additions and 2 deletions
|
@ -41,6 +41,8 @@ static int zmk_battery_update(const struct device *battery) {
|
|||
}
|
||||
|
||||
if (last_state_of_charge != state_of_charge.val1) {
|
||||
last_state_of_charge = state_of_charge.val1;
|
||||
|
||||
LOG_DBG("Setting BAS GATT battery level to %d.", state_of_charge.val1);
|
||||
|
||||
rc = bt_bas_set_battery_level(state_of_charge.val1);
|
||||
|
@ -52,8 +54,6 @@ static int zmk_battery_update(const struct device *battery) {
|
|||
|
||||
rc = ZMK_EVENT_RAISE(new_zmk_battery_state_changed(
|
||||
(struct zmk_battery_state_changed){.state_of_charge = state_of_charge.val1}));
|
||||
|
||||
last_state_of_charge = state_of_charge.val1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Reference in a new issue