summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-12-06 11:20:43 +0000
committerDan Everton <dan@iocaine.org>2006-12-06 11:20:43 +0000
commit761122dcff4158b68a0d3f977cff554c4e8365e3 (patch)
tree87056cad9bfd36f8589c723f8f643468f1da142d /firmware/powermgmt.c
parentedbd1cde47bb85f718970679c8b12a3fb98afac2 (diff)
downloadrockbox-761122dcff4158b68a0d3f977cff554c4e8365e3.tar.gz
rockbox-761122dcff4158b68a0d3f977cff554c4e8365e3.zip
Fix for FS#6328. Simulator battery level now goes down in roughly 1% increments roughly every second.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11673 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index dcf8fd14ab..ed0e69ef96 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -90,7 +90,6 @@ static int shutdown_timeout = 0;
90 90
91#ifdef SIMULATOR /***********************************************************/ 91#ifdef SIMULATOR /***********************************************************/
92 92
93#define TIME2CHANGE 10 /* change levels every 10 seconds */
94#define BATT_MINCVOLT 250 /* minimum centivolts of battery */ 93#define BATT_MINCVOLT 250 /* minimum centivolts of battery */
95#define BATT_MAXCVOLT 450 /* maximum centivolts of battery */ 94#define BATT_MAXCVOLT 450 /* maximum centivolts of battery */
96#define BATT_MAXRUNTIME (10 * 60) /* maximum runtime with full battery in minutes */ 95#define BATT_MAXRUNTIME (10 * 60) /* maximum runtime with full battery in minutes */
@@ -105,11 +104,11 @@ static void battery_status_update(void)
105 time_t now; 104 time_t now;
106 105
107 time(&now); 106 time(&now);
108 if (last_change < (now - TIME2CHANGE)) { 107 if (last_change < now) {
109 last_change = now; 108 last_change = now;
110 109
111 /* change the values: */ 110 /* change the values: */
112 batt_centivolts -= (unsigned int)(BATT_MAXCVOLT - BATT_MINCVOLT) / 11; 111 batt_centivolts -= (unsigned int)(BATT_MAXCVOLT - BATT_MINCVOLT) / 101;
113 if (batt_centivolts < (unsigned int)BATT_MINCVOLT) 112 if (batt_centivolts < (unsigned int)BATT_MINCVOLT)
114 batt_centivolts = (unsigned int)BATT_MAXCVOLT; 113 batt_centivolts = (unsigned int)BATT_MAXCVOLT;
115 114