diff --git a/firmware/export/screendump.h b/firmware/export/screendump.h index b7acdd344c..484bc4dc7a 100644 --- a/firmware/export/screendump.h +++ b/firmware/export/screendump.h @@ -39,28 +39,18 @@ #define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff #define LE32_CONST(x) (x)&0xff, ((x)>>8)&0xff, ((x)>>16)&0xff, ((x)>>24)&0xff -#ifndef BMP_BPP #if LCD_DEPTH <= 4 -#define BMP_BPP 4 +#define DUMP_BMP_BPP 4 +#define DUMP_BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) #elif LCD_DEPTH <= 8 -#define BMP_BPP 8 +#define DUMP_BMP_BPP 8 +#define DUMP_BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) #elif LCD_DEPTH <= 16 -#define BMP_BPP 16 +#define DUMP_BMP_BPP 16 +#define DUMP_BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3) #else -#define BMP_BPP 24 -#endif -#endif - -#ifndef BMP_LINESIZE -#if LCD_DEPTH <= 4 -#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) -#elif LCD_DEPTH <= 8 -#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) -#elif LCD_DEPTH <= 16 -#define BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3) -#else -#define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) -#endif +#define DUMP_BMP_BPP 24 +#define DUMP_BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) #endif #ifdef BOOTLOADER diff --git a/firmware/screendump.c b/firmware/screendump.c index cd9d6a5bd6..30b9539732 100644 --- a/firmware/screendump.c +++ b/firmware/screendump.c @@ -50,7 +50,7 @@ #endif /* LCD_DEPTH != 16 */ #define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS) -#define BMP_DATASIZE (BMP_LINESIZE * (LCD_HEIGHT+LCD_SPLIT_LINES)) +#define BMP_DATASIZE (DUMP_BMP_LINESIZE * (LCD_HEIGHT+LCD_SPLIT_LINES)) #define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE) static const unsigned char bmpheader[] = @@ -64,7 +64,7 @@ static const unsigned char bmpheader[] = LE32_CONST(LCD_WIDTH), /* Width in pixels */ LE32_CONST(LCD_HEIGHT+LCD_SPLIT_LINES), /* Height in pixels */ 0x01, 0x00, /* Number of planes (always 1) */ - LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ + LE16_CONST(DUMP_BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ LE32_CONST(BMP_COMPRESSION),/* Compression mode */ LE32_CONST(BMP_DATASIZE), /* Size of bitmap data */ 0xc4, 0x0e, 0x00, 0x00, /* Horizontal resolution (pixels/meter) */ @@ -113,10 +113,10 @@ void screen_dump(void) #endif #if LCD_DEPTH <= 8 unsigned char *dst, *dst_end; - unsigned char linebuf[BMP_LINESIZE]; + unsigned char linebuf[DUMP_BMP_LINESIZE]; #elif LCD_DEPTH <= 16 unsigned short *dst, *dst_end; - unsigned short linebuf[BMP_LINESIZE/2]; + unsigned short linebuf[DUMP_BMP_LINESIZE/2]; #endif #if CONFIG_RTC @@ -141,13 +141,13 @@ void screen_dump(void) /* BMP image goes bottom up */ for (y = LCD_HEIGHT - 1; y >= 0; y--) { - memset(linebuf, 0, BMP_LINESIZE); + memset(linebuf, 0, DUMP_BMP_LINESIZE); #if defined(HAVE_LCD_SPLIT) && (LCD_SPLIT_LINES == 2) if (y == LCD_SPLIT_POS - 1) { - write(fd, linebuf, BMP_LINESIZE); - write(fd, linebuf, BMP_LINESIZE); + write(fd, linebuf, DUMP_BMP_LINESIZE); + write(fd, linebuf, DUMP_BMP_LINESIZE); } #endif dst = linebuf; @@ -228,7 +228,7 @@ void screen_dump(void) while (dst < dst_end); #endif /* LCD_DEPTH */ - write(fd, linebuf, BMP_LINESIZE); + write(fd, linebuf, DUMP_BMP_LINESIZE); } } close(fd); diff --git a/firmware/usb.c b/firmware/usb.c index a76eb66fef..9eaf2014fa 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -71,7 +71,7 @@ static int usb_mmc_countdown = 0; /* Make sure there's enough stack space for screendump */ #ifdef USB_FULL_INIT -static long usb_stack[(DEFAULT_STACK_SIZE + SECTOR_SIZE + BMP_LINESIZE)/sizeof(long)]; +static long usb_stack[(DEFAULT_STACK_SIZE + SECTOR_SIZE + DUMP_BMP_LINESIZE)/sizeof(long)]; static const char usb_thread_name[] = "usb"; static unsigned int usb_thread_entry = 0; #ifndef USB_STATUS_BY_EVENT