diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-05-24 14:26:54 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-05-24 14:26:54 +0000 |
commit | 11bf87fefa5e2402e8dccf20d141612bd9a9b3d7 (patch) | |
tree | 24754768f345e7235c9f5c82b52621ccdd29ae29 | |
parent | e2c4a6c642deba789016b8bd09890994a76b0728 (diff) | |
download | rockbox-11bf87fefa5e2402e8dccf20d141612bd9a9b3d7.tar.gz rockbox-11bf87fefa5e2402e8dccf20d141612bd9a9b3d7.zip |
initial remote-LCD logf browser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6520 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/logf.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/firmware/logf.c b/firmware/logf.c index a66709b939..a7df8a2e89 100644 --- a/firmware/logf.c +++ b/firmware/logf.c | |||
@@ -30,14 +30,49 @@ | |||
30 | #include <sprintf.h> | 30 | #include <sprintf.h> |
31 | #include <stdbool.h> | 31 | #include <stdbool.h> |
32 | #include "config.h" | 32 | #include "config.h" |
33 | 33 | #include "lcd.h" | |
34 | #define MAX_LOGF_LINES 1000 | 34 | #include "logf.h" |
35 | #define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES) | ||
36 | 35 | ||
37 | unsigned char logfbuffer[MAX_LOGF_LINES][16]; | 36 | unsigned char logfbuffer[MAX_LOGF_LINES][16]; |
38 | int logfindex; | 37 | int logfindex; |
39 | bool logfwrap; | 38 | bool logfwrap; |
40 | 39 | ||
40 | #ifdef HAVE_REMOTE_LCD | ||
41 | static void displayremote(void) | ||
42 | { | ||
43 | /* TODO: we should have a debug option that enables/disables this! */ | ||
44 | int w, h; | ||
45 | int lines; | ||
46 | int i; | ||
47 | int index; | ||
48 | |||
49 | lcd_getstringsize("A", &w, &h); | ||
50 | lines = LCD_REMOTE_HEIGHT/h; | ||
51 | |||
52 | lcd_remote_setmargins(0, 0); | ||
53 | lcd_remote_clear_display(); | ||
54 | |||
55 | index = logfindex; | ||
56 | for(i = lines-1; i>=0; i--) { | ||
57 | unsigned char buffer[17]; | ||
58 | |||
59 | if(--index < 0) { | ||
60 | if(logfwrap) | ||
61 | index = MAX_LOGF_LINES-1; | ||
62 | else | ||
63 | break; /* done */ | ||
64 | } | ||
65 | |||
66 | memcpy(buffer, logfbuffer[index], 16); | ||
67 | buffer[16]=0; | ||
68 | lcd_remote_puts(0, i, buffer); | ||
69 | } | ||
70 | lcd_remote_update(); | ||
71 | } | ||
72 | #else | ||
73 | #define displayremote() | ||
74 | #endif | ||
75 | |||
41 | void logf(const char *format, ...) | 76 | void logf(const char *format, ...) |
42 | { | 77 | { |
43 | int len; | 78 | int len; |
@@ -58,4 +93,6 @@ void logf(const char *format, ...) | |||
58 | memset(ptr+len, ' ', 16-len); | 93 | memset(ptr+len, ' ', 16-len); |
59 | 94 | ||
60 | logfindex++; /* leave it where we write the next time */ | 95 | logfindex++; /* leave it where we write the next time */ |
96 | |||
97 | displayremote(); | ||
61 | } | 98 | } |