From 457b8a0a6743b7bee72d90e484055b7635861612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Mon, 26 Aug 2002 13:21:14 +0000 Subject: Added configurable disk spindown. The disk will also now not spin down while you are running around in the dir browser or pressing buttons in the wps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1987 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 8 +++++++- apps/settings.h | 4 ++-- apps/settings_menu.c | 11 ++++++++++- apps/tree.c | 4 ++++ apps/wps.c | 3 +++ 5 files changed, 26 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/settings.c b/apps/settings.c index 11a4647..441abb5 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -268,7 +268,8 @@ int settings_save( void ) config_block[0x10] = (unsigned char)global_settings.ff_rewind; config_block[0x11] = (unsigned char)global_settings.avc; - + config_block[0x1a] = (unsigned char)global_settings.disk_spindown; + memcpy(&config_block[0x12], &global_settings.resume_index, 4); memcpy(&config_block[0x16], &global_settings.resume_offset, 4); memcpy(&config_block[0xF8], &global_settings.resume_seed, 4); @@ -369,6 +370,9 @@ void settings_load(void) if (config_block[0x16] != 0xFF) memcpy(&global_settings.resume_offset, &config_block[0x16], 4); + if (config_block[0x1a] != 0xFF) + global_settings.disk_spindown = config_block[0x1a]; + memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); if (config_block[0x24] != 0xFF) @@ -380,6 +384,7 @@ void settings_load(void) lcd_set_contrast(global_settings.contrast); lcd_scroll_speed(global_settings.scroll_speed); backlight_time(global_settings.backlight); + ata_spindown(global_settings.disk_spindown); #ifdef HAVE_CHARGE_CTRL charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI; #endif @@ -416,6 +421,7 @@ void settings_reset(void) { global_settings.ff_rewind = DEFAULT_FF_REWIND_SETTING; global_settings.resume_index = -1; global_settings.resume_offset = -1; + global_settings.disk_spindown = 5; } diff --git a/apps/settings.h b/apps/settings.h index 36cf493..91ffb3e 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -63,6 +63,8 @@ struct user_settings bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */ int scroll_speed; /* long texts scrolling speed: 1-20 */ bool playlist_shuffle; + int ff_rewind; /* FF/Rewind step size (in seconds) */ + int disk_spindown; /* time until disk spindown, in seconds (0=off) */ /* while playing screen settings */ int wps_display; /* 0=id3, 1=file, 2=parse */ @@ -77,8 +79,6 @@ struct user_settings /* geeky persistent statistics */ unsigned int total_uptime; /* total uptime since rockbox was first booted */ - /* FF/Rewind step size (in seconds) */ - int ff_rewind; }; /* prototypes */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index c3f3bcc..9f36d3b 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -35,6 +35,7 @@ #include "fat.h" /* For dotfile settings */ #include "powermgmt.h" #include "rtc.h" +#include "ata.h" static Menu show_hidden_files(void) { @@ -167,7 +168,14 @@ static Menu timedate_set(void) static Menu ff_rewind(void) { set_int("[FF/Rewind Step Size]", "s", &global_settings.ff_rewind, - NULL, 1, 1, 255 ); + NULL, 1, 1, 254 ); + return MENU_OK; +} + +static Menu spindown(void) +{ + set_int("[Disk spindown]", "s", &global_settings.disk_spindown, + ata_spindown, 1, 1, 254 ); return MENU_OK; } @@ -193,6 +201,7 @@ Menu settings_menu(void) { "Show hidden files", show_hidden_files }, { "FF/Rewind", ff_rewind }, { "Resume", resume }, + { "Disk spindown", spindown }, }; bool old_shuffle = global_settings.playlist_shuffle; diff --git a/apps/tree.c b/apps/tree.c index 9dae322..e47452f 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -39,6 +39,7 @@ #include "settings.h" #include "status.h" #include "debug.h" +#include "ata.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" @@ -718,6 +719,9 @@ bool dirbrowse(char *root) #endif } + if ( button ) + ata_spin(); + if ( restore ) { /* restore display */ /* We need to adjust if the number of lines on screen have diff --git a/apps/wps.c b/apps/wps.c index bdad325..571b356 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -1185,6 +1185,9 @@ int wps_show(void) break; } + if ( button ) + ata_spin(); + if(restore) { restore = false; draw_screen(id3); -- cgit v1.1