Skip to content

Commit

Permalink
fix: pisugar 2 charging flag
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyc committed May 6, 2024
1 parent 6e6b2ea commit e5e9a41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pisugar-module/pisugar-2/pisugar_2_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ static void ip5209_monitor_once(struct i2c_client *pisugar_2_client)
pisugar_2_battery_statuses->capacity = cap;

// charging status
charging_flags = i2c_smbus_read_byte_data(pisugar_2_client, 0x71);
ac_status = charging_flags > 0 ? 1 : 0;
charging_flags = i2c_smbus_read_byte_data(pisugar_2_client, 0x55);
ac_status = (charging_flags & 0x10) > 0 ? 1 : 0;

update_bat_capacity_level_and_status();
}
Expand Down Expand Up @@ -386,8 +386,8 @@ static void ip5312_monitor_once(struct i2c_client *pisugar_2_client)
pisugar_2_battery_statuses->capacity = cap;

// charging status
charging_flags = i2c_smbus_read_byte_data(pisugar_2_client, 0x79);
ac_status = (charging_flags >> 6) > 0 ? 1 : 0;
charging_flags = i2c_smbus_read_byte_data(pisugar_2_client, 0x58);
ac_status = (charging_flags & 0x10) > 0 ? 1 : 0;

update_bat_capacity_level_and_status();
}
Expand Down

0 comments on commit e5e9a41

Please sign in to comment.