Skip to content

Commit

Permalink
Merge pull request #43 from plundstr/master
Browse files Browse the repository at this point in the history
[batterytracker] Skip battery reading on first reading after boot
  • Loading branch information
Pekka Lundstrom committed Nov 22, 2013
2 parents 7bd7e66 + 0dd1863 commit ce7ec51
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
@@ -1,5 +1,5 @@
# Package name and version
AC_INIT(dsme, 0.64.0)
AC_INIT(dsme, 0.64.1)

AM_INIT_AUTOMAKE

Expand Down
13 changes: 13 additions & 0 deletions modules/batterytracker.c
Expand Up @@ -336,8 +336,21 @@ static void schedule_next_wakeup(void)

static void do_regular_duties()
{
static bool first_reading = true;

// dsme_log(LOG_DEBUG, "batterytracker: %s()", __FUNCTION__);

if (first_reading) {
// First reading after boot for battery levels is unreliable
// Don't use its values
// We will schedule new reading after one minute
first_reading = false;
dsme_log(LOG_DEBUG, "batterytracker: Skip battery data on first reading");
battery_state.data_uptodate = false;
schedule_next_wakeup();
return;
}

update_battery_info();
if (battery_state.data_uptodate) {
update_battery_status();
Expand Down
2 changes: 1 addition & 1 deletion rpm/dsme.spec
Expand Up @@ -13,7 +13,7 @@ Name: dsme
# << macros

Summary: Device State Management Entity
Version: 0.64.0
Version: 0.64.1
Release: 0
Group: System/System Control
License: LGPLv2+
Expand Down
2 changes: 1 addition & 1 deletion rpm/dsme.yaml
@@ -1,6 +1,6 @@
Name: dsme
Summary: Device State Management Entity
Version: 0.64.0
Version: 0.64.1
Release: 0
Group: System/System Control
License: LGPLv2+
Expand Down

0 comments on commit ce7ec51

Please sign in to comment.