summaryrefslogtreecommitdiff
path: root/apps/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/main.c')
-rw-r--r--apps/main.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/apps/main.c b/apps/main.c
index b725d0252f..907e1126cf 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -65,6 +65,7 @@
65#include "lang.h" 65#include "lang.h"
66#include "string.h" 66#include "string.h"
67#include "splash.h" 67#include "splash.h"
68#include "eeprom_settings.h"
68 69
69#if (CONFIG_CODEC == SWCODEC) 70#if (CONFIG_CODEC == SWCODEC)
70#include "playback.h" 71#include "playback.h"
@@ -108,35 +109,30 @@ void app_main(void)
108 browse_root(); 109 browse_root();
109} 110}
110 111
111#ifdef HAVE_DIRCACHE 112int init_dircache(void)
112void init_dircache(void)
113{ 113{
114 int result; 114#ifdef HAVE_DIRCACHE
115 bool clear = false; 115 int result = 0;
116 116
117 dircache_init(); 117 dircache_init();
118 if (global_settings.dircache) 118 if (global_settings.dircache)
119 { 119 {
120 if (global_settings.dircache_size == 0) 120# ifdef HAVE_EEPROM
121 if (firmware_settings.initialized && firmware_settings.disk_clean)
121 { 122 {
122 gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING)); 123 if (dircache_load(DIRCACHE_FILE) == 0)
123 clear = true; 124 return 0;
124 } 125 }
126# endif
125 127
126 result = dircache_build(global_settings.dircache_size); 128 result = dircache_build(global_settings.dircache_size);
127 if (result < 0)
128 gui_syncsplash(0, true, "Failed! Result: %d", result);
129
130 if (clear)
131 {
132 backlight_on();
133 show_logo();
134 }
135 } 129 }
136} 130
131 return result;
137#else 132#else
138# define init_dircache(...) 133 return 0;
139#endif 134#endif
135}
140 136
141void init_tagcache(void) 137void init_tagcache(void)
142{ 138{
@@ -376,6 +372,10 @@ void init(void)
376 } 372 }
377 } 373 }
378 374
375#ifdef HAVE_EEPROM
376 eeprom_settings_init();
377#endif
378
379 settings_calc_config_sector(); 379 settings_calc_config_sector();
380 380
381#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) 381#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD)
@@ -395,11 +395,21 @@ void init(void)
395 settings_load(SETTINGS_ALL); 395 settings_load(SETTINGS_ALL);
396 396
397 397
398 init_dircache();
399
398 gui_sync_wps_init(); 400 gui_sync_wps_init();
399 settings_apply(); 401 settings_apply();
400 init_dircache(); 402 //init_dircache();
401 init_tagcache(); 403 init_tagcache();
402 404
405#ifdef HAVE_EEPROM
406 if (firmware_settings.initialized)
407 {
408 /* In case we crash. */
409 firmware_settings.disk_clean = false;
410 eeprom_settings_store();
411 }
412#endif
403 status_init(); 413 status_init();
404 playlist_init(); 414 playlist_init();
405 tree_init(); 415 tree_init();