2002-06-27 00:20:00 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by wavey@wavey.org
|
2002-07-15 11:02:12 +00:00
|
|
|
* RTC config saving code (C) 2002 by hessu@hes.iki.fi
|
2002-06-27 00:20:00 +00:00
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include <stdio.h>
|
2004-06-18 20:41:59 +00:00
|
|
|
#include <stddef.h>
|
2005-02-15 15:30:19 +00:00
|
|
|
#include <limits.h>
|
2006-03-03 01:12:50 +00:00
|
|
|
#include "inttypes.h"
|
2002-06-27 00:20:00 +00:00
|
|
|
#include "config.h"
|
2002-07-28 16:09:44 +00:00
|
|
|
#include "kernel.h"
|
2003-02-14 09:44:34 +00:00
|
|
|
#include "thread.h"
|
2002-06-27 00:20:00 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "disk.h"
|
|
|
|
#include "panic.h"
|
|
|
|
#include "debug.h"
|
2002-06-27 01:08:11 +00:00
|
|
|
#include "button.h"
|
2002-08-31 04:58:35 +00:00
|
|
|
#include "usb.h"
|
|
|
|
#include "backlight.h"
|
2002-06-27 01:08:11 +00:00
|
|
|
#include "lcd.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
#include "mp3_playback.h"
|
2005-09-11 12:07:13 +00:00
|
|
|
#include "mpeg.h"
|
2004-03-15 08:27:51 +00:00
|
|
|
#include "talk.h"
|
2002-07-15 11:02:12 +00:00
|
|
|
#include "string.h"
|
2002-07-28 16:09:44 +00:00
|
|
|
#include "ata.h"
|
2002-08-13 17:16:09 +00:00
|
|
|
#include "fat.h"
|
2002-07-28 16:09:44 +00:00
|
|
|
#include "power.h"
|
2002-07-30 07:56:16 +00:00
|
|
|
#include "backlight.h"
|
2002-08-06 10:52:51 +00:00
|
|
|
#include "powermgmt.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
#include "status.h"
|
2002-09-05 16:30:07 +00:00
|
|
|
#include "atoi.h"
|
2002-09-24 17:22:12 +00:00
|
|
|
#include "screens.h"
|
2002-10-02 16:33:26 +00:00
|
|
|
#include "ctype.h"
|
|
|
|
#include "file.h"
|
2002-10-29 12:16:36 +00:00
|
|
|
#include "errno.h"
|
|
|
|
#include "system.h"
|
2003-05-04 02:04:31 +00:00
|
|
|
#include "misc.h"
|
2004-04-20 10:23:57 +00:00
|
|
|
#include "timefuncs.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "icons.h"
|
2002-09-12 13:33:59 +00:00
|
|
|
#include "font.h"
|
2002-10-29 12:09:15 +00:00
|
|
|
#include "peakmeter.h"
|
2003-06-25 23:24:47 +00:00
|
|
|
#include "hwcompat.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
#endif
|
2002-09-18 14:08:05 +00:00
|
|
|
#include "lang.h"
|
2002-10-08 15:42:40 +00:00
|
|
|
#include "language.h"
|
2005-11-17 20:14:59 +00:00
|
|
|
#include "gwps.h"
|
2002-12-02 16:07:56 +00:00
|
|
|
#include "powermgmt.h"
|
2004-01-14 00:13:04 +00:00
|
|
|
#include "bookmark.h"
|
2003-02-15 00:03:23 +00:00
|
|
|
#include "sprintf.h"
|
2003-03-10 16:31:02 +00:00
|
|
|
#include "keyboard.h"
|
2003-04-25 10:33:38 +00:00
|
|
|
#include "version.h"
|
2004-06-18 20:41:59 +00:00
|
|
|
#include "rtc.h"
|
2005-04-01 13:41:03 +00:00
|
|
|
#include "sound.h"
|
2005-12-06 13:27:15 +00:00
|
|
|
#include "rbunicode.h"
|
2005-10-07 17:38:05 +00:00
|
|
|
#include "dircache.h"
|
2005-11-04 07:18:36 +00:00
|
|
|
#include "select.h"
|
|
|
|
#include "statusbar.h"
|
2005-11-04 17:25:29 +00:00
|
|
|
#include "splash.h"
|
2006-01-22 01:42:05 +00:00
|
|
|
#include "list.h"
|
2006-02-02 21:46:23 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-02-02 20:42:56 +00:00
|
|
|
#include "backdrop.h"
|
2006-02-02 21:39:09 +00:00
|
|
|
#endif
|
2005-10-07 17:38:05 +00:00
|
|
|
|
2006-04-02 12:23:08 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == MAS3507D
|
2003-11-04 00:18:19 +00:00
|
|
|
void dac_line_in(bool enable);
|
2003-11-03 23:36:36 +00:00
|
|
|
#endif
|
2002-06-27 00:20:00 +00:00
|
|
|
struct user_settings global_settings;
|
2005-05-08 13:41:24 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2004-08-01 21:50:57 +00:00
|
|
|
const char rec_base_directory[] = REC_BASE_DIR;
|
2005-05-08 13:41:24 +00:00
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-13 12:48:22 +00:00
|
|
|
#include "pcmbuf.h"
|
2005-06-09 09:47:00 +00:00
|
|
|
#include "pcm_playback.h"
|
2005-09-24 15:22:48 +00:00
|
|
|
#include "dsp.h"
|
2005-06-09 09:47:00 +00:00
|
|
|
#endif
|
2004-09-19 21:58:37 +00:00
|
|
|
|
2006-07-28 12:45:58 +00:00
|
|
|
#define CONFIG_BLOCK_VERSION 50
|
2002-08-16 14:41:47 +00:00
|
|
|
#define CONFIG_BLOCK_SIZE 512
|
|
|
|
#define RTC_BLOCK_SIZE 44
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2002-09-27 09:31:31 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#define MAX_LINES 10
|
|
|
|
#else
|
|
|
|
#define MAX_LINES 2
|
|
|
|
#endif
|
|
|
|
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#include "lcd-remote.h"
|
|
|
|
#endif
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
long lasttime = 0;
|
2005-02-11 18:41:40 +00:00
|
|
|
static long config_sector = 0; /* mark uninitialized */
|
2004-06-18 20:41:59 +00:00
|
|
|
static unsigned char config_block[CONFIG_BLOCK_SIZE];
|
|
|
|
|
|
|
|
|
|
|
|
/* descriptor for a configuration value */
|
|
|
|
/* (watch the struct packing and member sizes to keep this small) */
|
|
|
|
struct bit_entry
|
|
|
|
{
|
|
|
|
/* how many bits within the bitfield (1-32), MSB set if value is signed */
|
|
|
|
unsigned char bit_size; /* min 6+1 bit */
|
|
|
|
/* how many bytes in the global_settings struct (1,2,4) */
|
2004-06-19 09:39:25 +00:00
|
|
|
unsigned char byte_size; /* min 3 bits */
|
2004-06-18 20:41:59 +00:00
|
|
|
/* store position in global_settings struct */
|
|
|
|
short settings_offset; /* min 9 bit, better 10 */
|
|
|
|
/* default value */
|
2005-11-04 07:18:36 +00:00
|
|
|
int default_val; /* min 15 bit */
|
2004-06-19 09:39:25 +00:00
|
|
|
/* variable name in a .cfg file, NULL if not to be saved */
|
2004-06-18 20:41:59 +00:00
|
|
|
const char* cfg_name;
|
2006-02-26 02:48:05 +00:00
|
|
|
/* set of values, "rgb" for a color, or NULL for a numerical value */
|
2004-06-18 20:41:59 +00:00
|
|
|
const char* cfg_val;
|
|
|
|
};
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
/********************************************
|
|
|
|
|
|
|
|
Config block as saved on the battery-packed RTC user RAM memory block
|
|
|
|
of 44 bytes, starting at offset 0x14 of the RTC memory space.
|
|
|
|
|
|
|
|
offset abs
|
|
|
|
0x00 0x14 "Roc" header signature: 0x52 0x6f 0x63
|
|
|
|
0x03 0x17 <version byte: 0x0>
|
2004-06-18 20:41:59 +00:00
|
|
|
0x04 0x18 start of bit-table
|
|
|
|
...
|
|
|
|
0x28,0x29 unused, not reachable by set_bits() without disturbing the next 2
|
|
|
|
0x2A,0x2B <checksum 2 bytes: xor of 0x00-0x29>
|
2002-07-15 11:02:12 +00:00
|
|
|
|
|
|
|
Config memory is reset to 0xff and initialized with 'factory defaults' if
|
|
|
|
a valid header & checksum is not found. Config version number is only
|
|
|
|
increased when information is _relocated_ or space is _reused_ so that old
|
2005-11-04 07:18:36 +00:00
|
|
|
versions can read and modify configuration changed by new versions.
|
2004-06-18 20:41:59 +00:00
|
|
|
Memory locations not used by a given version should not be
|
2002-07-15 11:02:12 +00:00
|
|
|
modified unless the header & checksum test fails.
|
|
|
|
|
2002-08-16 14:41:47 +00:00
|
|
|
Rest of config block, only saved to disk:
|
2004-06-18 20:41:59 +00:00
|
|
|
0x2C start of 2nd bit-table
|
|
|
|
...
|
2006-04-02 12:23:08 +00:00
|
|
|
0xA4 (char[20]) FMR Preset file
|
2002-10-08 15:42:40 +00:00
|
|
|
0xB8 (char[20]) WPS file
|
|
|
|
0xCC (char[20]) Lang file
|
|
|
|
0xE0 (char[20]) Font file
|
2006-02-02 20:42:56 +00:00
|
|
|
... (char[20]) RWPS file (on targets supporting a Remote WPS)
|
|
|
|
... (char[20]) Main backdrop file (on color LCD targets)
|
|
|
|
|
|
|
|
... to 0x200 <unused>
|
2002-08-16 14:41:47 +00:00
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
*************************************/
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* The persistence of the global_settings members is now controlled by
|
2005-11-04 07:18:36 +00:00
|
|
|
the two tables below, rtc_bits and hd_bits.
|
|
|
|
New values can just be added to the end, it will be backwards
|
2004-06-18 20:41:59 +00:00
|
|
|
compatible. If you however change order, bitsize, etc. of existing
|
|
|
|
entries, you need to bump CONFIG_BLOCK_VERSION to break compatibility.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* convenience macro for both size and offset of global_settings member */
|
|
|
|
#define S_O(val) sizeof(global_settings.val), offsetof(struct user_settings, val)
|
|
|
|
#define SIGNED 0x80 /* for bitsize value with signed attribute */
|
|
|
|
|
|
|
|
/* some sets of values which are used more than once, to save memory */
|
|
|
|
static const char off_on[] = "off,on";
|
|
|
|
static const char off_on_ask[] = "off,on,ask";
|
2004-10-06 21:37:46 +00:00
|
|
|
static const char off_number_spell_hover[] = "off,number,spell,hover";
|
2005-05-08 13:41:24 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
static const char graphic_numeric[] = "graphic,numeric";
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2005-04-04 09:12:12 +00:00
|
|
|
/* keep synchronous to trig_durations and
|
|
|
|
trigger_times in settings_apply_trigger */
|
|
|
|
static const char trig_durations_conf [] =
|
|
|
|
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min";
|
2005-04-04 20:16:01 +00:00
|
|
|
#endif
|
2005-04-04 09:12:12 +00:00
|
|
|
|
2005-11-23 20:12:33 +00:00
|
|
|
#if defined(CONFIG_BACKLIGHT)
|
|
|
|
static const char backlight_times_conf [] =
|
|
|
|
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
|
|
|
|
#endif
|
|
|
|
|
2005-11-04 07:18:36 +00:00
|
|
|
/* the part of the settings which ends up in the RTC RAM, where available
|
2004-06-18 20:41:59 +00:00
|
|
|
(those we either need early, save frequently, or without spinup) */
|
2004-07-20 19:13:46 +00:00
|
|
|
static const struct bit_entry rtc_bits[] =
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
|
|
|
/* placeholder, containing the size information */
|
|
|
|
{9, 0, 0, 0, NULL, NULL }, /* 9 bit to tell how far this is populated */
|
|
|
|
|
|
|
|
/* # of bits, offset+size, default, .cfg name, .cfg values */
|
|
|
|
/* sound */
|
2005-12-07 23:07:07 +00:00
|
|
|
#if CONFIG_CODEC == MAS3507D
|
|
|
|
{8 | SIGNED, S_O(volume), -18, "volume", NULL }, /* -78...+18 */
|
2006-03-30 05:56:19 +00:00
|
|
|
#else
|
2005-12-07 23:07:07 +00:00
|
|
|
{8 | SIGNED, S_O(volume), -25, "volume", NULL }, /* -100...+12 / -84...0 */
|
|
|
|
#endif
|
2004-06-21 13:42:37 +00:00
|
|
|
{8 | SIGNED, S_O(balance), 0, "balance", NULL }, /* -100...100 */
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC /* any MAS */
|
2004-06-21 13:42:37 +00:00
|
|
|
{5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -15..+15 / -12..+12 */
|
|
|
|
{5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -15..+15 / -12..+12 */
|
2005-06-16 21:20:00 +00:00
|
|
|
#elif defined HAVE_UDA1380
|
|
|
|
{5, S_O(bass), 0, "bass", NULL }, /* 0..+24 */
|
|
|
|
{3, S_O(treble), 0, "treble", NULL }, /* 0..+6 */
|
2006-03-30 20:18:02 +00:00
|
|
|
#elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \
|
|
|
|
|| defined(HAVE_WM8731) || defined(HAVE_WM8721)
|
2006-05-02 21:47:22 +00:00
|
|
|
{5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -6..+9 */
|
|
|
|
{5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -6..+9 */
|
2005-06-16 21:20:00 +00:00
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-06-18 20:41:59 +00:00
|
|
|
{5, S_O(loudness), 0, "loudness", NULL }, /* 0...17 */
|
2004-06-22 12:37:42 +00:00
|
|
|
{3, S_O(avc), 0, "auto volume", "off,20ms,2,4,8" },
|
2004-07-06 12:17:14 +00:00
|
|
|
{1, S_O(superbass), false, "superbass", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
#endif
|
2005-01-12 00:24:15 +00:00
|
|
|
{3, S_O(channel_config), 0, "channels",
|
|
|
|
"stereo,mono,custom,mono left,mono right,karaoke" },
|
|
|
|
{8, S_O(stereo_width), 100, "stereo width", NULL},
|
2004-06-18 20:41:59 +00:00
|
|
|
/* playback */
|
2005-07-21 11:44:00 +00:00
|
|
|
{1, S_O(resume), false, "resume", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(playlist_shuffle), false, "shuffle", off_on },
|
|
|
|
{16 | SIGNED, S_O(resume_index), -1, NULL, NULL },
|
|
|
|
{16 | SIGNED, S_O(resume_first_index), 0, NULL, NULL },
|
|
|
|
{32 | SIGNED, S_O(resume_offset), -1, NULL, NULL },
|
|
|
|
{32 | SIGNED, S_O(resume_seed), -1, NULL, NULL },
|
2005-08-21 23:01:12 +00:00
|
|
|
{3, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one,shuffle,ab" },
|
2004-06-18 20:41:59 +00:00
|
|
|
/* LCD */
|
2006-07-31 19:13:21 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
|
|
|
{6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL },
|
2006-07-25 11:15:50 +00:00
|
|
|
#endif
|
2004-12-18 10:29:47 +00:00
|
|
|
#ifdef CONFIG_BACKLIGHT
|
2005-11-23 20:12:33 +00:00
|
|
|
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
{5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
|
|
|
|
backlight_times_conf },
|
2004-12-18 10:29:47 +00:00
|
|
|
#endif
|
|
|
|
#endif /* CONFIG_BACKLIGHT */
|
2004-06-18 20:41:59 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
{1, S_O(invert), false, "invert", off_on },
|
|
|
|
{1, S_O(flip_display), false, "flip display", off_on },
|
|
|
|
/* display */
|
2005-11-20 03:18:00 +00:00
|
|
|
{1, S_O(invert_cursor), true, "invert cursor", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(statusbar), true, "statusbar", off_on },
|
|
|
|
{1, S_O(scrollbar), true, "scrollbar", off_on },
|
2004-10-09 20:54:15 +00:00
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(buttonbar), true, "buttonbar", off_on },
|
2004-10-09 20:54:15 +00:00
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(volume_type), 0, "volume display", graphic_numeric },
|
2005-01-30 13:48:44 +00:00
|
|
|
{1, S_O(battery_display), 0, "battery display", graphic_numeric },
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(timeformat), 0, "time format", "24hour,12hour" },
|
2005-07-28 08:36:24 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2004-07-12 22:02:53 +00:00
|
|
|
{1, S_O(show_icons), true, "show icons", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
/* system */
|
2005-01-12 00:24:15 +00:00
|
|
|
{4, S_O(poweroff), 10,
|
2004-06-18 20:41:59 +00:00
|
|
|
"idle poweroff", "off,1,2,3,4,5,6,7,8,9,10,15,30,45,60" },
|
|
|
|
{18, S_O(runtime), 0, NULL, NULL },
|
|
|
|
{18, S_O(topruntime), 0, NULL, NULL },
|
2005-11-04 07:18:36 +00:00
|
|
|
{15, S_O(max_files_in_playlist), 10000,
|
2004-06-18 20:41:59 +00:00
|
|
|
"max files in playlist", NULL }, /* 1000...20000 */
|
2005-11-04 07:18:36 +00:00
|
|
|
{14, S_O(max_files_in_dir), 400,
|
2004-06-18 20:41:59 +00:00
|
|
|
"max files in dir", NULL }, /* 50...10000 */
|
|
|
|
/* battery */
|
2006-04-15 13:07:21 +00:00
|
|
|
{12, S_O(battery_capacity), BATTERY_CAPACITY_DEFAULT, "battery capacity",
|
2004-10-10 10:28:21 +00:00
|
|
|
NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon,
|
2005-01-12 00:24:15 +00:00
|
|
|
500...1500 for Alkaline */
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(car_adapter_mode), false, "car adapter mode", off_on },
|
2004-10-10 01:25:32 +00:00
|
|
|
#endif
|
2005-01-12 00:24:15 +00:00
|
|
|
/* tuner */
|
2004-09-28 22:13:26 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
2004-07-05 14:27:50 +00:00
|
|
|
{1, S_O(fm_force_mono), false, "force fm mono", off_on },
|
2004-07-12 15:06:48 +00:00
|
|
|
{8, S_O(last_frequency), 0, NULL, NULL }, /* Default: MIN_FREQ */
|
2004-07-05 18:09:00 +00:00
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-01-30 16:25:46 +00:00
|
|
|
#if BATTERY_TYPES_COUNT > 1
|
|
|
|
{1, S_O(battery_type), 0, "battery type", "alkaline,nimh" },
|
|
|
|
#endif
|
|
|
|
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
/* remote lcd */
|
2005-05-30 00:00:22 +00:00
|
|
|
{6, S_O(remote_contrast), 42, "remote contrast", NULL },
|
|
|
|
{1, S_O(remote_invert), false, "remote invert", off_on },
|
2005-06-17 21:43:00 +00:00
|
|
|
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
|
2005-11-23 20:12:33 +00:00
|
|
|
{5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
|
|
|
|
backlight_times_conf },
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
{5, S_O(remote_backlight_timeout_plugged), 11,
|
|
|
|
"remote backlight timeout plugged", backlight_times_conf },
|
2005-04-15 12:08:49 +00:00
|
|
|
#endif
|
2005-11-21 23:55:39 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
2005-11-19 07:58:20 +00:00
|
|
|
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif
|
2006-03-24 13:47:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_BACKLIGHT
|
2006-03-30 05:56:19 +00:00
|
|
|
{1, S_O(bl_filter_first_keypress),
|
2006-03-24 13:47:24 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-03-25 19:16:45 +00:00
|
|
|
true,
|
2006-03-24 13:47:24 +00:00
|
|
|
#else
|
2006-03-25 19:16:45 +00:00
|
|
|
false,
|
2006-03-24 13:47:24 +00:00
|
|
|
#endif
|
2006-03-25 19:16:45 +00:00
|
|
|
"backlight filters first keypress", off_on },
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2006-03-30 05:56:19 +00:00
|
|
|
{1, S_O(remote_bl_filter_first_keypress), false,
|
2006-03-25 19:16:45 +00:00
|
|
|
"backlight filters first remote keypress", off_on },
|
2006-03-30 05:56:19 +00:00
|
|
|
#endif
|
2006-03-25 19:16:45 +00:00
|
|
|
|
2005-11-19 07:58:20 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-28 08:36:24 +00:00
|
|
|
/* new stuff to be added here */
|
|
|
|
/* If values are just added to the end, no need to bump the version. */
|
|
|
|
|
2005-08-08 19:23:28 +00:00
|
|
|
/* Current sum of bits: 277 (worst case, but w/o remote lcd) */
|
2004-06-18 20:41:59 +00:00
|
|
|
/* Sum of all bit sizes must not grow beyond 288! */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* the part of the settings which ends up in HD sector only */
|
2004-07-20 19:13:46 +00:00
|
|
|
static const struct bit_entry hd_bits[] =
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
|
|
|
/* This table starts after the 44 RTC bytes = 352 bits. */
|
|
|
|
/* Here we need 11 bits to tell how far this is populated. */
|
|
|
|
|
|
|
|
/* placeholder, containing the size information */
|
|
|
|
{11, 0, 0, 0, NULL, NULL }, /* 11 bit to tell how far this is populated */
|
|
|
|
|
|
|
|
/* # of bits, offset+size, default, .cfg name, .cfg values */
|
|
|
|
/* more display */
|
2004-12-18 10:29:47 +00:00
|
|
|
#ifdef CONFIG_BACKLIGHT
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(caption_backlight), false, "caption backlight", off_on },
|
2004-10-09 19:56:27 +00:00
|
|
|
#endif
|
2006-05-14 23:34:24 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
{1, S_O(remote_caption_backlight), false,
|
|
|
|
"remote caption backlight", off_on },
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
2006-07-25 15:21:31 +00:00
|
|
|
{4, S_O(brightness), DEFAULT_BRIGHTNESS_SETTING, "brightness", NULL },
|
2006-05-14 23:34:24 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_BACKLIGHT_PWM_FADING
|
|
|
|
/* backlight fading */
|
|
|
|
{2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"},
|
|
|
|
{3, S_O(backlight_fade_out), 3, "backlight fade out",
|
|
|
|
"off,500ms,1s,2s,3s,4s,5s,10s"},
|
|
|
|
#endif
|
|
|
|
|
2004-10-15 20:30:29 +00:00
|
|
|
{4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
|
2006-05-14 23:34:24 +00:00
|
|
|
{8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
|
|
|
|
{8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */
|
2006-05-22 16:40:41 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
{4, S_O(remote_scroll_speed), 9, "remote scroll speed", NULL }, /* 0...15 */
|
|
|
|
{8, S_O(remote_scroll_step), 6, "remote scroll step", NULL }, /* 1...160 */
|
|
|
|
{8, S_O(remote_scroll_delay), 100, "remote scroll delay", NULL }, /* 0...250 */
|
2006-07-22 13:47:11 +00:00
|
|
|
{8, S_O(remote_bidir_limit), 50, "remote bidir limit", NULL }, /* 0...200 */
|
2006-05-22 16:40:41 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-28 08:36:24 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-05-14 23:34:24 +00:00
|
|
|
{1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on },
|
|
|
|
#if LCD_WIDTH > 255
|
|
|
|
{9, S_O(scroll_step), 6, "scroll step", NULL },
|
|
|
|
{9, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
|
|
|
#elif LCD_WIDTH > 127
|
|
|
|
{8, S_O(scroll_step), 6, "scroll step", NULL },
|
|
|
|
{8, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
2005-07-28 08:36:24 +00:00
|
|
|
#else
|
2006-05-14 23:34:24 +00:00
|
|
|
{7, S_O(scroll_step), 6, "scroll step", NULL },
|
|
|
|
{7, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
2005-07-28 08:36:24 +00:00
|
|
|
#endif
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2004-06-18 20:41:59 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
{3, S_O(jump_scroll), 0, "jump scroll", NULL }, /* 0...5 */
|
|
|
|
{8, S_O(jump_scroll_delay), 50, "jump scroll delay", NULL }, /* 0...250 */
|
|
|
|
#endif
|
2006-05-14 23:34:24 +00:00
|
|
|
{1, S_O(scroll_paginated), false, "scroll paginated", off_on },
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
{LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"},
|
|
|
|
{LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"},
|
|
|
|
#endif
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* more playback */
|
|
|
|
{1, S_O(play_selected), true, "play selected", off_on },
|
|
|
|
{1, S_O(fade_on_stop), true, "volume fade", off_on },
|
2005-11-04 07:18:36 +00:00
|
|
|
{4, S_O(ff_rewind_min_step), FF_REWIND_1000,
|
2004-06-18 20:41:59 +00:00
|
|
|
"scan min step", "1,2,3,4,5,6,8,10,15,20,25,30,45,60" },
|
|
|
|
{4, S_O(ff_rewind_accel), 3, "scan accel", NULL },
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-21 11:44:00 +00:00
|
|
|
{3, S_O(buffer_margin), 0, "antiskip",
|
|
|
|
"5s,15s,30s,1min,2min,3min,5min,10min" },
|
|
|
|
#else
|
2004-06-18 20:41:59 +00:00
|
|
|
{3, S_O(buffer_margin), 0, "antiskip", NULL },
|
2005-07-21 11:44:00 +00:00
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
/* disk */
|
2004-10-09 22:04:47 +00:00
|
|
|
#ifndef HAVE_MMC
|
2004-06-18 20:41:59 +00:00
|
|
|
#ifdef HAVE_ATA_POWER_OFF
|
|
|
|
{1, S_O(disk_poweroff), false, "disk poweroff", off_on },
|
|
|
|
#endif
|
|
|
|
{8, S_O(disk_spindown), 5, "disk spindown", NULL },
|
2005-07-28 08:36:24 +00:00
|
|
|
#endif /* HAVE_MMC */
|
2006-05-14 23:34:24 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* browser */
|
2005-11-04 07:18:36 +00:00
|
|
|
{3, S_O(dirfilter), SHOW_SUPPORTED,
|
2005-01-17 11:37:36 +00:00
|
|
|
"show files", "all,supported,music,playlists,id3 database" },
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(sort_case), false, "sort case", off_on },
|
2005-11-04 12:49:42 +00:00
|
|
|
{1, S_O(browse_current), false, "follow playlist", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
/* playlist */
|
|
|
|
{1, S_O(playlist_viewer_icons), true, "playlist viewer icons", off_on },
|
2004-10-10 01:25:32 +00:00
|
|
|
{1, S_O(playlist_viewer_indices), true,
|
2004-06-18 20:41:59 +00:00
|
|
|
"playlist viewer indices", off_on },
|
2005-11-04 07:18:36 +00:00
|
|
|
{1, S_O(playlist_viewer_track_display), 0,
|
2004-06-18 20:41:59 +00:00
|
|
|
"playlist viewer track display", "track name,full path" },
|
2005-11-04 07:18:36 +00:00
|
|
|
{2, S_O(recursive_dir_insert), RECURSE_OFF,
|
2004-06-18 20:41:59 +00:00
|
|
|
"recursive directory insert", off_on_ask },
|
|
|
|
/* bookmarks */
|
2005-11-04 07:18:36 +00:00
|
|
|
{3, S_O(autocreatebookmark), BOOKMARK_NO, "autocreate bookmarks",
|
2004-06-18 20:41:59 +00:00
|
|
|
"off,on,ask,recent only - on,recent only - ask" },
|
|
|
|
{2, S_O(autoloadbookmark), BOOKMARK_NO,
|
|
|
|
"autoload bookmarks", off_on_ask },
|
2005-11-04 07:18:36 +00:00
|
|
|
{2, S_O(usemrb), BOOKMARK_NO,
|
2004-06-18 20:41:59 +00:00
|
|
|
"use most-recent-bookmarks", "off,on,unique only" },
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
/* peak meter */
|
|
|
|
{5, S_O(peak_meter_clip_hold), 16, "peak meter clip hold", /* 0...25 */
|
|
|
|
"on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,2min,3min,5min,10min,20min,45min,90min" },
|
2005-08-29 20:07:17 +00:00
|
|
|
{5, S_O(peak_meter_hold), 3, "peak meter hold",
|
2004-06-18 20:41:59 +00:00
|
|
|
"off,200ms,300ms,500ms,1,2,3,4,5,6,7,8,9,10,15,20,30,1min" },
|
|
|
|
{7, S_O(peak_meter_release), 8, "peak meter release", NULL }, /* 0...126 */
|
2004-06-23 07:15:22 +00:00
|
|
|
{1, S_O(peak_meter_dbfs), true, "peak meter dbfs", off_on },
|
2004-06-18 20:41:59 +00:00
|
|
|
{7, S_O(peak_meter_min), 60, "peak meter min", NULL }, /* 0...100 */
|
|
|
|
{7, S_O(peak_meter_max), 0, "peak meter max", NULL }, /* 0...100 */
|
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2005-07-28 08:36:24 +00:00
|
|
|
{7, S_O(mdb_strength), 0, "mdb strength", NULL},
|
|
|
|
{7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL},
|
|
|
|
{9, S_O(mdb_center), 0, "mdb center", NULL},
|
|
|
|
{9, S_O(mdb_shape), 0, "mdb shape", NULL},
|
|
|
|
{1, S_O(mdb_enable), 0, "mdb enable", off_on},
|
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == MAS3507D
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(line_in), false, "line in", off_on },
|
|
|
|
#endif
|
|
|
|
/* voice */
|
2004-10-06 21:37:46 +00:00
|
|
|
{2, S_O(talk_dir), 0, "talk dir", off_number_spell_hover },
|
|
|
|
{2, S_O(talk_file), 0, "talk file", off_number_spell_hover },
|
2004-06-18 20:41:59 +00:00
|
|
|
{1, S_O(talk_menu), true, "talk menu", off_on },
|
|
|
|
|
2004-06-22 09:16:44 +00:00
|
|
|
{2, S_O(sort_file), 0, "sort files", "alpha,oldest,newest,type" },
|
|
|
|
{2, S_O(sort_dir), 0, "sort dirs", "alpha,oldest,newest" },
|
2004-07-27 22:23:01 +00:00
|
|
|
{1, S_O(id3_v1_first), 0, "id3 tag priority", "v2-v1,v1-v2"},
|
2004-07-27 19:20:51 +00:00
|
|
|
|
2005-02-04 10:37:21 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2006-05-14 23:34:24 +00:00
|
|
|
/* recording */
|
2005-02-04 10:37:21 +00:00
|
|
|
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
2006-05-14 23:34:24 +00:00
|
|
|
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
|
|
|
"off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
|
2006-07-22 17:23:05 +00:00
|
|
|
{4, S_O(rec_sizesplit), 0, "rec sizesplit", /* 0...15 */
|
|
|
|
"off,5MB,10MB,15MB,32MB,64MB,75MB,100MB,128MB,256MB,512MB,650MB,700MB,1GB,1.5GB,1.75GB" },
|
2006-05-14 23:34:24 +00:00
|
|
|
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
2006-07-22 17:23:05 +00:00
|
|
|
{1, S_O(rec_split_type), 0, "rec split type", "Split, Stop" },
|
|
|
|
{1, S_O(rec_split_method), 0, "rec split method", "Time,Filesize" },
|
|
|
|
|
2006-05-14 23:34:24 +00:00
|
|
|
#ifdef HAVE_SPDIF_IN
|
|
|
|
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
|
|
|
#else
|
|
|
|
{1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
|
|
|
|
#endif
|
|
|
|
{5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */
|
|
|
|
{1, S_O(rec_directory), 0, /* rec_base_directory */
|
|
|
|
"rec directory", REC_BASE_DIR ",current" },
|
|
|
|
#ifdef CONFIG_BACKLIGHT
|
|
|
|
{2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" },
|
|
|
|
#endif
|
|
|
|
#if CONFIG_CODEC == MAS3587F
|
|
|
|
{4, S_O(rec_mic_gain), 8, "rec mic gain", NULL },
|
|
|
|
{4, S_O(rec_left_gain), 2 /* 0dB */, "rec left gain", NULL }, /* 0...15 */
|
|
|
|
{4, S_O(rec_right_gain), 2 /* 0dB */, "rec right gain", NULL }, /* 0...15 */
|
|
|
|
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
|
|
|
"rec frequency", "44,48,32,22,24,16" },
|
|
|
|
{1, S_O(rec_editable), false, "editable recordings", off_on },
|
|
|
|
{3, S_O(rec_quality), 5, "rec quality", NULL },
|
|
|
|
#elif defined(HAVE_UDA1380)
|
|
|
|
{8|SIGNED, S_O(rec_mic_gain), 16 /* 8 dB */, "rec mic gain", NULL }, /* -128...+108 */
|
|
|
|
{8|SIGNED, S_O(rec_left_gain), 0, "rec left gain", NULL }, /* -128...+96 */
|
|
|
|
{8|SIGNED, S_O(rec_right_gain), 0, "rec right gain", NULL }, /* -128...+96 */
|
|
|
|
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
|
|
|
"rec frequency", "44,48,32,22,24,16" },
|
|
|
|
#endif
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
/* values for the trigger */
|
|
|
|
{8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
|
|
|
|
{8 | SIGNED, S_O(rec_stop_thres), -45, "trigger stop threshold", NULL},
|
|
|
|
{4, S_O(rec_start_duration), 0, "trigger start duration", trig_durations_conf},
|
|
|
|
{4, S_O(rec_stop_postrec), 2, "trigger stop postrec", trig_durations_conf},
|
|
|
|
{4, S_O(rec_stop_gap), 1, "trigger min gap", trig_durations_conf},
|
2005-09-02 07:27:07 +00:00
|
|
|
{4, S_O(rec_trigger_mode ), 0, "trigger mode", "off,once,repeat"},
|
2006-05-14 23:34:24 +00:00
|
|
|
#endif /* HAVE_RECORDING */
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2005-07-01 09:42:39 +00:00
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
{1, S_O(spdif_enable), false, "spdif enable", off_on},
|
|
|
|
#endif
|
2005-07-01 11:25:16 +00:00
|
|
|
|
2005-11-07 00:40:58 +00:00
|
|
|
{1, S_O(next_folder), false, "folder navigation", off_on },
|
2005-07-02 10:50:42 +00:00
|
|
|
{1, S_O(runtimedb), false, "gather runtime data", off_on },
|
2005-07-01 11:25:16 +00:00
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-24 15:32:28 +00:00
|
|
|
{1, S_O(replaygain), false, "replaygain", off_on },
|
2005-11-04 07:18:36 +00:00
|
|
|
{2, S_O(replaygain_type), REPLAYGAIN_ALBUM, "replaygain type",
|
2005-09-24 15:22:48 +00:00
|
|
|
"track,album,track shuffle" },
|
2005-07-24 15:32:28 +00:00
|
|
|
{1, S_O(replaygain_noclip), false, "replaygain noclip", off_on },
|
2005-08-14 06:22:53 +00:00
|
|
|
{8 | SIGNED, S_O(replaygain_preamp), 0, "replaygain preamp", NULL },
|
2005-10-16 11:15:51 +00:00
|
|
|
{2, S_O(beep), 0, "beep", "off,weak,moderate,strong" },
|
2006-03-30 05:56:19 +00:00
|
|
|
{2, S_O(crossfade), 0, "crossfade", "off,shuffle,track skip,always"},
|
2005-11-06 16:40:20 +00:00
|
|
|
{3, S_O(crossfade_fade_in_delay), 0, "crossfade fade in delay", NULL},
|
|
|
|
{3, S_O(crossfade_fade_out_delay), 0, "crossfade fade out delay", NULL},
|
|
|
|
{4, S_O(crossfade_fade_in_duration), 0, "crossfade fade in duration", NULL},
|
|
|
|
{4, S_O(crossfade_fade_out_duration), 0, "crossfade fade out duration", NULL},
|
|
|
|
{1, S_O(crossfade_fade_out_mixmode), 0, "crossfade fade out mode", "crossfade,mix"},
|
2005-11-14 21:56:56 +00:00
|
|
|
{1, S_O(crossfeed), false, "crossfeed", off_on },
|
2006-04-11 13:49:05 +00:00
|
|
|
{6, S_O(crossfeed_direct_gain), 15, "crossfeed direct gain", NULL },
|
|
|
|
{7, S_O(crossfeed_cross_gain), 60, "crossfeed cross gain", NULL },
|
|
|
|
{8, S_O(crossfeed_hf_attenuation), 160, "crossfeed hf attenuation", NULL },
|
|
|
|
{11, S_O(crossfeed_hf_cutoff), 700, "crossfeed hf cutoff", NULL },
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2006-05-14 23:34:24 +00:00
|
|
|
/* equalizer */
|
2006-02-13 19:39:48 +00:00
|
|
|
{1, S_O(eq_enabled), false, "eq enabled", off_on },
|
2006-04-11 13:49:05 +00:00
|
|
|
{8, S_O(eq_precut), 0, "eq precut", NULL },
|
2006-02-13 19:39:48 +00:00
|
|
|
/* 0..32768 Hz */
|
|
|
|
{15, S_O(eq_band0_cutoff), 60, "eq band 0 cutoff", NULL },
|
|
|
|
{15, S_O(eq_band1_cutoff), 200, "eq band 1 cutoff", NULL },
|
|
|
|
{15, S_O(eq_band2_cutoff), 800, "eq band 2 cutoff", NULL },
|
|
|
|
{15, S_O(eq_band3_cutoff), 4000, "eq band 3 cutoff", NULL },
|
|
|
|
{15, S_O(eq_band4_cutoff), 12000, "eq band 4 cutoff", NULL },
|
|
|
|
/* 0..64 (or 0.0 to 6.4) */
|
|
|
|
{6, S_O(eq_band0_q), 7, "eq band 0 q", NULL },
|
|
|
|
{6, S_O(eq_band1_q), 10, "eq band 1 q", NULL },
|
|
|
|
{6, S_O(eq_band2_q), 10, "eq band 2 q", NULL },
|
|
|
|
{6, S_O(eq_band3_q), 10, "eq band 3 q", NULL },
|
|
|
|
{6, S_O(eq_band4_q), 7, "eq band 4 q", NULL },
|
|
|
|
/* -240..240 (or -24db to +24db) */
|
|
|
|
{9|SIGNED, S_O(eq_band0_gain), 0, "eq band 0 gain", NULL },
|
|
|
|
{9|SIGNED, S_O(eq_band1_gain), 0, "eq band 1 gain", NULL },
|
|
|
|
{9|SIGNED, S_O(eq_band2_gain), 0, "eq band 2 gain", NULL },
|
|
|
|
{9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
|
|
|
|
{9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
|
2006-02-07 14:07:46 +00:00
|
|
|
#endif
|
2006-03-26 11:33:42 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_DIRCACHE
|
2006-05-14 23:34:24 +00:00
|
|
|
{1, S_O(dircache), false, "dircache", off_on },
|
|
|
|
{22, S_O(dircache_size), 0, NULL, NULL },
|
2006-07-10 16:22:03 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TC_RAMCACHE
|
2006-03-26 11:33:42 +00:00
|
|
|
{1, S_O(tagcache_ram), 0, "tagcache_ram", off_on },
|
|
|
|
#endif
|
2006-07-10 16:22:03 +00:00
|
|
|
{1, S_O(tagcache_autoupdate), 0, "tagcache_autoupdate", off_on },
|
2006-03-26 11:33:42 +00:00
|
|
|
|
2006-05-14 23:34:24 +00:00
|
|
|
{4, S_O(default_codepage), 0, "default codepage",
|
|
|
|
"iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256,iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256" },
|
|
|
|
|
|
|
|
{1, S_O(warnon_erase_dynplaylist), false,
|
|
|
|
"warn when erasing dynamic playlist", off_on },
|
|
|
|
|
2006-07-10 16:22:03 +00:00
|
|
|
|
2005-07-28 08:36:24 +00:00
|
|
|
/* If values are just added to the end, no need to bump the version. */
|
2005-02-04 10:37:21 +00:00
|
|
|
/* new stuff to be added at the end */
|
2005-07-28 08:36:24 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */
|
|
|
|
};
|
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
/* helper function to extract n (<=32) bits from an arbitrary position
|
|
|
|
* counting from LSB to MSB */
|
2006-03-03 01:12:50 +00:00
|
|
|
static uint32_t get_bits(
|
|
|
|
const uint32_t *p, /* the start of the bitfield array */
|
2004-06-18 20:41:59 +00:00
|
|
|
unsigned int from, /* bit no. to start reading from */
|
|
|
|
unsigned int size) /* how many bits to read */
|
|
|
|
{
|
2005-05-04 22:30:36 +00:00
|
|
|
unsigned int long_index = from / 32;
|
|
|
|
unsigned int bit_index = from % 32;
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t result;
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
result = p[long_index] >> bit_index;
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
if (bit_index + size > 32) /* crossing longword boundary */
|
|
|
|
result |= p[long_index+1] << (32 - bit_index);
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
result &= 0xFFFFFFFF >> (32 - size);
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
/* helper function to set n (<=32) bits to an arbitrary position,
|
|
|
|
* counting from LSB to MSB */
|
2004-06-18 20:41:59 +00:00
|
|
|
static void set_bits(
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t *p, /* the start of the bitfield array */
|
2004-06-18 20:41:59 +00:00
|
|
|
unsigned int from, /* bit no. to start writing into */
|
|
|
|
unsigned int size, /* how many bits to change */
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t value) /* content (LSBs will be taken) */
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
2005-05-04 22:30:36 +00:00
|
|
|
unsigned int long_index = from / 32;
|
|
|
|
unsigned int bit_index = from % 32;
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t mask;
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2005-05-04 22:30:36 +00:00
|
|
|
mask = 0xFFFFFFFF >> (32 - size);
|
|
|
|
value &= mask;
|
|
|
|
mask <<= bit_index;
|
|
|
|
|
|
|
|
if (bit_index + size > 32)
|
2005-11-04 07:18:36 +00:00
|
|
|
p[long_index+1] =
|
2005-05-04 22:30:36 +00:00
|
|
|
(p[long_index+1] & (0xFFFFFFFF << (bit_index + size - 32)))
|
|
|
|
| (value >> (32 - bit_index));
|
|
|
|
|
|
|
|
p[long_index] = (p[long_index] & ~mask) | (value << bit_index);
|
2004-06-18 20:41:59 +00:00
|
|
|
}
|
2002-07-15 11:02:12 +00:00
|
|
|
|
2006-02-26 02:48:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
/*
|
|
|
|
* Helper function to convert a string of 6 hex digits to a native colour
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \
|
|
|
|
(toupper(c)) - 'A' + 10)
|
|
|
|
|
|
|
|
int hex_to_rgb(const char* hex)
|
|
|
|
{ int ok = 1;
|
|
|
|
int i;
|
|
|
|
int red, green, blue;
|
|
|
|
|
|
|
|
if (strlen(hex) == 6) {
|
|
|
|
for (i=0; i < 6; i++ ) {
|
|
|
|
if (!isxdigit(hex[i])) {
|
|
|
|
ok=0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ok) {
|
|
|
|
red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]);
|
|
|
|
green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]);
|
|
|
|
blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]);
|
|
|
|
return LCD_RGBPACK(red,green,blue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
/*
|
2002-08-16 14:41:47 +00:00
|
|
|
* Calculates the checksum for the config block and returns it
|
2002-07-15 11:02:12 +00:00
|
|
|
*/
|
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
static unsigned short calculate_config_checksum(const unsigned char* buf)
|
2002-07-15 11:02:12 +00:00
|
|
|
{
|
2002-08-13 17:16:09 +00:00
|
|
|
unsigned int i;
|
|
|
|
unsigned char cksum[2];
|
2002-07-15 11:02:12 +00:00
|
|
|
cksum[0] = cksum[1] = 0;
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2002-08-16 14:41:47 +00:00
|
|
|
for (i=0; i < RTC_BLOCK_SIZE - 2; i+=2 ) {
|
|
|
|
cksum[0] ^= buf[i];
|
|
|
|
cksum[1] ^= buf[i+1];
|
2002-07-15 11:02:12 +00:00
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
|
|
|
|
return (cksum[0] << 8) | cksum[1];
|
2002-07-15 11:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* initialize the config block buffer
|
|
|
|
*/
|
|
|
|
static void init_config_buffer( void )
|
|
|
|
{
|
|
|
|
DEBUGF( "init_config_buffer()\n" );
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
/* reset to 0 - all unused */
|
|
|
|
memset(config_block, 0, CONFIG_BLOCK_SIZE);
|
2002-07-15 11:02:12 +00:00
|
|
|
/* insert header */
|
2002-08-16 14:41:47 +00:00
|
|
|
config_block[0] = 'R';
|
|
|
|
config_block[1] = 'o';
|
|
|
|
config_block[2] = 'c';
|
|
|
|
config_block[3] = CONFIG_BLOCK_VERSION;
|
2002-07-15 11:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2002-08-13 17:16:09 +00:00
|
|
|
* save the config block buffer to disk or RTC RAM
|
2002-07-15 11:02:12 +00:00
|
|
|
*/
|
|
|
|
static int save_config_buffer( void )
|
|
|
|
{
|
2002-08-13 17:16:09 +00:00
|
|
|
unsigned short chksum;
|
2005-12-04 13:05:56 +00:00
|
|
|
#ifdef HAVE_RTC_RAM
|
2002-08-13 17:16:09 +00:00
|
|
|
unsigned int i;
|
|
|
|
#endif
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
/* update the checksum in the end of the block before saving */
|
2002-08-16 14:41:47 +00:00
|
|
|
chksum = calculate_config_checksum(config_block);
|
|
|
|
config_block[ RTC_BLOCK_SIZE - 2 ] = chksum >> 8;
|
|
|
|
config_block[ RTC_BLOCK_SIZE - 1 ] = chksum & 0xff;
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2005-12-04 13:05:56 +00:00
|
|
|
#ifdef HAVE_RTC_RAM
|
2002-07-15 11:02:12 +00:00
|
|
|
/* FIXME: okay, it _would_ be cleaner and faster to implement rtc_write so
|
|
|
|
that it would write a number of bytes at a time since the RTC chip
|
|
|
|
supports that, but this will have to do for now 8-) */
|
2002-08-16 14:41:47 +00:00
|
|
|
for (i=0; i < RTC_BLOCK_SIZE; i++ ) {
|
|
|
|
int r = rtc_write(0x14+i, config_block[i]);
|
2002-07-15 11:02:12 +00:00
|
|
|
if (r) {
|
2002-10-14 09:11:59 +00:00
|
|
|
DEBUGF( "save_config_buffer: rtc_write failed at addr 0x%02x: %d\n",
|
|
|
|
14+i, r );
|
2002-07-15 11:02:12 +00:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2002-08-16 14:41:47 +00:00
|
|
|
#endif
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2004-09-28 18:09:10 +00:00
|
|
|
if (config_sector != 0)
|
|
|
|
ata_delayed_write( config_sector, config_block);
|
2002-08-13 17:16:09 +00:00
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2002-08-13 17:16:09 +00:00
|
|
|
* load the config block buffer from disk or RTC RAM
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2004-06-19 15:50:02 +00:00
|
|
|
static int load_config_buffer(int which)
|
2002-06-27 00:20:00 +00:00
|
|
|
{
|
2002-08-13 17:16:09 +00:00
|
|
|
unsigned short chksum;
|
2002-08-16 14:41:47 +00:00
|
|
|
bool correct = false;
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
DEBUGF( "load_config_buffer()\n" );
|
2002-08-13 17:16:09 +00:00
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
if (which & SETTINGS_HD)
|
|
|
|
{
|
2004-09-28 18:09:10 +00:00
|
|
|
if (config_sector != 0) {
|
2004-12-28 22:16:07 +00:00
|
|
|
ata_read_sectors(IF_MV2(0,) config_sector, 1, config_block);
|
2004-06-19 15:50:02 +00:00
|
|
|
/* calculate the checksum, check it and the header */
|
|
|
|
chksum = calculate_config_checksum(config_block);
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
if (config_block[0] == 'R' &&
|
|
|
|
config_block[1] == 'o' &&
|
|
|
|
config_block[2] == 'c' &&
|
|
|
|
config_block[3] == CONFIG_BLOCK_VERSION &&
|
|
|
|
(chksum >> 8) == config_block[RTC_BLOCK_SIZE - 2] &&
|
|
|
|
(chksum & 0xff) == config_block[RTC_BLOCK_SIZE - 1])
|
|
|
|
{
|
|
|
|
DEBUGF( "load_config_buffer: header & checksum test ok\n" );
|
|
|
|
correct = true;
|
|
|
|
}
|
2002-08-16 14:41:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-04 13:05:56 +00:00
|
|
|
#ifdef HAVE_RTC_RAM
|
2004-03-13 00:04:58 +00:00
|
|
|
if(!correct)
|
|
|
|
{
|
|
|
|
/* If the disk sector was incorrect, reinit the buffer */
|
2004-06-19 15:50:02 +00:00
|
|
|
memset(config_block, 0, CONFIG_BLOCK_SIZE);
|
2004-03-13 00:04:58 +00:00
|
|
|
}
|
2002-08-16 14:41:47 +00:00
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
if (which & SETTINGS_RTC)
|
2002-08-13 17:16:09 +00:00
|
|
|
{
|
2004-06-19 15:50:02 +00:00
|
|
|
unsigned int i;
|
|
|
|
unsigned char rtc_block[RTC_BLOCK_SIZE];
|
|
|
|
|
|
|
|
/* read rtc block */
|
|
|
|
for (i=0; i < RTC_BLOCK_SIZE; i++ )
|
|
|
|
rtc_block[i] = rtc_read(0x14+i);
|
|
|
|
|
|
|
|
chksum = calculate_config_checksum(rtc_block);
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-19 15:50:02 +00:00
|
|
|
/* if rtc block is ok, use that */
|
|
|
|
if (rtc_block[0] == 'R' &&
|
|
|
|
rtc_block[1] == 'o' &&
|
|
|
|
rtc_block[2] == 'c' &&
|
|
|
|
rtc_block[3] == CONFIG_BLOCK_VERSION &&
|
|
|
|
(chksum >> 8) == rtc_block[RTC_BLOCK_SIZE - 2] &&
|
|
|
|
(chksum & 0xff) == rtc_block[RTC_BLOCK_SIZE - 1])
|
|
|
|
{
|
|
|
|
memcpy(config_block, rtc_block, RTC_BLOCK_SIZE);
|
|
|
|
correct = true;
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
}
|
2002-08-16 14:41:47 +00:00
|
|
|
#endif
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2002-08-16 14:41:47 +00:00
|
|
|
if ( !correct ) {
|
|
|
|
/* if checksum is not valid, clear the config buffer */
|
|
|
|
DEBUGF( "load_config_buffer: header & checksum test failed\n" );
|
|
|
|
init_config_buffer();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2002-07-28 16:09:44 +00:00
|
|
|
}
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
/* helper to save content of global_settings into a bitfield,
|
2005-11-04 07:18:36 +00:00
|
|
|
as described per table */
|
2004-06-18 20:41:59 +00:00
|
|
|
static void save_bit_table(const struct bit_entry* p_table, int count, int bitstart)
|
|
|
|
{
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t *p_bitfield = (uint32_t *)config_block; /* 32 bit addr. */
|
|
|
|
uint32_t value; /* 32 bit content */
|
2004-06-18 20:41:59 +00:00
|
|
|
int i;
|
|
|
|
const struct bit_entry* p_run = p_table; /* start after the size info */
|
|
|
|
int curr_bit = bitstart + p_table->bit_size;
|
|
|
|
count--; /* first is excluded from loop */
|
|
|
|
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
p_run++;
|
|
|
|
/* could do a memcpy, but that would be endian-dependent */
|
|
|
|
switch(p_run->byte_size)
|
|
|
|
{
|
|
|
|
case 1:
|
2006-03-03 01:12:50 +00:00
|
|
|
value = ((uint8_t *)&global_settings)[p_run->settings_offset];
|
2004-06-18 20:41:59 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2006-03-03 01:12:50 +00:00
|
|
|
value = ((uint16_t *)&global_settings)[p_run->settings_offset/2];
|
2004-06-18 20:41:59 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2006-03-03 01:12:50 +00:00
|
|
|
value = ((uint32_t *)&global_settings)[p_run->settings_offset/4];
|
2004-06-18 20:41:59 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-03-03 01:12:50 +00:00
|
|
|
DEBUGF( "save_bit_table: illegal size!\n" );
|
2004-06-18 20:41:59 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
set_bits(p_bitfield, curr_bit, p_run->bit_size & 0x3F, value);
|
|
|
|
curr_bit += p_run->bit_size & 0x3F;
|
|
|
|
}
|
|
|
|
set_bits(p_bitfield, bitstart, p_table->bit_size, /* write size */
|
|
|
|
curr_bit); /* = position after last element */
|
|
|
|
}
|
|
|
|
|
2004-09-28 18:09:10 +00:00
|
|
|
/*
|
|
|
|
* figure out the config sector from the partition table and the
|
2005-11-04 07:18:36 +00:00
|
|
|
* mounted file system
|
2004-09-28 18:09:10 +00:00
|
|
|
*/
|
|
|
|
void settings_calc_config_sector(void)
|
|
|
|
{
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
config_sector = 61;
|
|
|
|
#else
|
2005-02-11 18:41:40 +00:00
|
|
|
int i;
|
|
|
|
long partition_start;
|
|
|
|
long sector = 0;
|
2004-09-28 18:09:10 +00:00
|
|
|
|
2004-12-28 22:16:07 +00:00
|
|
|
if (fat_startsector(IF_MV(0)) != 0) /* There is a partition table */
|
2004-09-28 18:09:10 +00:00
|
|
|
{
|
|
|
|
sector = 61;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
partition_start = disk_partinfo(i)->start;
|
|
|
|
if (partition_start != 0 && (partition_start - 2) < sector)
|
|
|
|
sector = partition_start - 2;
|
|
|
|
}
|
|
|
|
if (sector < 0)
|
|
|
|
sector = 0;
|
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-09-28 18:09:10 +00:00
|
|
|
config_sector = sector;
|
|
|
|
#endif
|
|
|
|
}
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2002-07-15 11:02:12 +00:00
|
|
|
* persist all runtime user settings to disk or RTC RAM
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2002-07-15 11:02:12 +00:00
|
|
|
int settings_save( void )
|
2002-06-27 00:20:00 +00:00
|
|
|
{
|
2006-02-02 20:42:56 +00:00
|
|
|
int i;
|
|
|
|
|
2002-12-02 16:07:56 +00:00
|
|
|
{
|
2003-07-04 08:20:30 +00:00
|
|
|
int elapsed_secs;
|
2002-12-02 16:07:56 +00:00
|
|
|
|
2003-07-04 08:20:30 +00:00
|
|
|
elapsed_secs = (current_tick - lasttime) / HZ;
|
|
|
|
global_settings.runtime += elapsed_secs;
|
|
|
|
lasttime += (elapsed_secs * HZ);
|
2002-12-04 11:25:56 +00:00
|
|
|
|
2002-12-02 16:07:56 +00:00
|
|
|
if ( global_settings.runtime > global_settings.topruntime )
|
|
|
|
global_settings.topruntime = global_settings.runtime;
|
|
|
|
}
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
/* serialize scalar values into RTC and HD sector, specified via table */
|
|
|
|
save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8);
|
|
|
|
save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8);
|
2002-12-12 15:20:37 +00:00
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
i = 0xb8;
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.wps_file,
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.lang_file,
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.font_file,
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2006-02-02 20:42:56 +00:00
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.rwps_file,
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
|
|
|
#endif
|
2006-04-02 12:23:08 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.fmr_file,
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
|
|
|
#endif
|
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file,
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
2005-11-17 20:14:59 +00:00
|
|
|
#endif
|
2006-03-29 16:21:42 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
strncpy((char *)&config_block[i], (char *)global_settings.kbd_file,
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
|
|
|
#endif
|
2002-08-16 14:41:47 +00:00
|
|
|
|
2002-07-28 16:09:44 +00:00
|
|
|
if(save_config_buffer())
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_clear_display();
|
|
|
|
#endif
|
2002-07-28 16:09:44 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
2002-09-18 14:08:05 +00:00
|
|
|
lcd_puts(0, 0, str(LANG_SETTINGS_SAVE_PLAYER));
|
|
|
|
lcd_puts(0, 1, str(LANG_SETTINGS_BATTERY_PLAYER));
|
2002-07-28 16:09:44 +00:00
|
|
|
#else
|
2002-09-18 14:08:05 +00:00
|
|
|
lcd_puts(4, 2, str(LANG_SETTINGS_SAVE_RECORDER));
|
|
|
|
lcd_puts(2, 4, str(LANG_SETTINGS_BATTERY_RECORDER));
|
2002-07-28 16:09:44 +00:00
|
|
|
lcd_update();
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_puts(4, 2, str(LANG_SETTINGS_SAVE_RECORDER));
|
|
|
|
lcd_remote_puts(2, 4, str(LANG_SETTINGS_BATTERY_RECORDER));
|
|
|
|
lcd_remote_update();
|
|
|
|
#endif
|
2002-07-28 16:09:44 +00:00
|
|
|
#endif
|
|
|
|
sleep(HZ*2);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
2002-06-27 00:20:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-29 12:09:15 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
/**
|
2005-11-04 07:18:36 +00:00
|
|
|
* Applies the range infos stored in global_settings to
|
|
|
|
* the peak meter.
|
2002-10-29 12:09:15 +00:00
|
|
|
*/
|
|
|
|
void settings_apply_pm_range(void)
|
|
|
|
{
|
|
|
|
int pm_min, pm_max;
|
|
|
|
|
|
|
|
/* depending on the scale mode (dBfs or percent) the values
|
|
|
|
of global_settings.peak_meter_dbfs have different meanings */
|
2005-11-04 07:18:36 +00:00
|
|
|
if (global_settings.peak_meter_dbfs)
|
2002-10-29 12:09:15 +00:00
|
|
|
{
|
|
|
|
/* convert to dBfs * 100 */
|
|
|
|
pm_min = -(((int)global_settings.peak_meter_min) * 100);
|
|
|
|
pm_max = -(((int)global_settings.peak_meter_max) * 100);
|
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
else
|
2002-10-29 12:09:15 +00:00
|
|
|
{
|
|
|
|
/* percent is stored directly -> no conversion */
|
|
|
|
pm_min = global_settings.peak_meter_min;
|
|
|
|
pm_max = global_settings.peak_meter_max;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* apply the range */
|
|
|
|
peak_meter_init_range(global_settings.peak_meter_dbfs, pm_min, pm_max);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
void sound_settings_apply(void)
|
2002-10-03 09:31:01 +00:00
|
|
|
{
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_BASS, global_settings.bass);
|
|
|
|
sound_set(SOUND_TREBLE, global_settings.treble);
|
|
|
|
sound_set(SOUND_BALANCE, global_settings.balance);
|
|
|
|
sound_set(SOUND_VOLUME, global_settings.volume);
|
2006-03-21 23:20:17 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
channels_set(global_settings.channel_config);
|
|
|
|
stereo_width_set(global_settings.stereo_width);
|
|
|
|
#else
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_CHANNELS, global_settings.channel_config);
|
|
|
|
sound_set(SOUND_STEREO_WIDTH, global_settings.stereo_width);
|
2006-03-21 23:20:17 +00:00
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set(SOUND_LOUDNESS, global_settings.loudness);
|
|
|
|
sound_set(SOUND_AVC, global_settings.avc);
|
|
|
|
sound_set(SOUND_MDB_STRENGTH, global_settings.mdb_strength);
|
|
|
|
sound_set(SOUND_MDB_HARMONICS, global_settings.mdb_harmonics);
|
|
|
|
sound_set(SOUND_MDB_CENTER, global_settings.mdb_center);
|
|
|
|
sound_set(SOUND_MDB_SHAPE, global_settings.mdb_shape);
|
|
|
|
sound_set(SOUND_MDB_ENABLE, global_settings.mdb_enable);
|
|
|
|
sound_set(SOUND_SUPERBASS, global_settings.superbass);
|
2002-10-03 09:31:01 +00:00
|
|
|
#endif
|
2004-07-06 12:17:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void settings_apply(void)
|
|
|
|
{
|
|
|
|
char buf[64];
|
2006-02-17 21:55:11 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2006-02-17 19:56:22 +00:00
|
|
|
int i;
|
2006-02-17 21:55:11 +00:00
|
|
|
#endif
|
2004-07-06 12:17:14 +00:00
|
|
|
|
|
|
|
sound_settings_apply();
|
2002-10-03 09:31:01 +00:00
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2006-07-31 19:13:21 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2002-10-03 09:31:01 +00:00
|
|
|
lcd_set_contrast(global_settings.contrast);
|
2006-07-25 11:15:50 +00:00
|
|
|
#endif
|
2002-10-03 09:31:01 +00:00
|
|
|
lcd_scroll_speed(global_settings.scroll_speed);
|
2005-04-15 12:08:49 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-06-17 21:43:00 +00:00
|
|
|
lcd_remote_set_contrast(global_settings.remote_contrast);
|
|
|
|
lcd_remote_set_invert_display(global_settings.remote_invert);
|
|
|
|
lcd_remote_set_flip(global_settings.remote_flip_display);
|
2006-05-22 16:40:41 +00:00
|
|
|
lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
|
|
|
|
lcd_remote_scroll_step(global_settings.remote_scroll_step);
|
|
|
|
lcd_remote_scroll_delay(global_settings.remote_scroll_delay * (HZ/10));
|
2006-07-22 13:47:11 +00:00
|
|
|
lcd_remote_bidir_scroll(global_settings.remote_bidir_limit);
|
2005-11-19 09:26:02 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
2005-11-19 08:05:03 +00:00
|
|
|
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
|
2005-11-19 09:26:02 +00:00
|
|
|
#endif
|
2005-05-30 00:00:22 +00:00
|
|
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
|
|
|
|
#endif
|
2005-06-17 21:43:00 +00:00
|
|
|
#endif
|
2005-11-21 23:55:39 +00:00
|
|
|
#ifdef CONFIG_BACKLIGHT
|
2002-10-03 09:31:01 +00:00
|
|
|
backlight_set_timeout(global_settings.backlight_timeout);
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif
|
2006-03-19 17:42:58 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
|
2005-06-20 17:03:09 +00:00
|
|
|
backlight_set_fade_in(global_settings.backlight_fade_in);
|
|
|
|
backlight_set_fade_out(global_settings.backlight_fade_out);
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif
|
2005-12-22 10:43:36 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
backlight_set_brightness(global_settings.brightness);
|
2005-06-20 17:03:09 +00:00
|
|
|
#endif
|
2002-10-03 09:31:01 +00:00
|
|
|
ata_spindown(global_settings.disk_spindown);
|
2005-11-06 23:12:11 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
|
2003-11-03 23:36:36 +00:00
|
|
|
dac_line_in(global_settings.line_in);
|
|
|
|
#endif
|
2005-09-11 12:07:13 +00:00
|
|
|
mpeg_id3_options(global_settings.id3_v1_first);
|
2003-02-12 09:02:55 +00:00
|
|
|
#ifdef HAVE_ATA_POWER_OFF
|
2002-11-29 13:57:00 +00:00
|
|
|
ata_poweroff(global_settings.disk_poweroff);
|
2002-11-30 09:42:13 +00:00
|
|
|
#endif
|
|
|
|
|
2002-10-03 09:31:01 +00:00
|
|
|
set_poweroff_timeout(global_settings.poweroff);
|
2002-10-08 15:42:40 +00:00
|
|
|
|
2002-12-16 22:58:48 +00:00
|
|
|
set_battery_capacity(global_settings.battery_capacity);
|
2005-01-30 16:25:46 +00:00
|
|
|
#if BATTERY_TYPES_COUNT > 1
|
|
|
|
set_battery_type(global_settings.battery_type);
|
|
|
|
#endif
|
2002-12-16 22:58:48 +00:00
|
|
|
|
2002-10-29 12:09:15 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-02-27 14:22:30 +00:00
|
|
|
lcd_set_invert_display(global_settings.invert);
|
2003-12-20 10:00:37 +00:00
|
|
|
lcd_set_flip(global_settings.flip_display);
|
|
|
|
button_set_flip(global_settings.flip_display);
|
|
|
|
lcd_update(); /* refresh after flipping the screen */
|
2002-10-29 12:09:15 +00:00
|
|
|
settings_apply_pm_range();
|
|
|
|
peak_meter_init_times(
|
2005-11-04 07:18:36 +00:00
|
|
|
global_settings.peak_meter_release, global_settings.peak_meter_hold,
|
2002-10-29 12:09:15 +00:00
|
|
|
global_settings.peak_meter_clip_hold);
|
|
|
|
#endif
|
|
|
|
|
2006-05-21 11:00:02 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
unload_wps_backdrop();
|
|
|
|
#endif
|
2005-11-04 07:18:36 +00:00
|
|
|
if ( global_settings.wps_file[0] &&
|
2002-10-09 08:51:08 +00:00
|
|
|
global_settings.wps_file[0] != 0xff ) {
|
2005-11-12 21:48:06 +00:00
|
|
|
snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
|
2002-10-08 15:42:40 +00:00
|
|
|
global_settings.wps_file);
|
2005-12-09 01:11:14 +00:00
|
|
|
wps_data_load(gui_wps[0].data, buf, true);
|
2002-10-08 15:42:40 +00:00
|
|
|
}
|
2002-10-09 23:13:25 +00:00
|
|
|
else
|
2006-05-21 11:00:02 +00:00
|
|
|
{
|
2005-11-18 09:03:25 +00:00
|
|
|
wps_data_init(gui_wps[0].data);
|
2006-05-21 11:00:02 +00:00
|
|
|
}
|
2005-11-17 20:14:59 +00:00
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
if ( global_settings.backdrop_file[0] &&
|
|
|
|
global_settings.backdrop_file[0] != 0xff ) {
|
|
|
|
snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
|
|
|
|
global_settings.backdrop_file);
|
|
|
|
load_main_backdrop(buf);
|
|
|
|
} else {
|
2006-05-21 11:00:02 +00:00
|
|
|
unload_main_backdrop();
|
2006-02-02 20:42:56 +00:00
|
|
|
}
|
2006-05-21 11:00:02 +00:00
|
|
|
show_main_backdrop();
|
|
|
|
|
2006-02-26 02:48:05 +00:00
|
|
|
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
|
|
|
|
screens[SCREEN_MAIN].set_background(global_settings.bg_color);
|
2006-02-02 20:42:56 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-04 12:11:08 +00:00
|
|
|
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
2005-11-17 20:14:59 +00:00
|
|
|
if ( global_settings.rwps_file[0] &&
|
|
|
|
global_settings.rwps_file[0] != 0xff ) {
|
|
|
|
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
|
|
|
|
global_settings.rwps_file);
|
2005-12-09 01:11:14 +00:00
|
|
|
wps_data_load(gui_wps[1].data, buf, true);
|
2005-11-17 20:14:59 +00:00
|
|
|
}
|
|
|
|
else
|
2005-11-18 09:03:25 +00:00
|
|
|
wps_data_init(gui_wps[1].data);
|
2005-11-17 20:14:59 +00:00
|
|
|
#endif
|
2002-10-09 23:13:25 +00:00
|
|
|
|
2002-10-08 15:42:40 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-10-09 08:51:08 +00:00
|
|
|
if ( global_settings.font_file[0] &&
|
|
|
|
global_settings.font_file[0] != 0xff ) {
|
2004-01-08 12:40:25 +00:00
|
|
|
snprintf(buf, sizeof buf, ROCKBOX_DIR FONT_DIR "/%s.fnt",
|
2002-10-08 15:42:40 +00:00
|
|
|
global_settings.font_file);
|
|
|
|
font_load(buf);
|
|
|
|
}
|
2002-10-09 23:13:25 +00:00
|
|
|
else
|
|
|
|
font_reset();
|
2002-12-12 15:20:37 +00:00
|
|
|
|
2006-03-29 16:21:42 +00:00
|
|
|
if ( global_settings.kbd_file[0] &&
|
|
|
|
global_settings.kbd_file[0] != 0xff ) {
|
|
|
|
snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
|
|
|
|
global_settings.kbd_file);
|
|
|
|
load_kbd(buf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
load_kbd(NULL);
|
|
|
|
|
2002-12-12 15:20:37 +00:00
|
|
|
lcd_scroll_step(global_settings.scroll_step);
|
2006-01-22 01:42:05 +00:00
|
|
|
gui_list_screen_scroll_step(global_settings.screen_scroll_step);
|
|
|
|
gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
|
2003-05-22 06:42:14 +00:00
|
|
|
#else
|
|
|
|
lcd_jump_scroll(global_settings.jump_scroll);
|
2003-05-28 09:00:27 +00:00
|
|
|
lcd_jump_scroll_delay(global_settings.jump_scroll_delay * (HZ/10));
|
2002-10-08 15:42:40 +00:00
|
|
|
#endif
|
2003-02-12 09:07:48 +00:00
|
|
|
lcd_bidir_scroll(global_settings.bidir_limit);
|
2002-12-12 15:20:37 +00:00
|
|
|
lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
|
2002-10-09 23:13:25 +00:00
|
|
|
|
2002-10-09 08:51:08 +00:00
|
|
|
if ( global_settings.lang_file[0] &&
|
|
|
|
global_settings.lang_file[0] != 0xff ) {
|
2004-01-08 12:40:25 +00:00
|
|
|
snprintf(buf, sizeof buf, ROCKBOX_DIR LANG_DIR "/%s.lng",
|
2002-10-08 15:42:40 +00:00
|
|
|
global_settings.lang_file);
|
|
|
|
lang_load(buf);
|
2004-04-06 07:06:59 +00:00
|
|
|
talk_init(); /* use voice of same language */
|
2002-10-08 15:42:40 +00:00
|
|
|
}
|
2005-06-09 09:47:00 +00:00
|
|
|
|
2005-12-06 13:27:15 +00:00
|
|
|
set_codepage(global_settings.default_codepage);
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-22 16:46:27 +00:00
|
|
|
audio_set_crossfade(global_settings.crossfade);
|
2005-09-24 15:22:48 +00:00
|
|
|
dsp_set_replaygain(true);
|
2005-11-14 21:56:56 +00:00
|
|
|
dsp_set_crossfeed(global_settings.crossfeed);
|
2006-04-11 13:49:05 +00:00
|
|
|
dsp_set_crossfeed_direct_gain(global_settings.crossfeed_direct_gain);
|
|
|
|
dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
|
|
|
|
global_settings.crossfeed_cross_gain
|
|
|
|
+ global_settings.crossfeed_hf_attenuation,
|
|
|
|
global_settings.crossfeed_hf_cutoff);
|
2006-03-27 21:20:35 +00:00
|
|
|
|
2006-03-28 21:19:30 +00:00
|
|
|
dsp_set_eq(global_settings.eq_enabled);
|
2006-03-30 05:56:19 +00:00
|
|
|
dsp_set_eq_precut(global_settings.eq_precut);
|
2006-02-17 19:56:22 +00:00
|
|
|
/* Update all EQ bands */
|
|
|
|
for(i = 0; i < 5; i++) {
|
2006-03-28 21:19:30 +00:00
|
|
|
dsp_set_eq_coefs(i);
|
2006-02-17 19:56:22 +00:00
|
|
|
}
|
2005-06-09 09:47:00 +00:00
|
|
|
#endif
|
2005-07-01 09:42:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
spdif_power_enable(global_settings.spdif_enable);
|
|
|
|
#endif
|
2006-03-24 13:47:24 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_BACKLIGHT
|
|
|
|
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
|
2006-03-25 19:16:45 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
|
|
|
|
#endif
|
2006-03-24 13:47:24 +00:00
|
|
|
#endif
|
2002-10-03 09:31:01 +00:00
|
|
|
}
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
/* helper to load global_settings from a bitfield, as described per table */
|
|
|
|
static void load_bit_table(const struct bit_entry* p_table, int count, int bitstart)
|
|
|
|
{
|
2006-03-03 01:12:50 +00:00
|
|
|
uint32_t *p_bitfield = (uint32_t *)config_block; /* 32 bit addr. */
|
|
|
|
uint32_t value; /* 32 bit content */
|
2004-06-18 20:41:59 +00:00
|
|
|
int i;
|
|
|
|
int maxbit; /* how many bits are valid in the saved part */
|
|
|
|
const struct bit_entry* p_run = p_table; /* start after the size info */
|
|
|
|
count--; /* first is excluded from loop */
|
|
|
|
maxbit = get_bits(p_bitfield, bitstart, p_table->bit_size);
|
|
|
|
bitstart += p_table->bit_size;
|
|
|
|
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
p_run++;
|
|
|
|
|
|
|
|
size = p_run->bit_size & 0x3F; /* mask off abused bits */
|
|
|
|
if (bitstart + size > maxbit)
|
|
|
|
break; /* exit if this is not valid any more in bitfield */
|
|
|
|
|
|
|
|
value = get_bits(p_bitfield, bitstart, size);
|
|
|
|
bitstart += size;
|
|
|
|
if (p_run->bit_size & SIGNED)
|
|
|
|
{ // sign extend the read value
|
|
|
|
unsigned long mask = 0xFFFFFFFF << (size - 1);
|
|
|
|
if (value & mask) /* true if MSB of value is set */
|
|
|
|
value |= mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* could do a memcpy, but that would be endian-dependent */
|
|
|
|
switch(p_run->byte_size)
|
|
|
|
{
|
|
|
|
case 1:
|
2006-03-03 01:12:50 +00:00
|
|
|
((uint8_t *)&global_settings)[p_run->settings_offset] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned char)value;
|
|
|
|
break;
|
|
|
|
case 2:
|
2006-03-03 01:12:50 +00:00
|
|
|
((uint16_t *)&global_settings)[p_run->settings_offset/2] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned short)value;
|
|
|
|
break;
|
|
|
|
case 4:
|
2006-03-03 01:12:50 +00:00
|
|
|
((uint32_t *)&global_settings)[p_run->settings_offset/4] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned int)value;
|
|
|
|
break;
|
|
|
|
default:
|
2006-03-03 01:12:50 +00:00
|
|
|
DEBUGF( "load_bit_table: illegal size!\n" );
|
2004-06-18 20:41:59 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2002-07-15 11:02:12 +00:00
|
|
|
* load settings from disk or RTC RAM
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2004-06-19 15:50:02 +00:00
|
|
|
void settings_load(int which)
|
2002-06-27 00:20:00 +00:00
|
|
|
{
|
2006-02-02 20:42:56 +00:00
|
|
|
int i;
|
2002-06-27 00:20:00 +00:00
|
|
|
DEBUGF( "reload_all_settings()\n" );
|
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
/* load the buffer from the RTC (resets it to all-unused if the block
|
|
|
|
is invalid) and decode the settings which are set in the block */
|
2005-11-04 07:18:36 +00:00
|
|
|
if (!load_config_buffer(which))
|
2004-06-18 20:41:59 +00:00
|
|
|
{
|
|
|
|
/* load scalar values from RTC and HD sector, specified via table */
|
2004-06-19 15:50:02 +00:00
|
|
|
if (which & SETTINGS_RTC)
|
|
|
|
{
|
|
|
|
load_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8);
|
|
|
|
}
|
|
|
|
if (which & SETTINGS_HD)
|
|
|
|
{
|
2005-07-28 08:36:24 +00:00
|
|
|
load_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]),
|
2004-06-19 15:50:02 +00:00
|
|
|
RTC_BLOCK_SIZE*8);
|
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2006-07-31 19:13:21 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2004-06-18 20:41:59 +00:00
|
|
|
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
2006-07-25 07:19:35 +00:00
|
|
|
global_settings.contrast = lcd_default_contrast();
|
2006-07-25 11:15:50 +00:00
|
|
|
#endif
|
2003-05-09 16:01:21 +00:00
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
i = 0xb8;
|
|
|
|
strncpy((char *)global_settings.wps_file, (char *)&config_block[i],
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
|
|
|
strncpy((char *)global_settings.lang_file, (char *)&config_block[i],
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
|
|
|
strncpy((char *)global_settings.font_file, (char *)&config_block[i],
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2006-02-02 20:42:56 +00:00
|
|
|
strncpy((char *)global_settings.rwps_file, (char *)&config_block[i],
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
|
|
|
#endif
|
2006-04-02 12:23:08 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
strncpy((char *)global_settings.fmr_file, (char *)&config_block[i],
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
|
|
|
#endif
|
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i],
|
2005-12-05 22:44:42 +00:00
|
|
|
MAX_FILENAME);
|
2006-02-02 20:42:56 +00:00
|
|
|
i+= MAX_FILENAME;
|
2006-03-29 16:21:42 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
strncpy((char *)global_settings.kbd_file, (char *)&config_block[i],
|
|
|
|
MAX_FILENAME);
|
|
|
|
i+= MAX_FILENAME;
|
2005-11-17 20:14:59 +00:00
|
|
|
#endif
|
2004-06-19 15:50:02 +00:00
|
|
|
}
|
2002-06-27 00:20:00 +00:00
|
|
|
}
|
|
|
|
|
2003-02-17 09:53:11 +00:00
|
|
|
void set_file(char* filename, char* setting, int maxlen)
|
|
|
|
{
|
|
|
|
char* fptr = strrchr(filename,'/');
|
|
|
|
int len;
|
|
|
|
int extlen = 0;
|
|
|
|
char* ptr;
|
|
|
|
|
|
|
|
if (!fptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
*fptr = 0;
|
|
|
|
fptr++;
|
|
|
|
|
|
|
|
len = strlen(fptr);
|
|
|
|
ptr = fptr + len;
|
2006-04-25 00:14:21 +00:00
|
|
|
while ((*ptr != '.') && (ptr != fptr)) {
|
2003-02-17 09:53:11 +00:00
|
|
|
extlen++;
|
|
|
|
ptr--;
|
|
|
|
}
|
2006-04-25 00:14:21 +00:00
|
|
|
if(ptr == fptr) extlen = 0;
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-09-05 16:43:31 +00:00
|
|
|
if (strncasecmp(ROCKBOX_DIR, filename ,strlen(ROCKBOX_DIR)) ||
|
2004-01-08 12:40:25 +00:00
|
|
|
(len-extlen > maxlen))
|
2003-02-17 09:53:11 +00:00
|
|
|
return;
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2003-02-17 09:53:11 +00:00
|
|
|
strncpy(setting, fptr, len-extlen);
|
|
|
|
setting[len-extlen]=0;
|
|
|
|
|
|
|
|
settings_save();
|
|
|
|
}
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* helper to sort a .cfg file entry into a global_settings member,
|
2005-11-04 07:18:36 +00:00
|
|
|
as described per table. Returns the position if found, else 0. */
|
2004-06-18 20:41:59 +00:00
|
|
|
static int load_cfg_table(
|
|
|
|
const struct bit_entry* p_table, /* the table which describes the entries */
|
|
|
|
int count, /* number of entries in the table, including the first */
|
2004-08-18 01:09:31 +00:00
|
|
|
const char* name, /* the item to be searched */
|
|
|
|
const char* value, /* the value which got loaded for that item */
|
2004-06-18 20:41:59 +00:00
|
|
|
int hint) /* position to start looking */
|
2002-10-02 16:33:26 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
int i = hint;
|
2002-10-02 16:33:26 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
do
|
2002-10-02 16:33:26 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
if (p_table[i].cfg_name != NULL && !strcasecmp(name, p_table[i].cfg_name))
|
|
|
|
{ /* found */
|
|
|
|
int val = 0;
|
|
|
|
if (p_table[i].cfg_val == NULL)
|
|
|
|
{ /* numerical value, just convert the string */
|
|
|
|
val = atoi(value);
|
|
|
|
}
|
2006-02-26 02:48:05 +00:00
|
|
|
#if HAVE_LCD_COLOR
|
|
|
|
else if (!strncasecmp(p_table[i].cfg_val,"rgb",4))
|
|
|
|
{
|
|
|
|
val = hex_to_rgb(value);
|
|
|
|
}
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
else
|
|
|
|
{ /* set of string values, find the index */
|
|
|
|
const char* item;
|
|
|
|
const char* run;
|
|
|
|
int len = strlen(value);
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
item = run = p_table[i].cfg_val;
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
/* count the length of the field */
|
|
|
|
while (*run != ',' && *run != '\0')
|
|
|
|
run++;
|
|
|
|
|
|
|
|
if (!strncasecmp(value, item, MAX(run-item, len)))
|
|
|
|
break; /* match, exit the search */
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
if (*run == '\0') /* reached the end of the choices */
|
|
|
|
return i; /* return the position, but don't update */
|
|
|
|
|
|
|
|
val++; /* count the item up */
|
|
|
|
run++; /* behind the ',' */
|
|
|
|
item = run;
|
|
|
|
}
|
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* could do a memcpy, but that would be endian-dependent */
|
|
|
|
switch(p_table[i].byte_size)
|
|
|
|
{
|
|
|
|
case 1:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned char*)&global_settings)[p_table[i].settings_offset] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned char)val;
|
|
|
|
break;
|
|
|
|
case 2:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned short*)&global_settings)[p_table[i].settings_offset/2] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned short)val;
|
|
|
|
break;
|
|
|
|
case 4:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned int*)&global_settings)[p_table[i].settings_offset/4] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned int)val;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUGF( "illegal size!" );
|
|
|
|
continue;
|
|
|
|
}
|
2003-02-14 14:14:55 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
return i; /* return the position */
|
|
|
|
}
|
2003-02-14 14:14:55 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
i++;
|
|
|
|
if (i==count)
|
|
|
|
i=1; /* wraparound */
|
|
|
|
} while (i != hint); /* back where we started, all searched */
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
return 0; /* indicate not found */
|
2003-02-14 14:14:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
bool settings_load_config(const char* file)
|
2002-09-05 01:20:10 +00:00
|
|
|
{
|
|
|
|
int fd;
|
2002-10-02 16:33:26 +00:00
|
|
|
char line[128];
|
2002-09-05 16:30:07 +00:00
|
|
|
|
2002-09-05 01:20:10 +00:00
|
|
|
fd = open(file, O_RDONLY);
|
2003-04-11 07:47:30 +00:00
|
|
|
if (fd < 0)
|
2002-10-02 16:33:26 +00:00
|
|
|
return false;
|
|
|
|
|
2002-10-29 12:16:36 +00:00
|
|
|
while (read_line(fd, line, sizeof line) > 0)
|
2002-09-05 01:20:10 +00:00
|
|
|
{
|
2002-10-02 16:33:26 +00:00
|
|
|
char* name;
|
|
|
|
char* value;
|
2004-06-18 20:41:59 +00:00
|
|
|
const struct bit_entry* table[2] = { rtc_bits, hd_bits };
|
2005-11-04 07:18:36 +00:00
|
|
|
const int ta_size[2] = {
|
|
|
|
sizeof(rtc_bits)/sizeof(rtc_bits[0]),
|
2004-06-18 20:41:59 +00:00
|
|
|
sizeof(hd_bits)/sizeof(hd_bits[0])
|
|
|
|
};
|
|
|
|
int last_table = 0; /* which table was used last round */
|
|
|
|
int last_pos = 1; /* at which position did we succeed */
|
|
|
|
int pos; /* currently returned position */
|
2002-10-02 16:33:26 +00:00
|
|
|
|
|
|
|
if (!settings_parseline(line, &name, &value))
|
|
|
|
continue;
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* check for the string values */
|
|
|
|
if (!strcasecmp(name, "wps")) {
|
2006-05-21 11:00:02 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
unload_wps_backdrop();
|
|
|
|
#endif
|
2005-12-09 01:11:14 +00:00
|
|
|
if (wps_data_load(gui_wps[0].data, value, true))
|
2005-12-05 22:44:42 +00:00
|
|
|
set_file(value, (char *)global_settings.wps_file, MAX_FILENAME);
|
2003-02-17 09:53:11 +00:00
|
|
|
}
|
2005-12-04 12:11:08 +00:00
|
|
|
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
|
2005-11-17 20:14:59 +00:00
|
|
|
else if (!strcasecmp(name, "rwps")) {
|
2005-12-09 01:11:14 +00:00
|
|
|
if (wps_data_load(gui_wps[1].data, value, true))
|
2005-12-05 22:44:42 +00:00
|
|
|
set_file(value, (char *)global_settings.rwps_file, MAX_FILENAME);
|
2005-11-17 20:14:59 +00:00
|
|
|
}
|
|
|
|
#endif
|
2003-02-17 09:53:11 +00:00
|
|
|
else if (!strcasecmp(name, "lang")) {
|
|
|
|
if (!lang_load(value))
|
2004-04-06 07:06:59 +00:00
|
|
|
{
|
2005-12-05 22:44:42 +00:00
|
|
|
set_file(value, (char *)global_settings.lang_file, MAX_FILENAME);
|
2004-04-06 07:06:59 +00:00
|
|
|
talk_init(); /* use voice of same language */
|
|
|
|
}
|
2003-02-17 09:53:11 +00:00
|
|
|
}
|
2006-04-02 12:23:08 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
else if (!strcasecmp(name, "fmr")) {
|
|
|
|
set_file(value, global_settings.fmr_file, MAX_FILENAME);
|
|
|
|
}
|
|
|
|
#endif
|
2003-02-14 14:14:55 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-02-23 18:54:28 +00:00
|
|
|
else if (!strcasecmp(name, "font")) {
|
2003-02-24 23:47:21 +00:00
|
|
|
if (font_load(value))
|
2005-12-05 22:44:42 +00:00
|
|
|
set_file(value, (char *)global_settings.font_file, MAX_FILENAME);
|
2003-02-23 18:54:28 +00:00
|
|
|
}
|
2002-10-02 16:33:26 +00:00
|
|
|
#endif
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
else if (!strcasecmp(name, "backdrop")) {
|
2006-05-21 11:00:02 +00:00
|
|
|
if (load_main_backdrop(value)) {
|
2006-02-02 20:42:56 +00:00
|
|
|
set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME);
|
2006-05-21 11:00:02 +00:00
|
|
|
show_main_backdrop();
|
|
|
|
}
|
2006-02-02 20:42:56 +00:00
|
|
|
}
|
|
|
|
#endif
|
2006-03-29 16:21:42 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
else if (!strcasecmp(name, "keyboard")) {
|
|
|
|
if (!load_kbd(value))
|
|
|
|
set_file(value, (char *)global_settings.kbd_file, MAX_FILENAME);
|
|
|
|
}
|
|
|
|
#endif
|
2006-02-02 20:42:56 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
/* check for scalar values, using the two tables */
|
2005-11-04 07:18:36 +00:00
|
|
|
pos = load_cfg_table(table[last_table], ta_size[last_table],
|
2004-06-18 20:41:59 +00:00
|
|
|
name, value, last_pos);
|
|
|
|
if (pos) /* success */
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
last_pos = pos; /* remember as a position hint for next round */
|
|
|
|
continue;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
last_table = 1-last_table; /* try other table */
|
|
|
|
last_pos = 1; /* search from start */
|
|
|
|
pos = load_cfg_table(table[last_table], ta_size[last_table],
|
|
|
|
name, value, last_pos);
|
|
|
|
if (pos) /* success */
|
2004-01-26 17:05:21 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
last_pos = pos; /* remember as a position hint for next round */
|
|
|
|
continue;
|
2004-01-26 17:05:21 +00:00
|
|
|
}
|
2004-06-18 20:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close(fd);
|
|
|
|
settings_apply();
|
|
|
|
settings_save();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* helper to save content of global_settings into a file,
|
2005-11-04 07:18:36 +00:00
|
|
|
as described per table */
|
2004-06-18 20:41:59 +00:00
|
|
|
static void save_cfg_table(const struct bit_entry* p_table, int count, int fd)
|
|
|
|
{
|
|
|
|
long value; /* 32 bit content */
|
|
|
|
int i;
|
|
|
|
const struct bit_entry* p_run = p_table; /* start after the size info */
|
|
|
|
count--; /* first is excluded from loop */
|
|
|
|
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
p_run++;
|
|
|
|
|
|
|
|
if (p_run->cfg_name == NULL)
|
|
|
|
continue; /* this value is not to be saved */
|
|
|
|
|
|
|
|
/* could do a memcpy, but that would be endian-dependent */
|
|
|
|
switch(p_run->byte_size)
|
2004-03-27 00:11:01 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
case 1:
|
|
|
|
if (p_run->bit_size & SIGNED) /* signed? */
|
|
|
|
value = ((char*)&global_settings)[p_run->settings_offset];
|
|
|
|
else
|
|
|
|
value = ((unsigned char*)&global_settings)[p_run->settings_offset];
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (p_run->bit_size & SIGNED) /* signed? */
|
|
|
|
value = ((short*)&global_settings)[p_run->settings_offset/2];
|
|
|
|
else
|
|
|
|
value = ((unsigned short*)&global_settings)[p_run->settings_offset/2];
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
value = ((unsigned int*)&global_settings)[p_run->settings_offset/4];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUGF( "illegal size!" );
|
|
|
|
continue;
|
2004-03-27 00:11:01 +00:00
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
if (p_run->cfg_val == NULL) /* write as number */
|
2004-03-27 00:11:01 +00:00
|
|
|
{
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value);
|
2004-03-27 00:11:01 +00:00
|
|
|
}
|
2006-02-26 02:48:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
else if (!strcasecmp(p_run->cfg_val, "rgb"))
|
|
|
|
{
|
2006-03-30 05:56:19 +00:00
|
|
|
fdprintf(fd, "%s: %02x%02x%02x\r\n", p_run->cfg_name,
|
2006-02-26 02:48:05 +00:00
|
|
|
(int)RGB_UNPACK_RED(value),
|
|
|
|
(int)RGB_UNPACK_GREEN(value),
|
|
|
|
(int)RGB_UNPACK_BLUE(value));
|
|
|
|
}
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
else /* write as item */
|
2004-03-27 00:11:01 +00:00
|
|
|
{
|
2004-06-18 20:41:59 +00:00
|
|
|
const char* p = p_run->cfg_val;
|
|
|
|
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf(fd, "%s: ", p_run->cfg_name);
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
while(value >= 0)
|
|
|
|
{
|
|
|
|
char c = *p++; /* currently processed char */
|
|
|
|
if (c == ',') /* separator */
|
|
|
|
value--;
|
|
|
|
else if (c == '\0') /* end of string */
|
|
|
|
break; /* not found */
|
|
|
|
else if (value == 0) /* the right place */
|
|
|
|
write(fd, &c, 1); /* char by char, this is lame, OK */
|
|
|
|
}
|
|
|
|
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf(fd, "\r\n");
|
2004-06-23 08:12:19 +00:00
|
|
|
if (p_run->cfg_val != off_on) /* explaination for non-bool */
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val);
|
2004-03-27 00:11:01 +00:00
|
|
|
}
|
2002-09-05 01:20:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-10 16:31:02 +00:00
|
|
|
|
|
|
|
bool settings_save_config(void)
|
|
|
|
{
|
2005-09-02 01:15:35 +00:00
|
|
|
int fd;
|
2003-03-10 16:31:02 +00:00
|
|
|
char filename[MAX_PATH];
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2005-09-02 01:15:35 +00:00
|
|
|
create_numbered_filename(filename, ROCKBOX_DIR, "config", ".cfg", 2);
|
2003-03-10 16:31:02 +00:00
|
|
|
|
|
|
|
/* allow user to modify filename */
|
2005-09-02 01:15:35 +00:00
|
|
|
while (true) {
|
2003-03-10 16:31:02 +00:00
|
|
|
if (!kbd_input(filename, sizeof filename)) {
|
2006-05-30 11:26:41 +00:00
|
|
|
fd = creat(filename, O_WRONLY);
|
2005-11-04 17:25:29 +00:00
|
|
|
if (fd < 0)
|
|
|
|
gui_syncsplash(HZ, true, str(LANG_FAILED));
|
2003-03-10 16:31:02 +00:00
|
|
|
else
|
2005-09-02 01:15:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else {
|
2006-02-19 12:45:32 +00:00
|
|
|
gui_syncsplash(HZ, true, str(LANG_MENU_SETTING_CANCEL));
|
2005-09-02 01:15:35 +00:00
|
|
|
return false;
|
2003-03-10 16:31:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-02 01:15:35 +00:00
|
|
|
fdprintf(fd, "# .cfg file created by rockbox %s - "
|
2006-04-02 12:23:08 +00:00
|
|
|
"http://www.rockbox.org\r\n#\r\n#\r\n# wps / rwps / language"
|
|
|
|
" / font / fmpreset / backdrop \r\n#\r\n", appsversion);
|
2006-04-15 13:07:21 +00:00
|
|
|
|
2003-04-24 17:53:17 +00:00
|
|
|
if (global_settings.wps_file[0] != 0)
|
2005-11-12 21:48:06 +00:00
|
|
|
fdprintf(fd, "wps: %s/%s.wps\r\n", WPS_DIR,
|
2005-09-02 01:15:35 +00:00
|
|
|
global_settings.wps_file);
|
2003-03-10 16:31:02 +00:00
|
|
|
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
if (global_settings.rwps_file[0] != 0)
|
|
|
|
fdprintf(fd, "rwps: %s/%s.rwps\r\n", WPS_DIR,
|
|
|
|
global_settings.rwps_file);
|
|
|
|
#endif
|
|
|
|
|
2003-04-24 17:53:17 +00:00
|
|
|
if (global_settings.lang_file[0] != 0)
|
2005-09-02 01:15:35 +00:00
|
|
|
fdprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR,
|
|
|
|
global_settings.lang_file);
|
2003-03-10 16:31:02 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-04-24 17:53:17 +00:00
|
|
|
if (global_settings.font_file[0] != 0)
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR,
|
2005-09-02 01:15:35 +00:00
|
|
|
global_settings.font_file);
|
2003-03-10 16:31:02 +00:00
|
|
|
#endif
|
|
|
|
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
if (global_settings.backdrop_file[0] != 0)
|
|
|
|
fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR,
|
|
|
|
global_settings.backdrop_file);
|
|
|
|
#endif
|
|
|
|
|
2006-04-02 12:23:08 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
if (global_settings.fmr_file[0] != 0)
|
|
|
|
fdprintf(fd, "fmr: %s/%s.fmr\r\n", FMPRESET_PATH,
|
|
|
|
global_settings.fmr_file);
|
|
|
|
#endif
|
|
|
|
|
2006-03-29 16:21:42 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
if (global_settings.kbd_file[0] != 0)
|
|
|
|
fdprintf(fd, "keyboard: %s/%s.kbd\r\n", ROCKBOX_DIR,
|
|
|
|
global_settings.kbd_file);
|
|
|
|
#endif
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* here's the action: write values to file, specified via table */
|
|
|
|
save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd);
|
|
|
|
save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd);
|
|
|
|
|
2003-03-10 16:31:02 +00:00
|
|
|
close(fd);
|
|
|
|
|
2006-04-01 13:36:33 +00:00
|
|
|
gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED));
|
2003-03-10 16:31:02 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
|
|
|
|
/* helper to load defaults from table into global_settings members */
|
|
|
|
static void default_table(const struct bit_entry* p_table, int count)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i=1; i<count; i++) /* exclude the first, the size placeholder */
|
|
|
|
{
|
|
|
|
/* could do a memcpy, but that would be endian-dependent */
|
|
|
|
switch(p_table[i].byte_size)
|
|
|
|
{
|
|
|
|
case 1:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned char*)&global_settings)[p_table[i].settings_offset] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned char)p_table[i].default_val;
|
|
|
|
break;
|
|
|
|
case 2:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned short*)&global_settings)[p_table[i].settings_offset/2] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned short)p_table[i].default_val;
|
|
|
|
break;
|
|
|
|
case 4:
|
2005-11-04 07:18:36 +00:00
|
|
|
((unsigned int*)&global_settings)[p_table[i].settings_offset/4] =
|
2004-06-18 20:41:59 +00:00
|
|
|
(unsigned int)p_table[i].default_val;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUGF( "illegal size!" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
/*
|
2005-11-04 07:18:36 +00:00
|
|
|
* reset all settings to their default value
|
2002-06-27 00:20:00 +00:00
|
|
|
*/
|
2002-07-15 11:02:12 +00:00
|
|
|
void settings_reset(void) {
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2002-07-15 11:02:12 +00:00
|
|
|
DEBUGF( "settings_reset()\n" );
|
|
|
|
|
2004-06-18 20:41:59 +00:00
|
|
|
/* read defaults from table(s) into global_settings */
|
|
|
|
default_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]));
|
|
|
|
default_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]));
|
|
|
|
|
|
|
|
/* do some special cases not covered by table */
|
2005-04-01 13:41:03 +00:00
|
|
|
global_settings.volume = sound_default(SOUND_VOLUME);
|
|
|
|
global_settings.balance = sound_default(SOUND_BALANCE);
|
|
|
|
global_settings.bass = sound_default(SOUND_BASS);
|
|
|
|
global_settings.treble = sound_default(SOUND_TREBLE);
|
|
|
|
global_settings.channel_config = sound_default(SOUND_CHANNELS);
|
|
|
|
global_settings.stereo_width = sound_default(SOUND_STEREO_WIDTH);
|
2005-11-06 23:12:11 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
|
|
global_settings.loudness = sound_default(SOUND_LOUDNESS);
|
|
|
|
global_settings.avc = sound_default(SOUND_AVC);
|
2005-04-01 13:41:03 +00:00
|
|
|
global_settings.mdb_strength = sound_default(SOUND_MDB_STRENGTH);
|
|
|
|
global_settings.mdb_harmonics = sound_default(SOUND_MDB_HARMONICS);
|
|
|
|
global_settings.mdb_center = sound_default(SOUND_MDB_CENTER);
|
|
|
|
global_settings.mdb_shape = sound_default(SOUND_MDB_SHAPE);
|
|
|
|
global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE);
|
|
|
|
global_settings.superbass = sound_default(SOUND_SUPERBASS);
|
2005-11-06 23:12:11 +00:00
|
|
|
#endif
|
2006-07-31 19:13:21 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2006-07-25 07:19:35 +00:00
|
|
|
global_settings.contrast = lcd_default_contrast();
|
2006-07-25 11:15:50 +00:00
|
|
|
#endif
|
2006-05-18 11:12:54 +00:00
|
|
|
#ifdef HAVE_LCD_REMOTE
|
|
|
|
global_settings.remote_contrast = lcd_remote_default_contrast();
|
|
|
|
#endif
|
2006-04-15 13:07:21 +00:00
|
|
|
|
2006-04-02 12:23:08 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
global_settings.fmr_file[0] = '\0';
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
global_settings.wps_file[0] = '\0';
|
2005-11-17 20:14:59 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
global_settings.rwps_file[0] = '\0';
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
global_settings.font_file[0] = '\0';
|
|
|
|
global_settings.lang_file[0] = '\0';
|
2006-02-02 20:42:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
global_settings.backdrop_file[0] = '\0';
|
2006-03-30 05:56:19 +00:00
|
|
|
|
2006-02-26 02:48:05 +00:00
|
|
|
global_settings.fg_color = LCD_DEFAULT_FG;
|
|
|
|
global_settings.bg_color = LCD_DEFAULT_BG;
|
2006-02-02 20:42:56 +00:00
|
|
|
#endif
|
2006-03-29 16:21:42 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
global_settings.kbd_file[0] = '\0';
|
|
|
|
#endif
|
2004-06-18 20:41:59 +00:00
|
|
|
|
2002-06-27 00:20:00 +00:00
|
|
|
}
|
2002-06-27 01:08:11 +00:00
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
bool set_bool(const char* string, bool* variable )
|
2002-06-27 01:08:11 +00:00
|
|
|
{
|
2005-10-16 11:15:51 +00:00
|
|
|
return set_bool_options(string, variable,
|
2005-12-05 22:44:42 +00:00
|
|
|
(char *)STR(LANG_SET_BOOL_YES),
|
|
|
|
(char *)STR(LANG_SET_BOOL_NO),
|
|
|
|
NULL);
|
2003-06-05 11:11:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* wrapper to convert from int param to bool param in set_option */
|
|
|
|
static void (*boolfunction)(bool);
|
|
|
|
void bool_funcwrapper(int value)
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
boolfunction(true);
|
|
|
|
else
|
|
|
|
boolfunction(false);
|
2002-09-05 04:42:12 +00:00
|
|
|
}
|
2002-08-20 19:37:00 +00:00
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
bool set_bool_options(const char* string, bool* variable,
|
|
|
|
const char* yes_str, int yes_voice,
|
|
|
|
const char* no_str, int no_voice,
|
2004-03-15 08:27:51 +00:00
|
|
|
void (*function)(bool))
|
2002-09-05 04:42:12 +00:00
|
|
|
{
|
2005-12-05 22:44:42 +00:00
|
|
|
struct opt_items names[] = {
|
|
|
|
{(unsigned char *)no_str, no_voice},
|
|
|
|
{(unsigned char *)yes_str, yes_voice}
|
|
|
|
};
|
2002-09-24 17:22:12 +00:00
|
|
|
bool result;
|
|
|
|
|
2003-06-05 11:11:10 +00:00
|
|
|
boolfunction = function;
|
2005-11-04 07:18:36 +00:00
|
|
|
result = set_option(string, variable, BOOL, names, 2,
|
2003-06-05 11:11:10 +00:00
|
|
|
function ? bool_funcwrapper : NULL);
|
2002-09-24 17:22:12 +00:00
|
|
|
return result;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
|
|
|
|
2005-11-05 02:19:21 +00:00
|
|
|
void talk_unit(int unit, int value)
|
|
|
|
{
|
|
|
|
if (global_settings.talk_menu)
|
|
|
|
{
|
|
|
|
if (unit < UNIT_LAST)
|
|
|
|
{ /* use the available unit definition */
|
|
|
|
talk_value(value, unit, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* say the number, followed by an arbitrary voice ID */
|
|
|
|
talk_number(value, false);
|
|
|
|
talk_id(unit, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-05 22:44:42 +00:00
|
|
|
bool set_int(const unsigned char* string,
|
2004-08-18 01:09:31 +00:00
|
|
|
const char* unit,
|
2004-03-20 16:49:58 +00:00
|
|
|
int voice_unit,
|
2002-06-27 01:08:11 +00:00
|
|
|
int* variable,
|
|
|
|
void (*function)(int),
|
|
|
|
int step,
|
|
|
|
int min,
|
2005-08-11 18:56:20 +00:00
|
|
|
int max,
|
|
|
|
void (*formatter)(char*, int, int, const char*) )
|
2002-06-27 01:08:11 +00:00
|
|
|
{
|
2002-09-19 09:00:25 +00:00
|
|
|
int button;
|
2005-11-04 07:18:36 +00:00
|
|
|
int oldvalue=*variable;
|
|
|
|
struct gui_select select;
|
2005-12-05 22:44:42 +00:00
|
|
|
gui_select_init_numeric(&select, (char *)string, *variable, min, max, step, unit,
|
|
|
|
formatter);
|
2005-11-04 07:18:36 +00:00
|
|
|
gui_syncselect_draw(&select);
|
2005-11-05 02:19:21 +00:00
|
|
|
talk_unit(voice_unit, *variable);
|
2005-12-05 23:37:14 +00:00
|
|
|
while (!select.validated)
|
2005-11-04 07:18:36 +00:00
|
|
|
{
|
|
|
|
button = button_get_w_tmo(HZ/2);
|
|
|
|
if(gui_syncselect_do_button(&select, button))
|
2004-03-20 16:49:58 +00:00
|
|
|
{
|
2005-12-05 23:37:14 +00:00
|
|
|
*variable=select.options.option;
|
2005-11-04 16:07:50 +00:00
|
|
|
gui_syncselect_draw(&select);
|
2005-11-05 02:19:21 +00:00
|
|
|
talk_unit(voice_unit, *variable);
|
2005-11-04 07:18:36 +00:00
|
|
|
if ( function )
|
2005-11-06 03:18:34 +00:00
|
|
|
function(*variable);
|
2004-03-20 16:49:58 +00:00
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
gui_syncstatusbar_draw(&statusbars, false);
|
2005-12-05 23:37:14 +00:00
|
|
|
if(select.canceled)
|
2005-11-04 07:18:36 +00:00
|
|
|
{
|
|
|
|
*variable=oldvalue;
|
2005-11-06 03:18:34 +00:00
|
|
|
if ( function )
|
|
|
|
function(*variable);
|
2005-11-04 07:18:36 +00:00
|
|
|
return false;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return true;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
2002-09-24 17:22:12 +00:00
|
|
|
return false;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
|
|
|
|
2003-06-05 11:11:10 +00:00
|
|
|
/* NOTE: the 'type' parameter specifies the actual type of the variable
|
|
|
|
that 'variable' points to. not the value within. Only variables with
|
|
|
|
type 'bool' should use parameter BOOL.
|
|
|
|
|
2003-06-05 14:22:03 +00:00
|
|
|
The type separation is necessary since int and bool are fundamentally
|
2003-06-05 11:11:10 +00:00
|
|
|
different and bit-incompatible types and can not share the same access
|
|
|
|
code. */
|
|
|
|
|
2005-11-04 07:18:36 +00:00
|
|
|
#define set_type_fromint(type, dest, value) \
|
|
|
|
if (type == INT) \
|
|
|
|
*(int *)dest=value; \
|
|
|
|
else \
|
|
|
|
*(bool *)dest=value?true:false
|
|
|
|
|
2005-11-06 03:18:34 +00:00
|
|
|
#define type_fromvoidptr(type, value) \
|
|
|
|
(type == INT)? \
|
|
|
|
(int)(*(int*)(value)) \
|
|
|
|
: \
|
|
|
|
(bool)(*(bool*)(value))
|
|
|
|
|
|
|
|
#define get_int_fromtype(type, var) \
|
|
|
|
(type == INT)?*(int *)var:(*(bool *)var?1:0)
|
2005-11-04 07:18:36 +00:00
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
bool set_option(const char* string, void* variable, enum optiontype type,
|
2004-07-23 23:01:20 +00:00
|
|
|
const struct opt_items* options, int numoptions, void (*function)(int))
|
2002-06-27 01:08:11 +00:00
|
|
|
{
|
2002-09-19 09:00:25 +00:00
|
|
|
int button;
|
2005-11-04 07:18:36 +00:00
|
|
|
int oldvalue;
|
|
|
|
/* oldvalue=*variable; */
|
2005-11-06 03:18:34 +00:00
|
|
|
oldvalue=get_int_fromtype(type, variable);
|
2005-11-04 07:18:36 +00:00
|
|
|
struct gui_select select;
|
|
|
|
gui_select_init_items(&select, string, oldvalue, options, numoptions);
|
|
|
|
gui_syncselect_draw(&select);
|
2005-11-05 02:19:21 +00:00
|
|
|
if (global_settings.talk_menu)
|
2005-12-05 23:37:14 +00:00
|
|
|
talk_id(options[select.options.option].voice_id, true);
|
|
|
|
|
|
|
|
while ( !select.validated )
|
2005-11-04 07:18:36 +00:00
|
|
|
{
|
|
|
|
gui_syncstatusbar_draw(&statusbars, true);
|
2002-09-19 09:00:25 +00:00
|
|
|
button = button_get_w_tmo(HZ/2);
|
2005-12-07 15:37:21 +00:00
|
|
|
select.options.limit_loop = false;
|
2005-11-04 07:18:36 +00:00
|
|
|
if(gui_syncselect_do_button(&select, button))
|
|
|
|
{
|
|
|
|
/* *variable = gui_select_get_selected(&select) */
|
2005-12-05 23:37:14 +00:00
|
|
|
set_type_fromint(type, variable, select.options.option);
|
2005-11-04 07:18:36 +00:00
|
|
|
gui_syncselect_draw(&select);
|
|
|
|
if (global_settings.talk_menu)
|
2005-12-05 23:37:14 +00:00
|
|
|
talk_id(options[select.options.option].voice_id, false);
|
2005-11-04 07:18:36 +00:00
|
|
|
if ( function )
|
2005-11-06 03:18:34 +00:00
|
|
|
function(type_fromvoidptr(type, variable));
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
gui_syncstatusbar_draw(&statusbars, false);
|
2005-12-05 23:37:14 +00:00
|
|
|
if(select.canceled)
|
2005-11-04 07:18:36 +00:00
|
|
|
{
|
|
|
|
/* *variable=oldvalue; */
|
|
|
|
set_type_fromint(type, variable, oldvalue);
|
2005-11-06 03:18:34 +00:00
|
|
|
if ( function )
|
|
|
|
function(type_fromvoidptr(type, variable));
|
2005-11-04 07:18:36 +00:00
|
|
|
return false;
|
2003-06-05 11:11:10 +00:00
|
|
|
}
|
2005-11-04 07:18:36 +00:00
|
|
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return true;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
2002-09-24 17:22:12 +00:00
|
|
|
return false;
|
2002-06-27 01:08:11 +00:00
|
|
|
}
|
2002-08-09 12:38:45 +00:00
|
|
|
|
2005-02-02 21:52:55 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2003-11-20 00:33:43 +00:00
|
|
|
/* This array holds the record timer interval lengths, in seconds */
|
2004-08-01 21:50:57 +00:00
|
|
|
static const unsigned long rec_timer_seconds[] =
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
2005-06-04 12:14:46 +00:00
|
|
|
0, /* 0 means OFF */
|
2003-11-20 00:33:43 +00:00
|
|
|
5*60, /* 00:05 */
|
|
|
|
10*60, /* 00:10 */
|
|
|
|
15*60, /* 00:15 */
|
|
|
|
30*60, /* 00:30 */
|
|
|
|
60*60, /* 01:00 */
|
2004-10-27 09:24:02 +00:00
|
|
|
74*60, /* 74:00 */
|
|
|
|
80*60, /* 80:00 */
|
2003-11-20 00:33:43 +00:00
|
|
|
2*60*60, /* 02:00 */
|
|
|
|
4*60*60, /* 04:00 */
|
|
|
|
6*60*60, /* 06:00 */
|
|
|
|
8*60*60, /* 08:00 */
|
2005-02-11 18:41:40 +00:00
|
|
|
10L*60*60, /* 10:00 */
|
|
|
|
12L*60*60, /* 12:00 */
|
|
|
|
18L*60*60, /* 18:00 */
|
|
|
|
24L*60*60 /* 24:00 */
|
2003-11-20 00:33:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
unsigned int rec_timesplit_seconds(void)
|
|
|
|
{
|
|
|
|
return rec_timer_seconds[global_settings.rec_timesplit];
|
|
|
|
}
|
2005-04-04 09:12:12 +00:00
|
|
|
|
2006-07-22 17:23:05 +00:00
|
|
|
/* This array holds the record size interval lengths, in bytes */
|
|
|
|
static const unsigned long rec_size_bytes[] =
|
|
|
|
{
|
|
|
|
0, /* 0 means OFF */
|
|
|
|
5*1024*1024, /* 5MB */
|
|
|
|
10*1024*1024, /* 10MB */
|
|
|
|
15*1024*1024, /* 15MB */
|
|
|
|
32*1024*1024, /* 32MB */
|
|
|
|
64*1024*1024, /* 64MB */
|
|
|
|
75*1024*1024, /* 75MB */
|
|
|
|
100*1024*1024, /* 100MB */
|
|
|
|
128*1024*1024, /* 128MB */
|
|
|
|
256*1024*1024, /* 256MB */
|
|
|
|
512*1024*1024, /* 512MB */
|
|
|
|
650*1024*1024, /* 650MB */
|
|
|
|
700*1024*1024, /* 700MB */
|
|
|
|
1024*1024*1024, /* 1GB */
|
|
|
|
1536*1024*1024, /* 1.5GB */
|
|
|
|
1792*1024*1024, /* 1.75GB */
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned long rec_sizesplit_bytes(void)
|
|
|
|
{
|
|
|
|
return rec_size_bytes[global_settings.rec_sizesplit];
|
|
|
|
}
|
2005-04-04 09:12:12 +00:00
|
|
|
/*
|
|
|
|
* Time strings used for the trigger durations.
|
|
|
|
* Keep synchronous to trigger_times in settings_apply_trigger
|
|
|
|
*/
|
2005-08-18 07:02:03 +00:00
|
|
|
const char * const trig_durations[TRIG_DURATION_COUNT] =
|
2005-04-04 09:12:12 +00:00
|
|
|
{
|
|
|
|
"0s", "1s", "2s", "5s",
|
|
|
|
"10s", "15s", "20s", "25s", "30s",
|
|
|
|
"1min", "2min", "5min", "10min"
|
|
|
|
};
|
|
|
|
|
|
|
|
void settings_apply_trigger(void)
|
|
|
|
{
|
|
|
|
/* Keep synchronous to trig_durations and trig_durations_conf*/
|
|
|
|
static const long trigger_times[TRIG_DURATION_COUNT] = {
|
|
|
|
0, HZ, 2*HZ, 5*HZ,
|
|
|
|
10*HZ, 15*HZ, 20*HZ, 25*HZ, 30*HZ,
|
|
|
|
60*HZ, 2*60*HZ, 5*60*HZ, 10*60*HZ
|
|
|
|
};
|
|
|
|
|
|
|
|
peak_meter_define_trigger(
|
|
|
|
global_settings.rec_start_thres,
|
|
|
|
trigger_times[global_settings.rec_start_duration],
|
|
|
|
MIN(trigger_times[global_settings.rec_start_duration] / 2, 2*HZ),
|
|
|
|
global_settings.rec_stop_thres,
|
|
|
|
trigger_times[global_settings.rec_stop_postrec],
|
|
|
|
trigger_times[global_settings.rec_stop_gap]
|
|
|
|
);
|
|
|
|
}
|
2003-11-20 00:33:43 +00:00
|
|
|
#endif
|