diff options
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 260 |
1 files changed, 0 insertions, 260 deletions
diff --git a/apps/screens.c b/apps/screens.c index e7262704f0..52e8cadc7e 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -56,230 +56,8 @@ | |||
56 | #include "language.h" | 56 | #include "language.h" |
57 | #include "replaygain.h" | 57 | #include "replaygain.h" |
58 | 58 | ||
59 | #if defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2) | ||
60 | #include "adc.h" | ||
61 | #endif | ||
62 | |||
63 | #if (CONFIG_STORAGE & STORAGE_MMC) && (defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM)) | ||
64 | int mmc_remove_request(void) | ||
65 | { | ||
66 | struct queue_event ev; | ||
67 | FOR_NB_SCREENS(i) | ||
68 | screens[i].clear_display(); | ||
69 | splash(0, ID2P(LANG_REMOVE_MMC)); | ||
70 | |||
71 | while (1) | ||
72 | { | ||
73 | queue_wait_w_tmo(&button_queue, &ev, HZ/2); | ||
74 | switch (ev.id) | ||
75 | { | ||
76 | case SYS_HOTSWAP_EXTRACTED: | ||
77 | return SYS_HOTSWAP_EXTRACTED; | ||
78 | |||
79 | case SYS_USB_DISCONNECTED: | ||
80 | return SYS_USB_DISCONNECTED; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | #endif | ||
85 | #include "ctype.h" | 59 | #include "ctype.h" |
86 | 60 | ||
87 | /* the charging screen is only used for archos targets */ | ||
88 | #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) && defined(CPU_SH) | ||
89 | |||
90 | #ifdef HAVE_LCD_BITMAP | ||
91 | static void charging_display_info(bool animate) | ||
92 | { | ||
93 | unsigned char charging_logo[36]; | ||
94 | const int pox_x = (LCD_WIDTH - sizeof(charging_logo)) / 2; | ||
95 | const int pox_y = 32; | ||
96 | static unsigned phase = 3; | ||
97 | unsigned i; | ||
98 | |||
99 | #if !defined(NEED_ATA_POWER_BATT_MEASURE) | ||
100 | { | ||
101 | int battv = battery_voltage(); | ||
102 | lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000, | ||
103 | (battv % 1000) / 10, battery_level()); | ||
104 | } | ||
105 | #elif defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2) | ||
106 | /* IDE power is normally off here, so display input current instead */ | ||
107 | lcd_putsf(7, 7, "%dmA ", | ||
108 | (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 10000); | ||
109 | #endif | ||
110 | |||
111 | #ifdef ARCHOS_RECORDER | ||
112 | lcd_puts(0, 2, "Charge mode:"); | ||
113 | |||
114 | const char *s; | ||
115 | if (charge_state == CHARGING) | ||
116 | s = str(LANG_BATTERY_CHARGE); | ||
117 | else if (charge_state == TOPOFF) | ||
118 | s = str(LANG_BATTERY_TOPOFF_CHARGE); | ||
119 | else if (charge_state == TRICKLE) | ||
120 | s = str(LANG_BATTERY_TRICKLE_CHARGE); | ||
121 | else | ||
122 | s = "not charging"; | ||
123 | |||
124 | lcd_puts(0, 3, s); | ||
125 | if (!charger_enabled()) | ||
126 | animate = false; | ||
127 | #endif /* ARCHOS_RECORDER */ | ||
128 | |||
129 | /* middle part */ | ||
130 | memset(charging_logo+3, 0x00, 32); | ||
131 | charging_logo[0] = 0x3C; | ||
132 | charging_logo[1] = 0x24; | ||
133 | charging_logo[2] = charging_logo[35] = 0xFF; | ||
134 | |||
135 | if (!animate) | ||
136 | { /* draw the outline */ | ||
137 | /* middle part */ | ||
138 | lcd_mono_bitmap(charging_logo, pox_x, pox_y + 8, | ||
139 | sizeof(charging_logo), 8); | ||
140 | lcd_set_drawmode(DRMODE_FG); | ||
141 | /* upper line */ | ||
142 | charging_logo[0] = charging_logo[1] = 0x00; | ||
143 | memset(charging_logo+2, 0x80, 34); | ||
144 | lcd_mono_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8); | ||
145 | /* lower line */ | ||
146 | memset(charging_logo+2, 0x01, 34); | ||
147 | lcd_mono_bitmap(charging_logo, pox_x, pox_y + 16, | ||
148 | sizeof(charging_logo), 8); | ||
149 | lcd_set_drawmode(DRMODE_SOLID); | ||
150 | } | ||
151 | else | ||
152 | { /* animate the middle part */ | ||
153 | for (i = 3; i<MIN(sizeof(charging_logo)-1, phase); i++) | ||
154 | { | ||
155 | if ((i-phase) % 8 == 0) | ||
156 | { /* draw a "bubble" here */ | ||
157 | unsigned bitpos; | ||
158 | bitpos = (phase + i/8) % 15; /* "bounce" effect */ | ||
159 | if (bitpos > 7) | ||
160 | bitpos = 14 - bitpos; | ||
161 | charging_logo[i] = BIT_N(bitpos); | ||
162 | } | ||
163 | } | ||
164 | lcd_mono_bitmap(charging_logo, pox_x, pox_y + 8, | ||
165 | sizeof(charging_logo), 8); | ||
166 | phase++; | ||
167 | } | ||
168 | lcd_update(); | ||
169 | } | ||
170 | #else /* not HAVE_LCD_BITMAP */ | ||
171 | |||
172 | static unsigned long logo_chars[4]; | ||
173 | static const unsigned char logo_pattern[] = { | ||
174 | 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */ | ||
175 | 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */ | ||
176 | 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */ | ||
177 | 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */ | ||
178 | }; | ||
179 | |||
180 | static void logo_lock_patterns(bool on) | ||
181 | { | ||
182 | int i; | ||
183 | |||
184 | if (on) | ||
185 | { | ||
186 | for (i = 0; i < 4; i++) | ||
187 | logo_chars[i] = lcd_get_locked_pattern(); | ||
188 | } | ||
189 | else | ||
190 | { | ||
191 | for (i = 0; i < 4; i++) | ||
192 | lcd_unlock_pattern(logo_chars[i]); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | static void charging_display_info(bool animate) | ||
197 | { | ||
198 | int battv; | ||
199 | unsigned i, ypos; | ||
200 | static unsigned phase = 3; | ||
201 | char buf[32]; | ||
202 | |||
203 | battv = battery_voltage(); | ||
204 | lcd_putsf(4, 1, " %d.%02dV", battv / 1000, (battv % 1000) / 10); | ||
205 | |||
206 | memcpy(buf, logo_pattern, 32); /* copy logo patterns */ | ||
207 | |||
208 | if (!animate) /* build the screen */ | ||
209 | { | ||
210 | lcd_double_height(false); | ||
211 | lcd_puts(0, 0, "[Charging]"); | ||
212 | for (i = 0; i < 4; i++) | ||
213 | lcd_putc(i, 1, logo_chars[i]); | ||
214 | } | ||
215 | else /* animate the logo */ | ||
216 | { | ||
217 | for (i = 3; i < MIN(19, phase); i++) | ||
218 | { | ||
219 | if ((i - phase) % 5 == 0) | ||
220 | { /* draw a "bubble" here */ | ||
221 | ypos = (phase + i/5) % 9; /* "bounce" effect */ | ||
222 | if (ypos > 4) | ||
223 | ypos = 8 - ypos; | ||
224 | buf[5 - ypos + 8 * (i/5)] |= 0x10u >> (i%5); | ||
225 | } | ||
226 | } | ||
227 | phase++; | ||
228 | } | ||
229 | |||
230 | for (i = 0; i < 4; i++) | ||
231 | lcd_define_pattern(logo_chars[i], buf + 8 * i); | ||
232 | |||
233 | lcd_update(); | ||
234 | } | ||
235 | #endif /* (not) HAVE_LCD_BITMAP */ | ||
236 | |||
237 | /* blocks while charging, returns on event: | ||
238 | 1 if charger cable was removed | ||
239 | 2 if Off/Stop key was pressed | ||
240 | 3 if On key was pressed | ||
241 | 4 if USB was connected */ | ||
242 | |||
243 | int charging_screen(void) | ||
244 | { | ||
245 | unsigned int button; | ||
246 | int rc = 0; | ||
247 | |||
248 | ide_power_enable(false); /* power down the disk, else would be spinning */ | ||
249 | |||
250 | lcd_clear_display(); | ||
251 | backlight_set_timeout(global_settings.backlight_timeout); | ||
252 | #ifdef HAVE_REMOTE_LCD | ||
253 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); | ||
254 | #endif | ||
255 | backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); | ||
256 | |||
257 | #ifdef HAVE_LCD_CHARCELLS | ||
258 | logo_lock_patterns(true); | ||
259 | #endif | ||
260 | charging_display_info(false); | ||
261 | |||
262 | do | ||
263 | { | ||
264 | gui_syncstatusbar_draw(&statusbars, false); | ||
265 | charging_display_info(true); | ||
266 | button = get_action(CONTEXT_STD,HZ/3); | ||
267 | if (button == ACTION_STD_OK) | ||
268 | rc = 2; | ||
269 | else if (usb_detect() == USB_INSERTED) | ||
270 | rc = 3; | ||
271 | /* do not depend on power management thread here */ | ||
272 | else if (!(power_input_status() & POWER_INPUT_MAIN_CHARGER)) | ||
273 | rc = 1; | ||
274 | } while (!rc); | ||
275 | |||
276 | #ifdef HAVE_LCD_CHARCELLS | ||
277 | logo_lock_patterns(false); | ||
278 | #endif | ||
279 | return rc; | ||
280 | } | ||
281 | #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */ | ||
282 | |||
283 | #if CONFIG_CHARGING | 61 | #if CONFIG_CHARGING |
284 | void charging_splash(void) | 62 | void charging_splash(void) |
285 | { | 63 | { |
@@ -585,44 +363,6 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
585 | } | 363 | } |
586 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ | 364 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ |
587 | 365 | ||
588 | #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF) | ||
589 | #include "scroll_engine.h" | ||
590 | bool shutdown_screen(void) | ||
591 | { | ||
592 | int button; | ||
593 | bool done = false; | ||
594 | long time_entered = current_tick; | ||
595 | |||
596 | lcd_scroll_stop(); | ||
597 | |||
598 | splash(0, str(LANG_CONFIRM_SHUTDOWN)); | ||
599 | |||
600 | while(!done && TIME_BEFORE(current_tick,time_entered+HZ*2)) | ||
601 | { | ||
602 | button = get_action(CONTEXT_STD,HZ); | ||
603 | switch(button) | ||
604 | { | ||
605 | case ACTION_STD_CANCEL: | ||
606 | sys_poweroff(); | ||
607 | break; | ||
608 | |||
609 | /* do nothing here, because ACTION_NONE might be caused | ||
610 | * by timeout or button release. In case of timeout the loop | ||
611 | * is terminated by TIME_BEFORE */ | ||
612 | case ACTION_NONE: | ||
613 | break; | ||
614 | |||
615 | default: | ||
616 | if(default_event_handler(button) == SYS_USB_CONNECTED) | ||
617 | return true; | ||
618 | done = true; | ||
619 | break; | ||
620 | } | ||
621 | } | ||
622 | return false; | ||
623 | } | ||
624 | #endif | ||
625 | |||
626 | static const int id3_headers[]= | 366 | static const int id3_headers[]= |
627 | { | 367 | { |
628 | LANG_ID3_TITLE, | 368 | LANG_ID3_TITLE, |