Beginner trying to use littlevGL on stm32f103 and OLED monochrome 128 * 64 pixels

Hi embeddedt,

I have #if 0’'ed that code for the time being. Thus avoiding any hint of out of memory for the time being. So I am back to concentrating on just the bar. I would like to display it.
Am I having a problem because I didn’t establish a theme?
Or because I didn’t specify a size for the bar?
Presumably I am not having my whiteout because of the way I’m calling the lv_tick_inc() and lv_task_handler()?

Thanks for your help!

Larry

Exactly what code did you #if 0?

Nothing that should affect anything.

 lv_init();


lv_port_disp_init();

lv_obj_t *scr = lv_disp_get_scr_act( NULL );
lv_obj_t *bar = lv_bar_create( scr, NULL );

#if 0
lv_obj_t *labelNumber = lv_label_create( scr, NULL );

// Now walk the value up and down 0 to 30
for (int count=0; count < 31;  count++ )
{
   lv_bar_set_value( bar, count, LV_ANIM_OFF );

   // Echo the value as a number
   char outputCount[ 10 ];
   sprintf( outputCount, "%d", count );
   lv_label_set_text( labelNumber, outputCount );

   delay_ms( 750 );
}

for (int count=30; count >= 0;  count-- )
{
   lv_bar_set_value( bar, count, LV_ANIM_OFF );

   // Echo the value as a number
   char outputCount[ 10 ];
   sprintf( outputCount, "%d", count );
   lv_label_set_text( labelNumber, outputCount );

   delay_ms( 750 );
}

#endif

while (1)
{
   lv_task_handler();
   lv_tick_inc(1);
   delay_ms(1);
}

Now I have set the mono theme, And the drawing is working, black and white pixels

Hi EmbeddedT,

Now I have the bar drawing YAY but the label that I’m trying to display above the bar, is not legible. It looks like I’m getting the top half of the 25 that I’m trying to display. I have LV_FONT_ROBOTO 16 set to 1 so presumably I’m using that. Should I be able to give alignment of the CENTER to the text? Could I be running into the default padding on the bar?

Thanks again,

Larry

Did you try moving the label up to see if the bar is overlapping it? Otherwise it’s probably an issue with your display driver.

The partial label is appearing at the upper left hand corner (0,0). It may be a driver issue. I am seeing the top halfs I think of the numbers. I gave the bar the BOTTOM_MID alignment so it’s way out of the way. Do you think I need to implement a rounding routine?

I’m not sure. You’ll have to do some experimenting and see if you can find what the problem is. Nothing appears to be wrong with the loop you showed me.

Do setting the alignment or setting the size work for labels?

That shouldn’t be the problem. By default a label shouldn’t be clipping any of its text.

Now I’m putting the label on the screen by itself with this code:
lv_obj_t *labelNumber = lv_label_create( scr, NULL );
lv_obj_set_size( labelNumber, 10, 20 );
lv_label_set_align( labelNumber, LV_LABEL_ALIGN_CENTER );
lv_label_set_text( labelNumber, “25” );

And I am seeing the “25”, but in the upper left hand corner. Is there a way to move the display?

lv_obj_set_pos

Thanks! I suppose further questions need to go to the how-to?

If you’ve gotten it working with your device, then yes. :slight_smile:

Hi, how did you set the mono theme?? I 'm having same trouble when porting mono display. Show your steps to config mono theme. Thanks

Bumping this to hopefully get some additional exposure. Like elite and LAnsell, I’m facing an issue where my color struct always returns black pixels. I have the mono theme set to 1 via the flag in lv_conf and I disabled the non-mono theme flags, but I’m not sure if there’s anything else I should have done to properly initialize. Elite, were you able to find a solution?