mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
test_disk: scroll the log when the screen is full
When the text reached the bottom of the screen it started again at the top, over what was there, so the old lines showed through the new. Scroll up a line instead, as test_codec does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: I024eda05bbcca6f1539893ea609c89f562436e2f
This commit is contained in:
parent
303c534022
commit
853274937c
1 changed files with 11 additions and 6 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/helper.h"
|
#include "lib/helper.h"
|
||||||
|
#include "lib/xlcd.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,6 +40,7 @@ static size_t audiobuflen;
|
||||||
static unsigned short frnd_buffer;
|
static unsigned short frnd_buffer;
|
||||||
static int line = 0;
|
static int line = 0;
|
||||||
static int max_line = 0;
|
static int max_line = 0;
|
||||||
|
static int line_height = 0;
|
||||||
static int log_fd;
|
static int log_fd;
|
||||||
static char logfilename[MAX_PATH];
|
static char logfilename[MAX_PATH];
|
||||||
|
|
||||||
|
|
@ -86,10 +88,8 @@ static bool mem_cmp_frnd(unsigned char *addr, int len)
|
||||||
|
|
||||||
static bool log_init(void)
|
static bool log_init(void)
|
||||||
{
|
{
|
||||||
int h;
|
rb->lcd_getstringsize("A", NULL, &line_height);
|
||||||
|
max_line = LCD_HEIGHT / line_height;
|
||||||
rb->lcd_getstringsize("A", NULL, &h);
|
|
||||||
max_line = LCD_HEIGHT / h;
|
|
||||||
line = 0;
|
line = 0;
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
@ -102,12 +102,17 @@ static bool log_init(void)
|
||||||
|
|
||||||
static void log_text(char *text, bool advance)
|
static void log_text(char *text, bool advance)
|
||||||
{
|
{
|
||||||
|
if (line >= max_line)
|
||||||
|
{
|
||||||
|
/* The screen is full: scroll up to make room for this line */
|
||||||
|
xlcd_scroll_up(line_height);
|
||||||
|
line = max_line - 1;
|
||||||
|
}
|
||||||
rb->lcd_puts(0, line, text);
|
rb->lcd_puts(0, line, text);
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
if (advance)
|
if (advance)
|
||||||
{
|
{
|
||||||
if (++line >= max_line)
|
line++;
|
||||||
line = 0;
|
|
||||||
rb->fdprintf(log_fd, "%s\n", text);
|
rb->fdprintf(log_fd, "%s\n", text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue