summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 07:25:43 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 07:25:43 +0000
commit2584896920724cd5e72caaf9b64c3ef81b45ee9f (patch)
tree672817ced4c15a673fb557e87b0091cf90e43339 /firmware/export
parent384de102469fee4e0792df8fe38586d3206774ed (diff)
downloadrockbox-2584896920724cd5e72caaf9b64c3ef81b45ee9f.tar.gz
rockbox-2584896920724cd5e72caaf9b64c3ef81b45ee9f.zip
More aggressive Recorder V1 charging (patch #1116884 from Jerry Van Baren)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/adc.h2
-rw-r--r--firmware/export/powermgmt.h39
2 files changed, 29 insertions, 12 deletions
diff --git a/firmware/export/adc.h b/firmware/export/adc.h
index a18cb1995a..40bc3e108a 100644
--- a/firmware/export/adc.h
+++ b/firmware/export/adc.h
@@ -63,7 +63,7 @@
63#define ADC_BUTTON_ROW2 5 /* Used for scanning the keys, different 63#define ADC_BUTTON_ROW2 5 /* Used for scanning the keys, different
64 voltages for different keys */ 64 voltages for different keys */
65#define ADC_UNREG_POWER 6 /* Battery voltage with a better scaling */ 65#define ADC_UNREG_POWER 6 /* Battery voltage with a better scaling */
66#define ADC_EXT_POWER 7 /* The external power voltage, V=X*0.0148 */ 66#define ADC_EXT_POWER 7 /* The external power voltage, 0v or 2.7v */
67 67
68#endif 68#endif
69 69
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 922630097a..59f9465d49 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -48,13 +48,12 @@
48#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY) 48#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
49 49
50#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */ 50#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
51#define POWER_AVG_N 4 /* how many samples to take for each measurement */
52#define POWER_AVG_SLEEP 9 /* how long do we sleep between each measurement */
53 51
54#define CHARGE_END_NEGD 6 /* stop when N minutes have passed with 52#define CHARGE_END_NEGD 6 /* stop when N minutes have passed with
55 * avg delta being < -0.05 V */ 53 * avg delta being < -0.05 V */
56#define CHARGE_END_ZEROD 50 /* stop when N minutes have passed with 54#define CHARGE_END_ZEROD 50 /* stop when N minutes have passed with
57 * avg delta being < 0.005 V */ 55 * avg delta being < 0.005 V */
56
58#ifndef SIMULATOR 57#ifndef SIMULATOR
59 58
60#ifdef HAVE_CHARGE_CTRL 59#ifdef HAVE_CHARGE_CTRL
@@ -65,27 +64,40 @@
65#define CHARGE_RESTART_HI 85 /* %: when to restart charging in 'charge' mode */ 64#define CHARGE_RESTART_HI 85 /* %: when to restart charging in 'charge' mode */
66 /* attention: if set too high, normal charging is started in trickle mode */ 65 /* attention: if set too high, normal charging is started in trickle mode */
67#define CHARGE_RESTART_LO 10 /* %: when to restart charging in 'discharge' mode */ 66#define CHARGE_RESTART_LO 10 /* %: when to restart charging in 'discharge' mode */
68#define CHARGE_PAUSE_LEN 60 /* how many minutes to pause between charging cycles */
69#define TOPOFF_MAX_TIME 90 /* After charging, go to top off charge. How long should top off charge be? */ 67#define TOPOFF_MAX_TIME 90 /* After charging, go to top off charge. How long should top off charge be? */
70#define TOPOFF_VOLTAGE 565 /* which voltage is best? (centivolts) */ 68#define TOPOFF_VOLTAGE 565 /* which voltage is best? (centivolts) */
71#define TRICKLE_MAX_TIME 12*60 /* After top off charge, go to trickle charge. How long should trickle charge be? */ 69#define TRICKLE_MAX_TIME 12*60 /* After top off charge, go to trickle charge. How long should trickle charge be? */
72#define TRICKLE_VOLTAGE 545 /* which voltage is best? (centivolts) */ 70#define TRICKLE_VOLTAGE 545 /* which voltage is best? (centivolts) */
73 71
72#define START_TOPOFF_SEC 25 /* initial trickle_sec for topoff */
73#define START_TRICKLE_SEC 15 /* initial trickle_sec for trickle */
74
74extern char power_message[POWER_MESSAGE_LEN]; 75extern char power_message[POWER_MESSAGE_LEN];
75extern char charge_restart_level; 76
77extern int long_delta; /* long term delta battery voltage */
78extern int short_delta; /* short term delta battery voltage */
76 79
77extern int powermgmt_last_cycle_startstop_min; /* how many minutes ago was the charging started or stopped? */ 80extern int powermgmt_last_cycle_startstop_min; /* how many minutes ago was the charging started or stopped? */
78extern int powermgmt_last_cycle_level; /* which level had the batteries at this time? */ 81extern int powermgmt_last_cycle_level; /* which level had the batteries at this time? */
79 82
80extern int battery_lazyness[20]; /* how does the battery react when plugging in/out the charger */ 83void enable_deep_discharge(bool on); /* deep discharge the battery */
84
81void enable_trickle_charge(bool on); 85void enable_trickle_charge(bool on);
82extern int trickle_sec; /* trickle charge: How many seconds per minute are we charging actually? */ 86extern int trickle_sec; /* trickle charge: How many seconds per minute are we charging actually? */
83 87
84#endif /* HAVE_CHARGE_CTRL */ 88#endif /* HAVE_CHARGE_CTRL */
85 89
86#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 90#if defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200)
87extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */ 91typedef enum {
88#endif 92 DISCHARGING,
93 CHARGING,
94 TOPOFF,
95 TRICKLE
96} charge_state_type;
97
98/* tells what the charger is doing */
99extern charge_state_type charge_state;
100#endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */
89 101
90#ifdef HAVE_MMC /* Values for Ondio */ 102#ifdef HAVE_MMC /* Values for Ondio */
91#define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ 103#define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */
@@ -95,9 +107,14 @@ extern int charge_state; /* tells what the charger is doing (for info di
95#define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ 107#define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */
96#define CURRENT_USB 500 /* usual current in mA in USB mode */ 108#define CURRENT_USB 500 /* usual current in mA in USB mode */
97#define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ 109#define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */
98#define CURRENT_CHARGING 300 /* charging current */
99#endif
100 110
111#define CURRENT_MIN_CHG 70 /* minimum charge current */
112#define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */
113#define CURRENT_MAX_CHG 350 /* maximum charging current */
114#define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */
115#endif /* HAVE_MMC */
116
117extern unsigned int bat; /* filtered battery voltage, centivolts */
101extern unsigned short power_history[POWER_HISTORY_LEN]; 118extern unsigned short power_history[POWER_HISTORY_LEN];
102 119
103/* Start up power management thread */ 120/* Start up power management thread */
@@ -114,7 +131,7 @@ bool battery_level_safe(void);
114 131
115void set_poweroff_timeout(int timeout); 132void set_poweroff_timeout(int timeout);
116void set_battery_capacity(int capacity); /* set local battery capacity value */ 133void set_battery_capacity(int capacity); /* set local battery capacity value */
117void set_battery_type(int type); /* set local battery type */ 134void set_battery_type(int type); /* set local battery type */
118 135
119void set_sleep_timer(int seconds); 136void set_sleep_timer(int seconds);
120int get_sleep_timer(void); 137int get_sleep_timer(void);