Label disappears
-
I have been banging my head against the following for the past few hours.
Device: Core2 running 1.9.8
Tool: UIflow (1) running V1.13.5When using the run functionality from UIflow everything works as it should. The reason it does is that the WiFi is already connected. When I then download the code into the device it needs to connect to WiFi on a normal run. After connecting to it my label is gone and I cannot seem to find any way to get its text to show again.
As an example, this works fine using run:
Or in code:
from m5stack import * from m5stack_ui import * from uiflow import * import wifiCfg import time import unit screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) pbhub_0 = unit.get(unit.PBHUB, unit.PORTA) Status = M5Label('Status', x=0, y=0, color=0x000, font=FONT_MONT_26, parent=None) if not (wifiCfg.wlan_sta.isconnected()): wifiCfg.autoConnect(lcdShow=False) while True: Status.set_text('0') wait(1) Status.set_text('1') wait(1) wait_ms(2)
Using download and letting the device start the program this shows the WiFi connecting and afterwards nothing happening on screen. If need be I can draw stuff on screen through the graphic blocks, including text, but my label remains gone.
Things I have tried:
- pretty much anything in the label section
- setting the background color
- Lcd.clear / Clear screen (followed by pretty much anything above)
- using the disconnect from "Original Network Function" and then a connect in hopes I can make this reproducible when using 'Run' (no luck) so I can at least diagnose it more easily
I'm out of ideas, does anybody have any idea what might be going on?
-
@cerietke I didn’t try your code yet, but the first thing I would do is get your core2 updated to 1.13.5 via M5 Burner.
Update - just tested your UiFlow code and it works fine on my Core2. I usually load my WiFi credentials when I burn the firmware via M5 Burner. I’m not sure how you are connecting to WiFi using your code without using the SSID and PASSWORD block
-
@earla I forgot to mention: I used an older copy of the burner program because the current one kept crashing on me saying it is missing some file. I had assumed the older one would still be able to get the most recent version to burn and I neglected to confirm that; 1.9.8 is the most recent it offers. Will look into that today, thanks for the suggestion.
It does offer to set the WiFi details, so that's what I have been using. Presumably my code would not need ssid/pass because of that?
I have been using these Core 2's for a couple of years. All I really wanted to do is move them to a different MQTT broker. The above approach used to work with even older firmware that was on there.
-
@cerietke You haven't set it to connect to the WIFI yet and so the response will never bee returned.
When you use Run the WIFI is already connected and so works but when you download the code to the core and run it, wifi is not activated because you haven't told it to connect to anything. -
Unfortunately this is what I get on the latest M5Burner software.
Right after the setup block I do an "if not connected to WiFi, connect to WiFi" if statement. I would imagine that would connect it to WiFi (and in fact I can be sure it does because I see messages arrive on MQTT when I run the bigger block of code, even if I don't see the text on screen). Am I perhaps misunderstanding you?
-
Apparently running as admin fixes the error somehow. Trying to move to a newer firmware now.
Even works without running as admin now. It did tell me an update was done and that I needed to restart it, so guessing it somehow got that patch applied with more rights and was fine after. EDIT: I celebrated too soon, without admin rights it couldn't download the firmware file, so need to run it as admin to progress. Currently burning the newer firmware.
@earla Seems to run as expected with the newer firmware, thanks for the suggestion!
-
Now that things seem to work: is there a really pressing reason to migrate to UIFlow2.0?
My ultimate goal is to eventually start running openHASP on them and remotely control what they display through Home Assistant, so ideally I do no extra coding, but maybe there's a security concern or something that should change my mind?