summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 08:32:55 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-03-03 08:32:55 +0000
commitd061b371d6f53e0c2f310f4eb5776430772a8ac5 (patch)
tree611417c1cf40f66fe4d7c48e976ab3a26fbb1a22 /firmware
parentac79a0c42b19c4c3139afee467672d6e6c5b1c06 (diff)
downloadrockbox-d061b371d6f53e0c2f310f4eb5776430772a8ac5.tar.gz
rockbox-d061b371d6f53e0c2f310f4eb5776430772a8ac5.zip
removed the practically useless "trickle charge" and "deep discharge" options, now trickle is always on and deep always off
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6107 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/powermgmt.h6
-rw-r--r--firmware/powermgmt.c33
2 files changed, 7 insertions, 32 deletions
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 59f9465d49..3bccb0f59f 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -61,9 +61,8 @@
61#define CHARGE_MAX_TIME_1500 450 /* minutes: maximum charging time for 1500 mAh batteries */ 61#define CHARGE_MAX_TIME_1500 450 /* minutes: maximum charging time for 1500 mAh batteries */
62 /* actual max time depends also on BATTERY_CAPACITY! */ 62 /* actual max time depends also on BATTERY_CAPACITY! */
63#define CHARGE_MIN_TIME 10 /* minutes: minimum charging time */ 63#define CHARGE_MIN_TIME 10 /* minutes: minimum charging time */
64#define CHARGE_RESTART_HI 85 /* %: when to restart charging in 'charge' mode */ 64#define CHARGE_RESTART 85 /* %: when to restart charging in 'charge' mode */
65 /* 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 */
66#define CHARGE_RESTART_LO 10 /* %: when to restart charging in 'discharge' mode */
67#define TOPOFF_MAX_TIME 90 /* After charging, go to top off charge. How long should top off charge be? */ 66#define TOPOFF_MAX_TIME 90 /* After charging, go to top off charge. How long should top off charge be? */
68#define TOPOFF_VOLTAGE 565 /* which voltage is best? (centivolts) */ 67#define TOPOFF_VOLTAGE 565 /* which voltage is best? (centivolts) */
69#define TRICKLE_MAX_TIME 12*60 /* After top off charge, go to trickle charge. How long should trickle charge be? */ 68#define TRICKLE_MAX_TIME 12*60 /* After top off charge, go to trickle charge. How long should trickle charge be? */
@@ -80,9 +79,6 @@ extern int short_delta; /* short term delta battery voltage */
80extern int powermgmt_last_cycle_startstop_min; /* how many minutes ago was the charging started or stopped? */ 79extern int powermgmt_last_cycle_startstop_min; /* how many minutes ago was the charging started or stopped? */
81extern int powermgmt_last_cycle_level; /* which level had the batteries at this time? */ 80extern int powermgmt_last_cycle_level; /* which level had the batteries at this time? */
82 81
83void enable_deep_discharge(bool on); /* deep discharge the battery */
84
85void enable_trickle_charge(bool on);
86extern int trickle_sec; /* trickle charge: How many seconds per minute are we charging actually? */ 82extern int trickle_sec; /* trickle charge: How many seconds per minute are we charging actually? */
87 83
88#endif /* HAVE_CHARGE_CTRL */ 84#endif /* HAVE_CHARGE_CTRL */
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 0db2f03a7b..f1bcc541b1 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -145,7 +145,6 @@ int short_delta; /* short term delta battery voltage */
145 145
146char power_message[POWER_MESSAGE_LEN] = ""; /* message that's shown in 146char power_message[POWER_MESSAGE_LEN] = ""; /* message that's shown in
147 debug menu */ 147 debug menu */
148static char charge_restart_level = CHARGE_RESTART_HI;
149 /* percentage at which charging 148 /* percentage at which charging
150 starts */ 149 starts */
151int powermgmt_last_cycle_startstop_min = 0; /* how many minutes ago was the 150int powermgmt_last_cycle_startstop_min = 0; /* how many minutes ago was the
@@ -153,7 +152,6 @@ int powermgmt_last_cycle_startstop_min = 0; /* how many minutes ago was the
153 stopped? */ 152 stopped? */
154int powermgmt_last_cycle_level = 0; /* which level had the 153int powermgmt_last_cycle_level = 0; /* which level had the
155 batteries at this time? */ 154 batteries at this time? */
156bool trickle_charge_enabled = true;
157int trickle_sec = 0; /* how many seconds should the 155int trickle_sec = 0; /* how many seconds should the
158 charger be enabled per 156 charger be enabled per
159 minute for trickle 157 minute for trickle
@@ -194,19 +192,6 @@ int powermgmt_est_runningtime_min = -1;
194static bool sleeptimer_active = false; 192static bool sleeptimer_active = false;
195static unsigned long sleeptimer_endtick; 193static unsigned long sleeptimer_endtick;
196 194
197#ifdef HAVE_CHARGE_CTRL
198
199void enable_deep_discharge(bool on)
200{
201 charge_restart_level = on ? CHARGE_RESTART_LO : CHARGE_RESTART_HI;
202}
203
204void enable_trickle_charge(bool on)
205{
206 trickle_charge_enabled = on;
207}
208#endif /* HAVE_CHARGE_CTRL */
209
210#if BATTERY_TYPES_COUNT > 1 195#if BATTERY_TYPES_COUNT > 1
211void set_battery_type(int type) 196void set_battery_type(int type)
212{ 197{
@@ -522,7 +507,6 @@ static void power_thread_sleep(int ticks)
522{ 507{
523 int small_ticks; 508 int small_ticks;
524#ifdef HAVE_CHARGING 509#ifdef HAVE_CHARGING
525 unsigned int tmp;
526 bool charger_plugged; 510 bool charger_plugged;
527#endif 511#endif
528 512
@@ -659,14 +643,14 @@ static void power_thread(void)
659 * the charger must have just been plugged in. 643 * the charger must have just been plugged in.
660 * 2) If our battery level falls below the restart level, charge! 644 * 2) If our battery level falls below the restart level, charge!
661 */ 645 */
662 if (((charge_state == DISCHARGING) && trickle_charge_enabled) || 646 if ((charge_state == DISCHARGING) ||
663 (battery_level() < charge_restart_level)) { 647 (battery_level() < CHARGE_RESTART)) {
664 648
665 /* 649 /*
666 * If the battery level is nearly charged, just trickle. 650 * If the battery level is nearly charged, just trickle.
667 * If the battery is in between, top-off and then trickle. 651 * If the battery is in between, top-off and then trickle.
668 */ 652 */
669 if(battery_percent > charge_restart_level) { 653 if(battery_percent > CHARGE_RESTART) {
670 powermgmt_last_cycle_level = battery_percent; 654 powermgmt_last_cycle_level = battery_percent;
671 powermgmt_last_cycle_startstop_min = 0; 655 powermgmt_last_cycle_startstop_min = 0;
672 if(battery_percent >= 95) { 656 if(battery_percent >= 95) {
@@ -772,14 +756,9 @@ static void power_thread(void)
772 charge time. For trickle charging, we use 0.05C */ 756 charge time. For trickle charging, we use 0.05C */
773 powermgmt_last_cycle_level = battery_percent; 757 powermgmt_last_cycle_level = battery_percent;
774 powermgmt_last_cycle_startstop_min = 0; 758 powermgmt_last_cycle_startstop_min = 0;
775 if (trickle_charge_enabled) { 759
776 trickle_sec = START_TRICKLE_SEC; 760 trickle_sec = START_TRICKLE_SEC;
777 charge_state = TRICKLE; 761 charge_state = TRICKLE;
778 } else {
779 /* If we don't trickle charge, we discharge */
780 trickle_sec = 0; /* off */
781 charge_state = DISCHARGING;
782 }
783 } 762 }
784 } 763 }
785 else if (charge_state > CHARGING) /* top off or trickle */ 764 else if (charge_state > CHARGING) /* top off or trickle */