Skip to content

Commit

Permalink
bugfix: Display with height not a multiple of 8 and rotation R2 and R…
Browse files Browse the repository at this point in the history
…3 do not show the lower four rows. This is fixed. Issue #469
  • Loading branch information
olikraus committed Feb 18, 2018
1 parent 20eba44 commit 71fb12b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
12 changes: 10 additions & 2 deletions csrc/u8g2_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ void u8g2_update_dimension_r2(u8g2_t *u8g2)
u8g2->user_x0 = 0;
u8g2->user_x1 = u8g2->width; /* pixel_buf_width replaced with width */

u8g2->user_y0 = u8g2->height - u8g2->buf_y1;
/* there are ases where the height is not a multiple of 8. */
/* in such a case u8g2->buf_y1 might be heigher than u8g2->height */
u8g2->user_y0 = 0;
if ( u8g2->height >= u8g2->buf_y1 )
u8g2->user_y0 = u8g2->height - u8g2->buf_y1;
u8g2->user_y1 = u8g2->height - u8g2->buf_y0;

// printf("x0=%d x1=%d y0=%d y1=%d\n",
Expand All @@ -187,7 +191,11 @@ void u8g2_update_dimension_r3(u8g2_t *u8g2)
u8g2->height = u8g2_GetU8x8(u8g2)->display_info->pixel_width;
u8g2->width = u8g2_GetU8x8(u8g2)->display_info->pixel_height;

u8g2->user_x0 = u8g2->width - u8g2->buf_y1;
/* there are ases where the height is not a multiple of 8. */
/* in such a case u8g2->buf_y1 might be heigher than u8g2->width */
u8g2->user_x0 = 0;
if ( u8g2->width >= u8g2->buf_y1 )
u8g2->user_x0 = u8g2->width - u8g2->buf_y1;
u8g2->user_x1 = u8g2->width - u8g2->buf_y0;

u8g2->user_y0 = 0;
Expand Down
7 changes: 4 additions & 3 deletions sys/utf8/common/u8x8_d_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <stdlib.h>
#include <string.h>

//#define CHGR_WIDTH 96
#define CHGR_WIDTH 102
#define CHGR_HEIGHT 32
#define CHGR_WIDTH 96
//#define CHGR_WIDTH 102
//#define CHGR_HEIGHT 32
#define CHGR_HEIGHT 68
unsigned char chgr_bitmap[CHGR_HEIGHT/2][CHGR_WIDTH/2];

unsigned char *chgr_bitmap_pos(unsigned x, unsigned y)
Expand Down
14 changes: 11 additions & 3 deletions sys/utf8/frame_rotate_picture_loop/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ u8g2_t u8g2;
int main(void)
{

u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R1);
u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R3);


u8g2_InitDisplay(&u8g2);
Expand All @@ -27,10 +27,18 @@ int main(void)

u8g2_FirstPage(&u8g2);
do
{

{
printf("u8g2.tile_curr_row=%d\n", u8g2.tile_curr_row);
printf("u8g2.pixel_curr_row=%d\n", u8g2.pixel_curr_row);
printf("u8g2.buf_y0=%d\n", u8g2.buf_y0);
printf("u8g2.buf_y1=%d\n", u8g2.buf_y1);
printf("u8g2.user_x0=%d\n", u8g2.user_x0);
printf("u8g2.user_x1=%d\n", u8g2.user_x1);
printf("u8g2.user_y0=%d\n", u8g2.user_y0);
printf("u8g2.user_y1=%d\n", u8g2.user_y1);
u8g2_DrawFrame(&u8g2, 0, 0,
u8g2_GetDisplayWidth(&u8g2), u8g2_GetDisplayHeight(&u8g2));
u8g2_DrawPixel(&u8g2, 3, 3);
//u8g2_DrawHLine(&u8g2, 0, 0, u8g2_GetDisplayWidth(&u8g2));
//u8g2_DrawHLine(&u8g2, 0, u8g2_GetDisplayHeight(&u8g2)-1, u8g2_GetDisplayWidth(&u8g2));
//u8g2_DrawHLine(&u8g2, 0, 32, 10);
Expand Down

0 comments on commit 71fb12b

Please sign in to comment.