From 11bf87fefa5e2402e8dccf20d141612bd9a9b3d7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 24 May 2005 14:26:54 +0000 Subject: initial remote-LCD logf browser git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6520 a1c6a512-1295-4272-9138-f99709370657 --- firmware/logf.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'firmware/logf.c') 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 #include #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(); } -- cgit