After updating to v7 the default style for a linemeter doesn’t match the expectation set by the docs.
What MCU/Processor/Board and compiler are you using?
Unix Micropython port
What do you experience?
Style like this (ignore label):
In a previous version (before recent v7 merge of lv_micropython master), the default linemeter widget style reflected what is shown in the docs. After the merge, the style appears to be missing the theme defaults. I started looking through the underlying changes and noticed references to LV_DPX, which do not seem to be exposed to in lv_micropython, making an “easy fix” un-obvious to me.
What do you expect?
Style as shown @docs.lvgl.io/v7/en/html/widgets/linemeter.html#simple-line-meter
# Highlighted meter line segments
lmeter.set_style_local_line_width(lmeter.PART.MAIN, lv.STATE.DEFAULT, 4)
# Unhighlighted meter line segments
lmeter.set_style_local_scale_end_line_width(lmeter.PART.MAIN, lv.STATE.DEFAULT, 3)
# Meter line segment length
lmeter.set_style_local_scale_width(lmeter.PART.MAIN, lv.STATE.DEFAULT, 10)
# Line segment offset from outer radius?
pad = 1
lmeter.set_style_local_pad_top(lmeter.PART.MAIN, lv.STATE.DEFAULT, pad)
lmeter.set_style_local_pad_left(lmeter.PART.MAIN, lv.STATE.DEFAULT, pad)
lmeter.set_style_local_pad_right(lmeter.PART.MAIN, lv.STATE.DEFAULT, pad)
Ah, yes, it seems I missed lv.dpx - thank you for pointing this out.
At the risk of diverting the conversation, as of this writing I’m unable to build lv_micropython on master, which is not the case on the release/v7 branch. I’m running on Mac 10.13 (darwin 17.7.0) with system clang 9.0.0. Using the branch I am able to build, I get the result originally shown above, rather than the one the simulator is showing.
Sure, see the message below after running make -C ports/unix. I did make sure to verify this was only true after switching branches (by running a fresh build on either side of the switch) and re-running git submodules update --recursive:
LVGL-GEN build-standard/lvgl/lv_mpy.c
GEN build-standard/genhdr/mpversion.h
GEN build-standard/genhdr/moduledefs.h
GEN build-standard/genhdr/qstr.i.last
In file included from ../../lib/lv_bindings/driver/SDL/modSDL.c:8:
In file included from ../../lib/lv_bindings/driver/SDL/SDL_monitor.h:19:
In file included from ../../lib/lv_bindings/driver/SDL/lv_drv_conf.h:14:
In file included from ../../lib/lv_bindings/../../lib/lv_bindings/lvgl/lvgl.h:35:
In file included from ../../lib/lv_bindings/../../lib/lv_bindings/lvgl/src/lv_misc/lv_printf.h:61:
/usr/include/stdio.h:299:50: error: invalid token at start of a preprocessor expression
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
^
1 error generated.
Yes, it looks like that fixes the build for me. I still see the line meter style differs from the simulator though.
Here are a couple possible red herrings I see during the build:
CC ../../lib/lv_bindings/lvgl/src/lv_themes/lv_theme_material.c
../../lib/lv_bindings/lvgl/src/lv_themes/lv_theme_material.c:316:60: warning: comparison of constant
50 with expression of type 'lv_disp_size_t' is always true
[-Wtautological-constant-out-of-range-compare]
lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
../../lib/lv_bindings/lvgl/src/lv_themes/lv_theme_material.c:319:70: warning: comparison of constant
50 with expression of type 'lv_disp_size_t' is always true
[-Wtautological-constant-out-of-range-compare]
lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? L...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
That’s strange.
You say you ran git submodules update --recursive and rebuilt lv_micropython, right?
Just to make sure, could you cd to lib/lv_bindings/lvgl and run git log -1?
I would expect the commit hash to be 416ef9e251d39dba291b86eab9ad7c1a22ff2e8d
You can also try to git pull on lib/lv_bindings/lvgl to get latest (master) version of lvgl, there seem to be some updates specifically for line meter, although I don’t think they are relevant to this problem.
I don’t think these are related to this problem, but LVGL maintainers should probably get aware of this.
@kisvegabor / @embeddedt maybe worth running clang on the CI with -Wall to identify problems that are not reported by gcc.
Previous HEAD position was 416ef9e2... fix chart series area invalidation
HEAD is now at 43a77d86... linemeter: fix arc drawing if the value is close to max value
I then proceeded with the build from there, with the same result.
@kdunn926 I really don’t know why you are seeing a difference in line meter style between the simulator and Mac.
When I build it on Linux I don’t experience this problem. The Micropython Unix port built on Linux yields the same results as the web simulator.
The only thing I can think of is some environment problem on Mac, partial build, or lv_conf.h which is not up to date.
Could you try cloning a fresh lv_micropython repo and try again?
Do you have access to a Linux machine where you can try to reproduce the problem and compare the results?
Another thing you can try is building an lvgl C application with the same lvgl submodule and see if this problem persists, to see if this problem is related to Micropython or to LVGL core.
@amirgon, I did a fresh checkout and built with the same result. I was able to use the “PC simulator” lv_sim_eclipse_sdl to run lv_ex_linemeter_1(); and the style is correct under that configuration.