diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 13 | ||||
-rw-r--r-- | apps/misc.c | 9 | ||||
-rw-r--r-- | apps/misc.h | 5 |
3 files changed, 24 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 02b86feefc..0b4be9d72d 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1612,6 +1612,18 @@ static bool dbg_sound(void) | |||
1612 | return false; | 1612 | return false; |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | #ifdef HAVE_LCD_BITMAP | ||
1616 | extern bool do_screendump_instead_of_usb; | ||
1617 | |||
1618 | bool dbg_screendump(void) | ||
1619 | { | ||
1620 | do_screendump_instead_of_usb = !do_screendump_instead_of_usb; | ||
1621 | splash(HZ, true, "Screendump %s", | ||
1622 | do_screendump_instead_of_usb?"enabled":"disabled"); | ||
1623 | return false; | ||
1624 | } | ||
1625 | #endif | ||
1626 | |||
1615 | bool debug_menu(void) | 1627 | bool debug_menu(void) |
1616 | { | 1628 | { |
1617 | int m; | 1629 | int m; |
@@ -1635,6 +1647,7 @@ bool debug_menu(void) | |||
1635 | #endif | 1647 | #endif |
1636 | #ifdef HAVE_LCD_BITMAP | 1648 | #ifdef HAVE_LCD_BITMAP |
1637 | { "View battery", -1, view_battery }, | 1649 | { "View battery", -1, view_battery }, |
1650 | { "Screendump", -1, dbg_screendump }, | ||
1638 | #endif | 1651 | #endif |
1639 | { "View HW info", -1, dbg_hw_info }, | 1652 | { "View HW info", -1, dbg_hw_info }, |
1640 | { "View partitions", -1, dbg_partitions }, | 1653 | { "View partitions", -1, dbg_partitions }, |
diff --git a/apps/misc.c b/apps/misc.c index be1c3202fb..701f766a8d 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "sprintf.h" | 23 | #include "sprintf.h" |
24 | #include "errno.h" | 24 | #include "errno.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | #define ONE_KILOBYTE 1024 | 28 | #define ONE_KILOBYTE 1024 |
28 | #define ONE_MEGABYTE (1024*1024) | 29 | #define ONE_MEGABYTE (1024*1024) |
@@ -102,7 +103,7 @@ int main(int argc, char **argv) | |||
102 | 103 | ||
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | #ifdef SCREENDUMP | 106 | #ifdef HAVE_LCD_BITMAP |
106 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; | 107 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; |
107 | static unsigned char bmpheader[] = | 108 | static unsigned char bmpheader[] = |
108 | { | 109 | { |
@@ -117,7 +118,6 @@ static unsigned char bmpheader[] = | |||
117 | static unsigned char buf[112*8]; | 118 | static unsigned char buf[112*8]; |
118 | static unsigned char buf2[112*8]; | 119 | static unsigned char buf2[112*8]; |
119 | static char dummy[2] = {0, 0}; | 120 | static char dummy[2] = {0, 0}; |
120 | static int fileindex = 0; | ||
121 | 121 | ||
122 | void screen_dump(void) | 122 | void screen_dump(void) |
123 | { | 123 | { |
@@ -125,6 +125,7 @@ void screen_dump(void) | |||
125 | int i, shift; | 125 | int i, shift; |
126 | int x, y; | 126 | int x, y; |
127 | char filename[MAX_PATH]; | 127 | char filename[MAX_PATH]; |
128 | struct tm *tm = get_time(); | ||
128 | 129 | ||
129 | i = 0; | 130 | i = 0; |
130 | for(y = 0;y < LCD_HEIGHT/8;y++) | 131 | for(y = 0;y < LCD_HEIGHT/8;y++) |
@@ -151,7 +152,9 @@ void screen_dump(void) | |||
151 | } | 152 | } |
152 | } | 153 | } |
153 | 154 | ||
154 | snprintf(filename, MAX_PATH, "/dump%03d.bmp", fileindex++); | 155 | snprintf(filename, MAX_PATH, "/dump %04d-%02d-%02d %02d-%02d-%02d.bmp", |
156 | tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, | ||
157 | tm->tm_hour, tm->tm_min, tm->tm_sec); | ||
155 | f = creat(filename, O_WRONLY); | 158 | f = creat(filename, O_WRONLY); |
156 | if(f >= 0) | 159 | if(f >= 0) |
157 | { | 160 | { |
diff --git a/apps/misc.h b/apps/misc.h index c8aa266d5f..329c62750c 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -30,3 +30,8 @@ char *num2max5(unsigned int bytes, char *max5); | |||
30 | * stored in buffer. | 30 | * stored in buffer. |
31 | */ | 31 | */ |
32 | int read_line(int fd, char* buffer, int buffer_size); | 32 | int read_line(int fd, char* buffer, int buffer_size); |
33 | |||
34 | #ifdef HAVE_LCD_BITMAP | ||
35 | /* Save a .BMP file containing the current screen contents. */ | ||
36 | void screen_dump(void); | ||
37 | #endif | ||