Skip to content

Commit

Permalink
Merge pull request #71 from nemomobile/plu
Browse files Browse the repository at this point in the history
[thermalsensor] Log unsual battery temperature readings JB#18785
  • Loading branch information
Pekka Lundstrom committed May 2, 2014
2 parents 216c9cd + 849070a commit 388869e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/thermalsensor_hw.c
Expand Up @@ -129,6 +129,7 @@ extern bool dsme_hw_get_battery_temperature(thermal_object_t* thermal_ob
{
int temperature;
bool ret;
static int previous_temp = -999;

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

Expand All @@ -141,6 +142,17 @@ extern bool dsme_hw_get_battery_temperature(thermal_object_t* thermal_ob
temperature = INVALID_TEMPERATURE;
ret = false;
}

/* Log unsual temp readings */
if ((previous_temp != -999) &&
((temperature < -30) ||
(temperature > 70) ||
(temperature > (previous_temp + 4)) ||
(temperature < (previous_temp - 4)))) {
dsme_log(LOG_WARNING, "thermal: Suspicious battery temperature %d (previous %d)",temperature, previous_temp );
}
previous_temp = temperature;

if (callback)
callback(thermal_object, temperature);
return ret;
Expand Down

0 comments on commit 388869e

Please sign in to comment.