diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-06-01 13:21:20 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-06-01 13:21:20 +0000 |
commit | 6ebdbe8df31e4abbc1466f827c9207339522d9f5 (patch) | |
tree | 0364fb78c9b18a13467660877cead9b9d69fb0cb /firmware | |
parent | 1c5374fe79bc753672f3862b829c4456212bfb20 (diff) | |
download | rockbox-6ebdbe8df31e4abbc1466f827c9207339522d9f5.tar.gz rockbox-6ebdbe8df31e4abbc1466f827c9207339522d9f5.zip |
Modified logf to use a define for the log width, and changed it to default to
21 as that is what fits in an iriver LCD by default since the font is 6 pixels
wide.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/logf.h | 5 | ||||
-rw-r--r-- | firmware/logf.c | 24 |
2 files changed, 15 insertions, 14 deletions
diff --git a/firmware/export/logf.h b/firmware/export/logf.h index f74f50377e..7e9b27ab0a 100644 --- a/firmware/export/logf.h +++ b/firmware/export/logf.h | |||
@@ -23,9 +23,10 @@ | |||
23 | #ifdef ROCKBOX_HAS_LOGF | 23 | #ifdef ROCKBOX_HAS_LOGF |
24 | 24 | ||
25 | #define MAX_LOGF_LINES 1000 | 25 | #define MAX_LOGF_LINES 1000 |
26 | #define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES) | 26 | #define MAX_LOGF_ENTRY 21 /* 128/6 pixels */ |
27 | #define MAX_LOGF_DATASIZE (MAX_LOGF_ENTRY*MAX_LOGF_LINES) | ||
27 | 28 | ||
28 | extern unsigned char logfbuffer[MAX_LOGF_LINES][16]; | 29 | extern unsigned char logfbuffer[MAX_LOGF_LINES][MAX_LOGF_ENTRY]; |
29 | extern int logfindex; | 30 | extern int logfindex; |
30 | extern bool logfwrap; | 31 | extern bool logfwrap; |
31 | 32 | ||
diff --git a/firmware/logf.c b/firmware/logf.c index ab3d621428..a11987dd34 100644 --- a/firmware/logf.c +++ b/firmware/logf.c | |||
@@ -18,10 +18,10 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * logf() logs 16 bytes in a circular buffer. Each logged string is space- | 21 | * logf() logs MAX_LOGF_ENTRY (21) bytes per entry in a circular buffer. Each |
22 | * padded for easier and faster output on screen. Just output 16 lines on each | 22 | * logged string is space- padded for easier and faster output on screen. Just |
23 | * line. 16 bytes fit nicely on the iRiver remote LCD (128 pixels with an 8 | 23 | * output MAX_LOGF_ENTRY characters on each line. MAX_LOGF_ENTRY bytes fit |
24 | * pixels font). | 24 | * nicely on the iRiver remote LCD (128 pixels with an 8x6 pixels font). |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <string.h> | 27 | #include <string.h> |
@@ -36,7 +36,7 @@ | |||
36 | /* Only provide all this if asked to */ | 36 | /* Only provide all this if asked to */ |
37 | #ifdef ROCKBOX_HAS_LOGF | 37 | #ifdef ROCKBOX_HAS_LOGF |
38 | 38 | ||
39 | unsigned char logfbuffer[MAX_LOGF_LINES][16]; | 39 | unsigned char logfbuffer[MAX_LOGF_LINES][MAX_LOGF_ENTRY]; |
40 | int logfindex; | 40 | int logfindex; |
41 | bool logfwrap; | 41 | bool logfwrap; |
42 | 42 | ||
@@ -57,7 +57,7 @@ static void displayremote(void) | |||
57 | 57 | ||
58 | index = logfindex; | 58 | index = logfindex; |
59 | for(i = lines-1; i>=0; i--) { | 59 | for(i = lines-1; i>=0; i--) { |
60 | unsigned char buffer[17]; | 60 | unsigned char buffer[MAX_LOGF_ENTRY+1]; |
61 | 61 | ||
62 | if(--index < 0) { | 62 | if(--index < 0) { |
63 | if(logfwrap) | 63 | if(logfwrap) |
@@ -66,8 +66,8 @@ static void displayremote(void) | |||
66 | break; /* done */ | 66 | break; /* done */ |
67 | } | 67 | } |
68 | 68 | ||
69 | memcpy(buffer, logfbuffer[index], 16); | 69 | memcpy(buffer, logfbuffer[index], MAX_LOGF_ENTRY); |
70 | buffer[16]=0; | 70 | buffer[MAX_LOGF_ENTRY]=0; |
71 | lcd_remote_puts(0, i, buffer); | 71 | lcd_remote_puts(0, i, buffer); |
72 | } | 72 | } |
73 | lcd_remote_update(); | 73 | lcd_remote_update(); |
@@ -89,11 +89,11 @@ void logf(const char *format, ...) | |||
89 | logfindex = 0; | 89 | logfindex = 0; |
90 | } | 90 | } |
91 | ptr = logfbuffer[logfindex]; | 91 | ptr = logfbuffer[logfindex]; |
92 | len = vsnprintf(ptr, 16, format, ap); | 92 | len = vsnprintf(ptr, MAX_LOGF_ENTRY, format, ap); |
93 | va_end(ap); | 93 | va_end(ap); |
94 | if(len < 16) | 94 | if(len < MAX_LOGF_ENTRY) |
95 | /* pad with spaces up to the 16 byte border */ | 95 | /* pad with spaces up to the MAX_LOGF_ENTRY byte border */ |
96 | memset(ptr+len, ' ', 16-len); | 96 | memset(ptr+len, ' ', MAX_LOGF_ENTRY-len); |
97 | 97 | ||
98 | logfindex++; /* leave it where we write the next time */ | 98 | logfindex++; /* leave it where we write the next time */ |
99 | 99 | ||