summaryrefslogtreecommitdiffstats
path: root/apps/main.c
diff options
context:
space:
mode:
authorBoris Gjenero <dreamlayers@rockbox.org>2011-12-31 18:31:47 +0000
committerBoris Gjenero <dreamlayers@rockbox.org>2011-12-31 18:31:47 +0000
commit5cd8aec39a05a78c6ae7b9c81d2c0f8acf0aac48 (patch)
tree86f77e720f5ed3d97aec0c8e31e64da0676d1a5c /apps/main.c
parenta5e44591c24260d0411bfe8e6de9a9c683dd1534 (diff)
downloadrockbox-5cd8aec39a05a78c6ae7b9c81d2c0f8acf0aac48.tar.gz
rockbox-5cd8aec39a05a78c6ae7b9c81d2c0f8acf0aac48.tar.bz2
rockbox-5cd8aec39a05a78c6ae7b9c81d2c0f8acf0aac48.zip
Fix FS#7631 : Archos V2 and FM Recorder charging screen problems
ATA power is off in the charging screen to avoid problems when the battery is deeply discharged. Without ATA power, Archos FM and V2 Recorders measure battery voltage as 0V, leading to an unwanted low battery shutdown. This change delays powermgmt_init() on those targets until after ATA power is turned on by storage_init(). The charging screen displays input current, so there is some visible feedback on charging progress. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31484 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main.c')
-rw-r--r--apps/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/main.c b/apps/main.c
index 5715057ee2..9846f116be 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -506,7 +506,12 @@ static void init(void)
button_init();
+ /* Don't initialize power management here if it could incorrectly
+ * measure battery voltage, and it's not needed for charging. */
+#if !defined(NEED_ATA_POWER_BATT_MEASURE) || \
+ (CONFIG_CHARGING > CHARGING_MONITOR)
powermgmt_init();
+#endif
#if CONFIG_TUNER
radio_init();
@@ -567,6 +572,12 @@ static void init(void)
panicf("ata: %d", rc);
}
+#if defined(NEED_ATA_POWER_BATT_MEASURE) && \
+ (CONFIG_CHARGING <= CHARGING_MONITOR)
+ /* After storage_init(), ATA power must be on, so battery voltage
+ * can be measured. Initialize power management if it was delayed. */
+ powermgmt_init();
+#endif
#ifdef HAVE_EEPROM_SETTINGS
CHART(">eeprom_settings_init");
eeprom_settings_init();