summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
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/powermgmt.c
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/powermgmt.c')
-rw-r--r--firmware/powermgmt.c33
1 files changed, 6 insertions, 27 deletions
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 */