summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/screens.c76
1 files changed, 68 insertions, 8 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 4c5ef4975b..d9147f25d9 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -244,10 +244,69 @@ void charging_display_info(bool animate)
244 lcd_update(); 244 lcd_update();
245} 245}
246#else /* not HAVE_LCD_BITMAP */ 246#else /* not HAVE_LCD_BITMAP */
247
248static unsigned char logo_chars[5];
249static const unsigned char logo_pattern[] = {
250 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, /* char 1 */
251 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 2 */
252 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 3 */
253 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, /* char 4 */
254};
255
256static void logo_lock_patterns(bool on)
257{
258 int i;
259
260 if (on)
261 {
262 for (i = 0; i < 4; i++)
263 logo_chars[i] = lcd_get_locked_pattern();
264 logo_chars[4] = '\0';
265 }
266 else
267 {
268 for (i = 0; i < 4; i++)
269 lcd_unlock_pattern(logo_chars[i]);
270 }
271}
272
247void charging_display_info(bool animate) 273void charging_display_info(bool animate)
248{ 274{
249 /* ToDo for Player */ 275 int battery_voltage;
250 (void)animate; 276 unsigned i, ypos;
277 static unsigned phase = 3;
278 char buf[28];
279
280 battery_voltage = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR)
281 / 10000;
282 snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars,
283 battery_voltage / 100, battery_voltage % 100);
284 lcd_puts(0, 1, buf);
285
286 memcpy(buf, logo_pattern, 28); /* copy logo patterns */
287
288 if (!animate) /* build the screen */
289 {
290 lcd_double_height(false);
291 lcd_puts(0, 0, "[Charging]");
292 }
293 else /* animate the logo */
294 {
295 for (i = 3; i < MIN(19, phase); i++)
296 {
297 if ((i - phase) % 5 == 0)
298 { /* draw a "bubble" here */
299 ypos = (phase + i/5) % 9; /* "bounce" effect */
300 if (ypos > 4)
301 ypos = 8 - ypos;
302 buf[5 - ypos + 7 * (i/5)] |= 0x10 >> (i%5);
303 }
304 }
305 phase++;
306 }
307
308 for (i = 0; i < 4; i++)
309 lcd_define_pattern(logo_chars[i], buf + 7 * i);
251} 310}
252#endif 311#endif
253 312
@@ -274,13 +333,11 @@ int charging_screen(void)
274 backlight_set_on_when_charging(global_settings.backlight_on_when_charging); 333 backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
275 status_draw(true); 334 status_draw(true);
276 335
277#ifdef HAVE_LCD_BITMAP 336#ifdef HAVE_LCD_CHARCELLS
278 charging_display_info(false); 337 logo_lock_patterns(true);
279#else
280 lcd_double_height(false);
281 lcd_puts(0, 1, "[charging]");
282#endif 338#endif
283 339 charging_display_info(false);
340
284 do 341 do
285 { 342 {
286 status_draw(false); 343 status_draw(false);
@@ -303,6 +360,9 @@ int charging_screen(void)
303 } 360 }
304 } while (!rc); 361 } while (!rc);
305 362
363#ifdef HAVE_LCD_CHARCELLS
364 logo_lock_patterns(false);
365#endif
306 return rc; 366 return rc;
307} 367}
308#endif /* HAVE_CHARGING */ 368#endif /* HAVE_CHARGING */