summaryrefslogtreecommitdiff
path: root/apps/recorder/bounce.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/bounce.c')
-rw-r--r--apps/recorder/bounce.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index f89f699862..4f00d50470 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -28,6 +28,8 @@
28#include "menu.h" 28#include "menu.h"
29#include "sprintf.h" 29#include "sprintf.h"
30#include "rtc.h" 30#include "rtc.h"
31#include "font.h"
32#include "screens.h"
31 33
32#ifdef SIMULATOR 34#ifdef SIMULATOR
33#include <stdio.h> 35#include <stdio.h>
@@ -37,6 +39,13 @@
37#define SS_TITLE "Bouncer" 39#define SS_TITLE "Bouncer"
38#define SS_TITLE_FONT 2 40#define SS_TITLE_FONT 2
39 41
42#define LETTERS_ON_SCREEN 12
43
44#define YSPEED 2
45#define XSPEED 3
46#define YADD -4
47
48
40static unsigned char table[]={ 49static unsigned char table[]={
4126,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23, 5026,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23,
42}; 51};
@@ -225,12 +234,6 @@ static void addclock(void)
225 } 234 }
226} 235}
227 236
228#define LETTERS_ON_SCREEN 12
229
230#define YSPEED 2
231#define XSPEED 3
232#define YADD -4
233
234static int scrollit(void) 237static int scrollit(void)
235{ 238{
236 int b; 239 int b;
@@ -301,6 +304,12 @@ static int loopit(void)
301 b = button_get_w_tmo(HZ/10); 304 b = button_get_w_tmo(HZ/10);
302 if ( b == (BUTTON_OFF|BUTTON_REL) ) 305 if ( b == (BUTTON_OFF|BUTTON_REL) )
303 return 0; 306 return 0;
307
308 if ( b == SYS_USB_CONNECTED) {
309 usb_screen();
310 return 0;
311 }
312
304 if ( b == (BUTTON_ON|BUTTON_REL) ) 313 if ( b == (BUTTON_ON|BUTTON_REL) )
305 return 1; 314 return 1;
306 else if(b != BUTTON_NONE) 315 else if(b != BUTTON_NONE)
@@ -355,6 +364,8 @@ bool bounce(void)
355 char *off = "[Off] to stop"; 364 char *off = "[Off] to stop";
356 int len = strlen(SS_TITLE); 365 int len = strlen(SS_TITLE);
357 366
367 lcd_setfont(FONT_SYSFIXED);
368
358 lcd_getstringsize(SS_TITLE,&w, &h); 369 lcd_getstringsize(SS_TITLE,&w, &h);
359 370
360 /* Get horizontel centering for text */ 371 /* Get horizontel centering for text */
@@ -363,41 +374,43 @@ bool bounce(void)
363 len = ((len+1)/2)+(w/2); 374 len = ((len+1)/2)+(w/2);
364 else 375 else
365 len /= 2; 376 len /= 2;
366 377
367 if (h%2 != 0) 378 if (h%2 != 0)
368 h = (h/2)+1; 379 h = (h/2)+1;
369 else 380 else
370 h /= 2; 381 h /= 2;
371 382
372 lcd_clear_display(); 383 lcd_clear_display();
373 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE); 384 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE);
374 385
375 len = 1; 386 len = 1;
376 lcd_getstringsize(off, &w, &h); 387 lcd_getstringsize(off, &w, &h);
377 388
378 /* Get horizontel centering for text */ 389 /* Get horizontel centering for text */
379 len *= w; 390 len *= w;
380 if (len%2 != 0) 391 if (len%2 != 0)
381 len = ((len+1)/2)+(w/2); 392 len = ((len+1)/2)+(w/2);
382 else 393 else
383 len /= 2; 394 len /= 2;
384 395
385 if (h%2 != 0) 396 if (h%2 != 0)
386 h = (h/2)+1; 397 h = (h/2)+1;
387 else 398 else
388 h /= 2; 399 h /= 2;
389 400
390 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off); 401 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off);
391 402
392 lcd_update(); 403 lcd_update();
393 sleep(HZ); 404 sleep(HZ);
394 405
395 do { 406 do {
396 h= loopit(); 407 h= loopit();
397 if(h) 408 if(h)
398 h= scrollit(); 409 h = scrollit();
399 } while(h); 410 } while(h);
400 411
412 lcd_setfont(FONT_UI);
413
401 return false; 414 return false;
402} 415}
403 416