UIFlow web IDE error after using timer: "Upload code failed"
-
I am trying to use a timer in UIFlow to show the current time. When using "Run" in UIFlow web IDE, it will upload and run the program on Core2 once.
But every time I try to "Run" again, when the program is already running, I get an error in UIFlow web IDE: "Upload code failed, maybe your device is offline check it and retry"
I tried with both the hardware timer and the software timer. I also tried a loop with "Wait 1s". But every time I do this, the UIFlow web IDE can't upload anymore, it worked perfectly before.
What should I change in my code to have the device work with UIFlow web IDE and use a timer to update UI every second?
-
Hi @mb ,
Have you tried uploading the program via serial? -
@mb is device showing as connected still after first "run"? usually should be but if you use upload then wifi block should be included in the code so unit is connected to network, can you try same with uiflow2?
-
@mb This is normal and all you have to do is press the reset button on the core2.
The running program overrides the firmware and blocks accesses to the UIFlow server . -
@robski The device is still connected when I run a "regular" program. It seems still to be connected when running a program with timer or
while true: sleep(1)
, but as soon as I press "Run", theConnected
turns intoDisconnected
.@kuriko Wanted to try serial, but pressed the "Download" button to save the file. Instead it uploaded the program to the device. Funnily it said first "Upload failed", on second try it was successful. So the naming convention (meaning) seems to be different, even within UIFlow ;-) I would have expected for "Download" to save the file to computer, and rather have something like "Upload" to save it as main program on device. MAybe I try this later
@robski Upgraded to UIFlow 2, was surprised to need to register and bind the device. Can't find a button element, cant find a timer, neither software nor hardware.
@ajb2k3 I am aware to be able to reset the device to re-run, but that's not the point. I can edit end re-run a program via WiFi many times. Just the use of timer or
while true: sleep(1)
seems to disable the Wifi connection or the internal software to receive updates from UIFlow web IDE.Will continue to investigate in an hour or so.
-
@mb button, timer etc needs to be added in left hand menu below controller image "software/hardware" in manner you would add module or unit
-
@robski Found and added RTC and Timer. In UIFlow v2 the WiFi connection still works when using the timer and updating a label every second. I can still update and run code.
I started with M5Stack hardware in 2020 and I am a bit surprised that some functions are still not there in 2024 in UIFlow:
-
It seems UIFlow2 lost the "Touch Button" in the GUI designer using rounded rectangle with text and on_touch event.
-
It seems there is no way to design multiple screens or views. It's great to have a graphical GUI designer, but how can you only have one single view and not be able to switch between multiple in designer and via code?
-
It seems there are no graphics functions in UIFlow v2. I want to programmatically draw an analogue clock (circle, 12x dashes, 3x hands), that seems not possible anymore.
-
When using graphics functions, it would be great to be able to draw on screen or on a virtual screen, then updating the real screen as a whole.
Should I create separate "feature requests" for those things?
-
-
@mb you can use hide/show/set based on condition for items on different screens,
I would recommend "VolosR" github/YT for UI design approach but this is arduino mostly, also there is block to run your code in blockly -
@kuriko So I have downgraded to UIFlow v1 firmware on the Core2 again. I started the UIFlow web IDE in Chrome, expected it to have some web serial support (like CircuitPython has a web flasher), but I can not find any settings for USB or serial.
The download page (link) states "Desktop IDE MacOS (update is terminated)", so do I need to run "UIFlow Local Server for MacOS"? The regular UIFlow web IDE only supports WiFi connection?
The local m5burner software worked without a problem with USB
/tty.usbserial
. -
@mb
Yes, what I mean is that Terminal (Beta) orange button. After clicking the connect button, your browser will ask the serial connection and directly send microPython lines to your device via serial. Maybe you can try this to eliminate the network problem. -
@kuriko Wow, this is cool! Core2 UIFlow v1 is in WiFi mode, but with "Terminal (Beta)" I can connect over the USB serial console. The play button will upload and run the current script, even with timers.
Would be very cool if the whole UIFlow web IDE had a setting to just connect via cable. Or if the Terminal play button could be placed somewhere in the IDE, without having the terminal window open all the time.
Side note: The regular UIFlow web IDE play button now shows a green success message "Execute code successfully" when clicked, but the code is actually not running on the device. Either it's not uploaded or not restarted.
-
@mb UIFlow Web predates WEB USB.
You need to use UIFLOW2 for WEB USB