diff options
| author | Zakk Roberts <midk@rockbox.org> | 2006-04-15 13:07:21 +0000 |
|---|---|---|
| committer | Zakk Roberts <midk@rockbox.org> | 2006-04-15 13:07:21 +0000 |
| commit | 16a57e2e4fcb29f84d6ce44a011d341378270c1f (patch) | |
| tree | 4c1a4187802ddf8cf8d230bd30a8168e311544e3 | |
| parent | 97c3a6f10ac2babe2d6ff3a18823960fff0482e4 (diff) | |
| download | rockbox-16a57e2e4fcb29f84d6ce44a011d341378270c1f.zip rockbox-16a57e2e4fcb29f84d6ce44a011d341378270c1f.tar.gz rockbox-16a57e2e4fcb29f84d6ce44a011d341378270c1f.tar.bz2 rockbox-16a57e2e4fcb29f84d6ce44a011d341378270c1f.tar.xz | |
Also add a config-specific 'Default' value, this should fix the sim builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9680 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/settings.c | 8 | ||||
| -rw-r--r-- | firmware/export/config-fmrecorder.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-gigabeat.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-gmini120.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-gminisp.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-h100.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-h120.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-h300.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-iaudiox5.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipod3g.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipod4g.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipodcolor.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipodmini.h | 2 | ||||
| -rwxr-xr-x | firmware/export/config-ipodmini2g.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipodnano.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ipodvideo.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ondiofm.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-ondiosp.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-player.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-recorder.h | 2 | ||||
| -rw-r--r-- | firmware/export/config-recorderv2.h | 2 | ||||
| -rw-r--r-- | firmware/powermgmt.c | 38 |
22 files changed, 63 insertions, 23 deletions
diff --git a/apps/settings.c b/apps/settings.c index 1316969..2eeb6a9 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR; #include "dsp.h" #endif -#define CONFIG_BLOCK_VERSION 40 +#define CONFIG_BLOCK_VERSION 40 #define CONFIG_BLOCK_SIZE 512 #define RTC_BLOCK_SIZE 44 @@ -273,7 +273,7 @@ static const struct bit_entry rtc_bits[] = {14, S_O(max_files_in_dir), 400, "max files in dir", NULL }, /* 50...10000 */ /* battery */ - {12, S_O(battery_capacity), BATTERY_CAPACITY_MIN, "battery capacity", + {12, S_O(battery_capacity), BATTERY_CAPACITY_DEFAULT, "battery capacity", NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon, 500...1500 for Alkaline */ #ifdef HAVE_CHARGING @@ -1612,7 +1612,7 @@ bool settings_save_config(void) fdprintf(fd, "# .cfg file created by rockbox %s - " "http://www.rockbox.org\r\n#\r\n#\r\n# wps / rwps / language" " / font / fmpreset / backdrop \r\n#\r\n", appsversion); - + if (global_settings.wps_file[0] != 0) fdprintf(fd, "wps: %s/%s.wps\r\n", WPS_DIR, global_settings.wps_file); @@ -1721,7 +1721,7 @@ void settings_reset(void) { global_settings.superbass = sound_default(SOUND_SUPERBASS); #endif global_settings.contrast = lcd_default_contrast(); - + #ifdef CONFIG_TUNER global_settings.fmr_file[0] = '\0'; #endif diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 1259566..8711640 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -44,6 +44,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ +#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index ec36de4..83a92ce 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -42,6 +42,8 @@ /* Define this if you have the WM8975 audio codec */ #define HAVE_WM8751 +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5249 */ diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index e402d9e..42424bb 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -30,6 +30,8 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x80000 +#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a TCC730 (CalmRISC16) */ diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index aa0bf09..e066661 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -21,6 +21,8 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x80000 +#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a TCC730 (CalmRISC16) */ diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 62d262c..942f18a 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -58,6 +58,8 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x80000 +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #define AB_REPEAT_ENABLE 1 #define CONFIG_TUNER TEA5767 diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index a577a36..186203c 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -64,6 +64,8 @@ /* define this if you have recording possibility */ #define HAVE_RECORDING 1 +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5249 */ diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 947a42e..ae1940c 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -64,6 +64,8 @@ /* define this if you have recording possibility */ #define HAVE_RECORDING 1 +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5249 */ diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 2a16baf..4690feb 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -53,6 +53,8 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x80000 +#define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5250 */ diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 62950b8..a611dfd 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -50,6 +50,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */ +#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a PortalPlayer PP5002 */ diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 68b5d5f..fa664ac 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -52,6 +52,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ +#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a PortalPlayer PP5020 */ diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 7da7f0f..b8f3d89 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -51,6 +51,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ +#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a PortalPlayer PP5020 */ diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 047c992..64be801 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -52,6 +52,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ +#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a PortalPlayer PP5020 */ diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index cd3daa9..454309a 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -55,6 +55,8 @@ /* We can fade the backlight by using PWM */ #define HAVE_BACKLIGHT_PWM_FADING +#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a PortalPlayer PP5020 */ diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 026355a..b7116bf 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -54,6 +54,8 @@ /* We can fade the backlight by using PWM */ #define HAVE_BACKLIGHT_PWM_FADING +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #ifndef SIMULATOR /* The Nano actually has a PP5021 - but it's register compatible with diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 54b3226..1bbcfec 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -54,6 +54,8 @@ /* We can fade the backlight by using PWM */ #define HAVE_BACKLIGHT_PWM_FADING +#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ + #ifndef SIMULATOR /* The Nano actually has a PP5021 - but it's register compatible with diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index acaba63..cb2033a 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -28,6 +28,8 @@ /* Define this if you have a MAS3587F */ #define CONFIG_CODEC MAS3587F +#define BATTERY_CAPACITY_DEFAULT 500 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 567bc0a..3612300 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -21,6 +21,8 @@ /* Define this if you have a MAS3539F */ #define CONFIG_CODEC MAS3539F +#define BATTERY_CAPACITY_DEFAULT 500 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index d587a8a..324a0a2 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -23,6 +23,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ +#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index e4865d7..92dd076 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -38,6 +38,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ +#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index eed46f2..b508836 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -41,6 +41,8 @@ /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ +#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index fb2d886..4c6db6d 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -185,7 +185,7 @@ static const short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = #else /* NiMH */ /* original values were taken directly after charging, but it should show 100% after turning off the device for some hours, too */ - { 450, 481, 491, 497, 503, 507, 512, 514, 517, 525, 540 } + { 450, 481, 491, 497, 503, 507, 512, 514, 517, 525, 540 } /* orig. values: ...,528,560 */ #endif }; @@ -197,7 +197,7 @@ charger_input_state_type charger_input_state IDATA_ATTR; static const short percent_to_volt_charge[11] = { #if CONFIG_BATTERY == BATT_LIPOL1300 - /* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when + /* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when entering in trickle-charging). We will never reach 100%. */ 340, 390, 394, 399, 400, 404, 407, 413, 417, 422, 426 #else @@ -243,11 +243,11 @@ int pid_i = 0; /* PID integral term */ */ static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */ static unsigned int avgbat; /* average battery voltage (filtering) */ -#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ +#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ /* battery level (0-100%) of this minute, updated once per minute */ static int battery_percent = -1; -static int battery_capacity = BATTERY_CAPACITY_MIN; /* default value, mAH */ +static int battery_capacity = BATTERY_CAPACITY_DEFAULT; /* default value, mAh */ static int battery_type = 0; /* Power history: power_history[0] is the newest sample */ @@ -348,7 +348,7 @@ static int voltage_to_percent(int voltage, const short* table) else if (voltage >= table[10]) return 100; - else { + else { /* search nearest value */ int i = 0; while ((i < 10) && (table[i+1] < voltage)) @@ -405,7 +405,7 @@ static void battery_status_update(void) else #endif { - powermgmt_est_runningtime_min = level * battery_capacity / 100 + powermgmt_est_runningtime_min = level * battery_capacity / 100 * 60 / runcurrent(); } } @@ -515,7 +515,7 @@ static int runcurrent(void) /* Check to see whether or not we've received an alarm in the last second */ #ifdef HAVE_ALARM_MOD -static void power_thread_rtc_process(void) +static void power_thread_rtc_process(void) { if (rtc_check_alarm_flag()) { rtc_enable_alarm(false); @@ -592,7 +592,7 @@ static void power_thread_sleep(int ticks) } break; } - + #endif /* HAVE_CHARGE_STATE */ small_ticks = MIN(HZ/2, ticks); @@ -674,7 +674,7 @@ static void power_thread(void) /* initialize the voltages for the exponential filter */ - avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR * + avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR * BATT_AVE_SAMPLES; battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; @@ -682,7 +682,7 @@ static void power_thread(void) fd = -1; wrcount = 0; #endif - + while (1) { /* rotate the power history */ @@ -690,7 +690,7 @@ static void power_thread(void) phps = phpd - 1; for (i = 0; i < POWER_HISTORY_LEN-1; i++) *phpd-- = *phps--; - + /* insert new value at the start, in centivolts 8-) */ power_history[0] = battery_centivolts; @@ -732,7 +732,7 @@ static void power_thread(void) } else { charge_state = TOPOFF; target_voltage = TOPOFF_VOLTAGE; - } + } } else { /* * Start the charger full strength @@ -743,8 +743,8 @@ static void power_thread(void) if (charge_max_time_idle > i) { charge_max_time_idle = i; } - charge_max_time_now = charge_max_time_idle; - + charge_max_time_now = charge_max_time_idle; + snprintf(power_message, POWER_MESSAGE_LEN, "ChgAt %d%% max %dm", battery_level(), charge_max_time_now); @@ -895,7 +895,7 @@ static void power_thread(void) * plugged in, but it doesn't appear to be necessary and will * generate more heat [gvb]. */ - + pid_p = target_voltage - battery_centivolts; if((pid_p > PID_DEADZONE) || (pid_p < -PID_DEADZONE)) pid_p = pid_p * PID_PCONST; @@ -980,7 +980,7 @@ static void power_thread(void) } } if(fd >= 0) { - snprintf(debug_message, DEBUG_MESSAGE_LEN, + snprintf(debug_message, DEBUG_MESSAGE_LEN, "%d, %d, %d, %d, %d, %d, %d, %d\n", powermgmt_last_cycle_startstop_min, battery_centivolts, battery_percent, charger_input_state, charge_state, @@ -1002,7 +1002,7 @@ void powermgmt_init(void) { /* init history to 0 */ memset(power_history, 0x00, sizeof(power_history)); - + create_thread(power_thread, power_stack, sizeof(power_stack), power_thread_name); } @@ -1015,12 +1015,12 @@ void sys_poweroff(void) /* If the main thread fails to shut down the system, we will force a power off after an 8 second timeout */ shutdown_timeout = HZ*8; - + queue_post(&button_queue, SYS_POWEROFF, NULL); } /* Various hardware housekeeping tasks relating to shutting down the jukebox */ -void shutdown_hw(void) +void shutdown_hw(void) { #ifndef SIMULATOR #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) |