fixed order of setting state_of_charge

This commit is contained in:
JP Bonn 2021-03-06 21:32:19 -07:00 committed by Pete Johanson
parent df4ec51f96
commit b8a8ecd59d

View file

@ -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;