New screen dump feature for recorders

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4817 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-06-30 13:31:14 +00:00
parent 058302a480
commit a8dab4c08a
7 changed files with 89 additions and 76 deletions

View file

@ -1612,6 +1612,18 @@ static bool dbg_sound(void)
return false;
}
#ifdef HAVE_LCD_BITMAP
extern bool do_screendump_instead_of_usb;
bool dbg_screendump(void)
{
do_screendump_instead_of_usb = !do_screendump_instead_of_usb;
splash(HZ, true, "Screendump %s",
do_screendump_instead_of_usb?"enabled":"disabled");
return false;
}
#endif
bool debug_menu(void)
{
int m;
@ -1635,6 +1647,7 @@ bool debug_menu(void)
#endif
#ifdef HAVE_LCD_BITMAP
{ "View battery", -1, view_battery },
{ "Screendump", -1, dbg_screendump },
#endif
{ "View HW info", -1, dbg_hw_info },
{ "View partitions", -1, dbg_partitions },

View file

@ -23,6 +23,7 @@
#include "sprintf.h"
#include "errno.h"
#include "system.h"
#include "timefuncs.h"
#define ONE_KILOBYTE 1024
#define ONE_MEGABYTE (1024*1024)
@ -102,7 +103,7 @@ int main(int argc, char **argv)
#endif
#ifdef SCREENDUMP
#ifdef HAVE_LCD_BITMAP
extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
static unsigned char bmpheader[] =
{
@ -117,7 +118,6 @@ static unsigned char bmpheader[] =
static unsigned char buf[112*8];
static unsigned char buf2[112*8];
static char dummy[2] = {0, 0};
static int fileindex = 0;
void screen_dump(void)
{
@ -125,6 +125,7 @@ void screen_dump(void)
int i, shift;
int x, y;
char filename[MAX_PATH];
struct tm *tm = get_time();
i = 0;
for(y = 0;y < LCD_HEIGHT/8;y++)
@ -151,7 +152,9 @@ void screen_dump(void)
}
}
snprintf(filename, MAX_PATH, "/dump%03d.bmp", fileindex++);
snprintf(filename, MAX_PATH, "/dump %04d-%02d-%02d %02d-%02d-%02d.bmp",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
f = creat(filename, O_WRONLY);
if(f >= 0)
{

View file

@ -30,3 +30,8 @@ char *num2max5(unsigned int bytes, char *max5);
* stored in buffer.
*/
int read_line(int fd, char* buffer, int buffer_size);
#ifdef HAVE_LCD_BITMAP
/* Save a .BMP file containing the current screen contents. */
void screen_dump(void);
#endif