1
0
Fork 0
forked from len0rd/rockbox

better logf

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6949 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michiel Van Der Kolk 2005-06-30 15:14:33 +00:00
parent 65ff219e8e
commit 25b55e16bc
2 changed files with 6 additions and 5 deletions

View file

@ -24,7 +24,7 @@
#ifdef ROCKBOX_HAS_LOGF #ifdef ROCKBOX_HAS_LOGF
#define MAX_LOGF_LINES 1000 #define MAX_LOGF_LINES 1000
#define MAX_LOGF_ENTRY 21 /* 128/6 pixels */ #define MAX_LOGF_ENTRY 256
#define MAX_LOGF_DATASIZE (MAX_LOGF_ENTRY*MAX_LOGF_LINES) #define MAX_LOGF_DATASIZE (MAX_LOGF_ENTRY*MAX_LOGF_LINES)
extern unsigned char logfbuffer[MAX_LOGF_LINES][MAX_LOGF_ENTRY]; extern unsigned char logfbuffer[MAX_LOGF_LINES][MAX_LOGF_ENTRY];

View file

@ -45,18 +45,19 @@ static void displayremote(void)
/* TODO: we should have a debug option that enables/disables this! */ /* TODO: we should have a debug option that enables/disables this! */
int w, h; int w, h;
int lines; int lines;
int columns;
int i; int i;
int index; int index;
lcd_remote_getstringsize("A", &w, &h); lcd_remote_getstringsize("A", &w, &h);
lines = LCD_REMOTE_HEIGHT/h; lines = LCD_REMOTE_HEIGHT/h;
columns = LCD_REMOTE_WIDTH/w;
lcd_remote_setmargins(0, 0); lcd_remote_setmargins(0, 0);
lcd_remote_clear_display(); lcd_remote_clear_display();
index = logfindex; index = logfindex;
for(i = lines-1; i>=0; i--) { for(i = lines-1; i>=0; i--) {
unsigned char buffer[MAX_LOGF_ENTRY+1]; unsigned char buffer[columns+1];
if(--index < 0) { if(--index < 0) {
if(logfwrap) if(logfwrap)
@ -65,8 +66,8 @@ static void displayremote(void)
break; /* done */ break; /* done */
} }
memcpy(buffer, logfbuffer[index], MAX_LOGF_ENTRY); memcpy(buffer, logfbuffer[index], columns);
buffer[MAX_LOGF_ENTRY]=0; buffer[columns]=0;
lcd_remote_puts(0, i, buffer); lcd_remote_puts(0, i, buffer);
} }
lcd_remote_update(); lcd_remote_update();