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?
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++ ? ) -
RE: Modbus Master crashes and missing documentation
Felix, thanks for the reply.
I was trying to use the write_single_coil as workaround. I wanted to use the write multiple coils function. But it does not have a parameter to set the number of coils to be written and the documentation is less than complete. Any ideas? How does the system know what to write? -
Modbus Master crashes and missing documentation
Hi,
I am trying to create a modbus master application in micropython. I cannot figure out how to use the write_single_coil register as I get a ValueError: Illegal coil value when using following line:
modbus.write_single_coil(1,0, 1, timeout=500)Also, the documentation on Modbus is really flaky - can you point to some examples or maybe the source code of the implementation so I can look it up?
-
RE: M5STack Tough in reboot loop when using UIFlow - Duplicated post
Thank's that solved it!
-
M5STack Tough in reboot loop when using UIFlow - Duplicated post
I am duplicating the same post I put in the Products forum because this may be the better place to discuss.
Hello Forum, M5Stack team,
I have two M5Stack Tough units. After flashing with the UI Flow Software 1.9.8 (also tried 1.9.6) the units work fine first, but then after some programming in micropython they stop working and if I reset or power on they enter a reboot loop where the unit boots until the UI Flow logo, sometimes until the audible ping, but then resets again.
Flashing with different software works. So the units do not seem to be damaged physically.
Supplying with 12V through the RS485 connector does not change the behavior.Any ideas?
-
M5 Stack Core2/Tough tempered glass screen protector
Hi everyone,
I googled around but did not find any temepered glass screen protectors for the Tough or Core2 (only TPU ones)
Is anyone aware of such a product?regards,
Alex
-
M5Stack Tough product lifetime
Hi,
I am planning to use the M5Stack tough for a professional application. What is the product lifetime policy (obsolesence) of M5Stack?
Is there any information from product managment regarding this?Alex