fix(battery): Error sensor channel name
When using CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE get a message in the log Failed to fetch battery values: -...
In battery.c sensor channel name: SENSOR_CHAN_VOLTAGE but in battery_common.c : SENSOR_CHAN_GAUGE_VOLTAGE
battery_common.c :
int battery_channel_get(const struct battery_value *value, enum sensor_channel chan,
struct sensor_value *val_out) {
switch (chan) {
case SENSOR_CHAN_GAUGE_VOLTAGE:
val_out->val1 = value->millivolts / 1000;
val_out->val2 = (value->millivolts % 1000) * 1000U;
break;
case SENSOR_CHAN_GAUGE_STATE_OF_CHARGE:
val_out->val1 = value->state_of_charge;
val_out->val2 = 0;
break;
default:
return -ENOTSUP;
}
return 0;
}
I believe this was intentional, as Zephyr's voltage divider driver uses SENSOR_CHAN_VOLTAGE and not SENSOR_CHAN_GAUGE_VOLTAGE. Using the default value of CONFIG_ZMK_BATTERY_REPORTING_FETCH_MODE_STATE_OF_CHARGE should work with ZMK's battery drivers.
(I have a PR that would change the battery drivers over to using SENSOR_CHAN_VOLTAGE instead at #2256, but I still need to address Pete's feedback on it.)
Closing as no files are being changed.