forked from len0rd/rockbox
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
This commit is contained in:
parent
a5e44591c2
commit
5cd8aec39a
2 changed files with 23 additions and 4 deletions
11
apps/main.c
11
apps/main.c
|
|
@ -506,7 +506,12 @@ static void init(void)
|
||||||
|
|
||||||
button_init();
|
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();
|
powermgmt_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
radio_init();
|
radio_init();
|
||||||
|
|
@ -567,6 +572,12 @@ static void init(void)
|
||||||
panicf("ata: %d", rc);
|
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
|
#ifdef HAVE_EEPROM_SETTINGS
|
||||||
CHART(">eeprom_settings_init");
|
CHART(">eeprom_settings_init");
|
||||||
eeprom_settings_init();
|
eeprom_settings_init();
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,10 @@
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2)
|
||||||
|
#include "adc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (CONFIG_STORAGE & STORAGE_MMC) && (defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM))
|
#if (CONFIG_STORAGE & STORAGE_MMC) && (defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM))
|
||||||
int mmc_remove_request(void)
|
int mmc_remove_request(void)
|
||||||
{
|
{
|
||||||
|
|
@ -94,14 +98,17 @@ static void charging_display_info(bool animate)
|
||||||
static unsigned phase = 3;
|
static unsigned phase = 3;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
#ifdef NEED_ATA_POWER_BATT_MEASURE
|
#if !defined(NEED_ATA_POWER_BATT_MEASURE)
|
||||||
if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int battv = battery_voltage();
|
int battv = battery_voltage();
|
||||||
lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000,
|
lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000,
|
||||||
(battv % 1000) / 10, battery_level());
|
(battv % 1000) / 10, battery_level());
|
||||||
}
|
}
|
||||||
|
#elif defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2)
|
||||||
|
/* IDE power is normally off here, so display input current instead */
|
||||||
|
lcd_putsf(7, 7, "%dmA ",
|
||||||
|
(adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ARCHOS_RECORDER
|
#ifdef ARCHOS_RECORDER
|
||||||
lcd_puts(0, 2, "Charge mode:");
|
lcd_puts(0, 2, "Charge mode:");
|
||||||
|
|
@ -263,7 +270,8 @@ int charging_screen(void)
|
||||||
rc = 2;
|
rc = 2;
|
||||||
else if (usb_detect() == USB_INSERTED)
|
else if (usb_detect() == USB_INSERTED)
|
||||||
rc = 3;
|
rc = 3;
|
||||||
else if (!charger_inserted())
|
/* do not depend on power management thread here */
|
||||||
|
else if (!(power_input_status() & POWER_INPUT_MAIN_CHARGER))
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} while (!rc);
|
} while (!rc);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue