diff options
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index a60a35c8cb..4b3999751c 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -544,12 +544,12 @@ static void power_thread_sleep(int ticks) | |||
544 | */ | 544 | */ |
545 | if (!ata_disk_is_active() || usb_inserted()) { | 545 | if (!ata_disk_is_active() || usb_inserted()) { |
546 | avgbat = avgbat - (avgbat / BATT_AVE_SAMPLES) + | 546 | avgbat = avgbat - (avgbat / BATT_AVE_SAMPLES) + |
547 | adc_read(ADC_UNREG_POWER); | 547 | adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR; |
548 | /* | 548 | /* |
549 | * battery_centivolts is the centivolt-scaled filtered battery value. | 549 | * battery_centivolts is the centivolt-scaled filtered battery value. |
550 | */ | 550 | */ |
551 | battery_centivolts = ((avgbat / BATT_AVE_SAMPLES) * | 551 | battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; |
552 | BATTERY_SCALE_FACTOR) / 10000; | 552 | |
553 | } | 553 | } |
554 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) | 554 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) |
555 | /* | 555 | /* |
@@ -585,8 +585,9 @@ static void power_thread(void) | |||
585 | 585 | ||
586 | /* initialize the voltages for the exponential filter */ | 586 | /* initialize the voltages for the exponential filter */ |
587 | 587 | ||
588 | avgbat = adc_read(ADC_UNREG_POWER) * BATT_AVE_SAMPLES; | 588 | avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR * |
589 | battery_centivolts = ((avgbat / BATT_AVE_SAMPLES) * BATTERY_SCALE_FACTOR) / 10000; | 589 | BATT_AVE_SAMPLES; |
590 | battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; | ||
590 | 591 | ||
591 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) | 592 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) |
592 | fd = -1; | 593 | fd = -1; |