I am using micropython on a M5Stack tough. Without evidence by documentation, I assume that the UI is running in a different thread than the rest of the micropython application, because it seems that both - the application and its ui can crash individually, without tearing the other down.
Does anybody know about this?
The reason I am asking is because I need a reliable watchdog system which ensures that the system comes back up again if something is crashed. At the moment I only activated the watchdog in the main program and a crash in the UI function does not stop the execution.
Any ideas how I could solve that?
insaneLX
@insaneLX
Posts made by insaneLX
-
How to ensure a working watchdog? Micropython UI crashes, but the rest keeps running and the other way round
-
How to set advanced properties for UI elements (styles) and get more information on micropython modules
Hi,
I was a bit frustrated with the documentation of the UI elements, so I started digging. I wanted to share the information I found with other beginners like me so they won't need to spend the 2-3 hours I did spend to set the border colour of a button.
Trick 1: you need to understand that the M5stack_ui are basically the micropython bindings of LVGL (version 7). This means whatever you need to know, you can find in the LVGL documentation.
Trick 2: as the documentation of the python modules on the M5Stack page is incomplete, it helps to inspect the actually implemented functions by using something like:
btn = M5Btn()
print(dir(btn))which returns:
['class', 'init', 'module', 'qualname', 'dict', 'cb', 'delete', 'get_state', 'obj', 'set_align', 'set_bg_color', 'set_cb', 'set_hidden', 'set_pos', 'set_size', 'style', 'set_btn_text', 'set_btn_text_color', 'set_btn_text_font', 'pressed', 'released', 'callback', 'btn_text', 'btn_label_obj'This shows, for example, that there is actualy the function set_btn_text implemented (which is not documented), and that we have the "obj" attribute which allows us to modify all of the objects parameters.
Result:
As an example, to create a button with a specific corner radius and the border colour set, you need to create a style, set the parameters of the style and the apply the style to the object:btn = M5Btn(text="--", x=180, y=70,w= 120, h=100, bg_c=UI_BTN_CLR ,text_c=UI_TEXT_COLOUR ,font=FONT_MONT_38)
se_style = lv.style_t() # create the style
se_style.set_border_color(lv.STATE.DEFAULT,lv.color_hex6(UI_BTN_CLR))
se_style.set_radius(lv.STATE.DEFAULT,8)
btn.obj.add_style(btn.obj.PART.MAIN,se_style) # add it to the btn parent objectHope this is helpful to somebody (even though no one asked...)
-
M5Unified Documentation
Hi everyone,
I did the first project in micropython, but now I find it is too limiting for my needs and would like to go to an ESP-IDF based implementation. I am using the M5Stack Tough device. I have to say I am a bit lost, because I have no idea where to find the API reference for the unified library. I looked around literally for hours, but couldn't really find a comprehensive documentation.
Is there documentation? If so, please point me to it, if not please tell me how you (other users) started using the libraries?regards,
Alex
-
Modbus access is very slow in Micropython / UIFlow libaray
Hi there,
I am experiencing very slow modbus access times which are (I am quite suire) not caused by the slow data transfer, but must be something else in the stack. I set multiple coils, read two registers and read multiple inputs. Each access takes about 400ms (estimatedd). I set the timeout to 200ms. I am using modbus on the RS485 bus. I am sniffing the data so I am sure, that the response from the addressed devices comes swiftly - I would say with about 10ms delay, so that is not the problem. Did anyone experience similar issues? Do you have a solution?
Alex
-
RE: Removing the UIFLOW menue on Tough
@iamliubo Thanks for the tip, but it didn't help.
@pandian-nano. Also the new version 1.12.0 did not improve things. Are you sure it was fixed? -
RE: Removing the UIFLOW menue on Tough
@pandian-nano
Thanks a lot. Any timeline for that release 1.12.0? -
RE: Modbus Master crashes and missing documentation
A list it is!
try:
ret = modbus.write_multiple_coils(comms.DEVICE_ADDRESS, 0,(
sig.smoke_flap,
sig.transport,
sig.ignition,
sig.smoke_fan,
sig.extinguish,
sig.flood,
sig.ember_air,
sig.alarm
), timeout=200)works nicely.
-
RE: Removing the UIFLOW menue on Tough
That sounds promising. I am not too lazy to google around, but I didn't find any specific information to what you are indicating. Could you point me to more details?
-
Removing the UIFLOW menue on Tough
Hi,
This was already reported a few times. But it is important (to me) so I repost.
On Version 1.11.9 the UIFlow menue still comes at boot, even if it is disabled. There are some posts with respect to that in the forum, but no real solution. To me this is a real showstopper using UIFLOW practically.
Is there any solution to this (other than switching to ESP IDF and C++ ? )