summaryrefslogtreecommitdiffstats
path: root/firmware/logf.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-24 14:26:54 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-24 14:26:54 +0000
commit11bf87fefa5e2402e8dccf20d141612bd9a9b3d7 (patch)
tree24754768f345e7235c9f5c82b52621ccdd29ae29 /firmware/logf.c
parente2c4a6c642deba789016b8bd09890994a76b0728 (diff)
downloadrockbox-11bf87fefa5e2402e8dccf20d141612bd9a9b3d7.tar.gz
rockbox-11bf87fefa5e2402e8dccf20d141612bd9a9b3d7.tar.bz2
rockbox-11bf87fefa5e2402e8dccf20d141612bd9a9b3d7.zip
initial remote-LCD logf browser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6520 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/logf.c')
-rw-r--r--firmware/logf.c43
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 @@
#include <sprintf.h>
#include <stdbool.h>
#include "config.h"
-
-#define MAX_LOGF_LINES 1000
-#define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES)
+#include "lcd.h"
+#include "logf.h"
unsigned char logfbuffer[MAX_LOGF_LINES][16];
int logfindex;
bool logfwrap;
+#ifdef HAVE_REMOTE_LCD
+static void displayremote(void)
+{
+ /* TODO: we should have a debug option that enables/disables this! */
+ int w, h;
+ int lines;
+ int i;
+ int index;
+
+ lcd_getstringsize("A", &w, &h);
+ lines = LCD_REMOTE_HEIGHT/h;
+
+ lcd_remote_setmargins(0, 0);
+ lcd_remote_clear_display();
+
+ index = logfindex;
+ for(i = lines-1; i>=0; i--) {
+ unsigned char buffer[17];
+
+ if(--index < 0) {
+ if(logfwrap)
+ index = MAX_LOGF_LINES-1;
+ else
+ break; /* done */
+ }
+
+ memcpy(buffer, logfbuffer[index], 16);
+ buffer[16]=0;
+ lcd_remote_puts(0, i, buffer);
+ }
+ lcd_remote_update();
+}
+#else
+#define displayremote()
+#endif
+
void logf(const char *format, ...)
{
int len;
@@ -58,4 +93,6 @@ void logf(const char *format, ...)
memset(ptr+len, ' ', 16-len);
logfindex++; /* leave it where we write the next time */
+
+ displayremote();
}