Hi,
I’ve been searching all over to find a way to use lv_disp_get_inactive_time(disp) in Micropython. Can’t find it.
I’m using the T-watch-2020 esp32 microcontroller v1.
I currently have below:
import lvgl as lv
if lv.disp_get_inactive_time > 2000:
power.clearIRQ()
watch.tft.backlight_fade(0)
watch.tft.display_sleep()
update_task.set_period(300000)
Above does not work.
Should it be inside a particular function? I don’t have a reference for the Micropython binding.
Please help.
Thx.
disp = lv.disp_get_default()
t = disp.get_inactive_time()
Docs covers most Micropython functionality, with many Micropython examples. See https://docs.lvgl.io/
The docs are oriented for the C audience, but for specific Python functionality you can also try “help” with specific class, object, or the entire lv
module.
For example:
>>> help(disp)
object struct lv_disp_t is of type lv_disp_t
__SIZE__ -- 348
__cast__ -- <classmethod>
__cast_instance__ -- <function>
__dereference__ -- <function>
dpx -- <function>
drv_update -- <function>
remove -- <function>
set_default -- <function>
get_hor_res -- <function>
get_ver_res -- <function>
get_antialiasing -- <function>
get_dpi -- <function>
set_rotation -- <function>
get_rotation -- <function>
get_next -- <function>
get_draw_buf -- <function>
get_scr_act -- <function>
get_scr_prev -- <function>
get_layer_top -- <function>
get_layer_sys -- <function>
set_theme -- <function>
get_theme -- <function>
set_bg_color -- <function>
set_bg_image -- <function>
set_bg_opa -- <function>
get_inactive_time -- <function>
trig_activity -- <function>
clean_dcache -- <function>
Got it.
On my ttgo twatch-2020 it should be:
ttgo.lv.disp_t.get_inactive_time(ttgo.lv.disp_get_default())
Thx
amirgon
August 10, 2021, 11:17am
#4
Better use the object instead of the class.
So instead of using lv.disp_t
you can use the disp object itselt:
ttgo.lv.disp_get_default().get_inactive_time()
Yes,
That is better.
Thx for the tip.