Update battery.c

added some comments to identify where help is needed
This commit is contained in:
Darryldh 2021-08-05 20:00:13 -04:00
parent b1cdd7e5b5
commit 9f995ed744

View file

@ -110,7 +110,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The configured battery sensor does not support the channel: Voltage"); LOG_DBG("The configured battery sensor does not support the channel: Voltage");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.voltage = voltage.val1; bat_state_data.voltage = voltage.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery voltage: %d.%dV", voltage.val1, voltage.val2); LOG_DBG("-----> battery voltage: %d.%dV", voltage.val1, voltage.val2);
} }
@ -125,7 +125,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Average Current"); LOG_DBG("The battery sensor does not support the channel: Average Current");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.current = current.val1; bat_state_data.current = current.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Average Current: %d.%dA", current.val1, current.val2); LOG_DBG("-----> battery Average Current: %d.%dA", current.val1, current.val2);
} }
@ -140,7 +140,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Standby Current"); LOG_DBG("The battery sensor does not support the channel: Standby Current");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.current_standby = current_standby.val1; bat_state_data.current_standby = current_standby.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Standby Current: %d.%dA", current_standby.val1, LOG_DBG("-----> battery Standby Current: %d.%dA", current_standby.val1,
current_standby.val2); current_standby.val2);
} }
@ -156,7 +156,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Maximum Load Current"); LOG_DBG("The battery sensor does not support the channel: Maximum Load Current");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.current_max_load = current_max_load.val1; bat_state_data.current_max_load = current_max_load.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Maximum Load Current: %d.%dA", current_max_load.val1, LOG_DBG("-----> battery Maximum Load Current: %d.%dA", current_max_load.val1,
current_max_load.val2); current_max_load.val2);
} }
@ -172,7 +172,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Full Charge Capacity"); LOG_DBG("The battery sensor does not support the channel: Full Charge Capacity");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.full_charge_capacity = full_charge_capacity.val1; bat_state_data.full_charge_capacity = full_charge_capacity.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Full Charge Capacity: %d.%dmAh", full_charge_capacity.val1, LOG_DBG("-----> battery Full Charge Capacity: %d.%dmAh", full_charge_capacity.val1,
full_charge_capacity.val2); full_charge_capacity.val2);
} }
@ -188,7 +188,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Remaining Charge Capacity"); LOG_DBG("The battery sensor does not support the channel: Remaining Charge Capacity");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.remaining_charge_capacity = remaining_charge_capacity.val1; bat_state_data.remaining_charge_capacity = remaining_charge_capacity.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Remaining Charge Capacity: %d.%dmAh", remaining_charge_capacity.val1, LOG_DBG("-----> battery Remaining Charge Capacity: %d.%dmAh", remaining_charge_capacity.val1,
remaining_charge_capacity.val2); remaining_charge_capacity.val2);
} }
@ -204,7 +204,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Nominal Available Capacity"); LOG_DBG("The battery sensor does not support the channel: Nominal Available Capacity");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.nominal_available_capacity = nominal_available_capacity.val1; bat_state_data.nominal_available_capacity = nominal_available_capacity.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Nominal Available Capacity: %d.%dmAh", nominal_available_capacity.val1, LOG_DBG("-----> battery Nominal Available Capacity: %d.%dmAh", nominal_available_capacity.val1,
nominal_available_capacity.val2); nominal_available_capacity.val2);
} }
@ -220,7 +220,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Full Available Capacity"); LOG_DBG("The battery sensor does not support the channel: Full Available Capacity");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.full_available_capacity = full_available_capacity.val1; bat_state_data.full_available_capacity = full_available_capacity.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Full Available Capacity: %d.%dmAh", full_available_capacity.val1, LOG_DBG("-----> battery Full Available Capacity: %d.%dmAh", full_available_capacity.val1,
full_available_capacity.val2); full_available_capacity.val2);
} }
@ -236,7 +236,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Average Power Usage"); LOG_DBG("The battery sensor does not support the channel: Average Power Usage");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.avg_power = avg_power.val1; bat_state_data.avg_power = avg_power.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Average Power Usage: %d.%dmW", avg_power.val1, avg_power.val2); LOG_DBG("-----> battery Average Power Usage: %d.%dmW", avg_power.val1, avg_power.val2);
} }
@ -251,7 +251,7 @@ static int zmk_battery_update(const struct device *battery) {
LOG_DBG("The battery sensor does not support the channel: Internal IC Temperature"); LOG_DBG("The battery sensor does not support the channel: Internal IC Temperature");
} else { } else {
/* append this value to the battery state changed event */ /* append this value to the battery state changed event */
bat_state_data.int_temp = int_temp.val1; bat_state_data.int_temp = int_temp.val1; /*combine val1" and "val2" here*/
LOG_DBG("-----> battery Internal IC Temperature: %d.%d C", int_temp.val1, int_temp.val2); LOG_DBG("-----> battery Internal IC Temperature: %d.%d C", int_temp.val1, int_temp.val2);
} }