🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    UI Flow 2.0 Switching back from main.py to the config&launch app

    UiFlow 2.0
    3
    3
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sistar_hh
      last edited by

      Hi,
      I just started with an Core S3 and UIFlow 2.0. I am absolutely delighted about the OTA feature.
      One thing I could not find out by extensive research:
      When I once use the button "Download the button to the device" I cannot get back to the initial configuration UI.
      It appears like there is a main.py saved to the Core S3 and whenever it boots this is executed.
      Am I missing something - i tried all kinds of key-pressing during boot?

      An related question - I would like to connect via MQTT to a server. Do I need to initialize Wifi inside my app? Obviously the device is online itself as this enables OTA. If I should use the configured WIFI - is it possible to try to connect to a fallback WIFI-Network in case the configured Network is not available (I plan to use the device in a mobile scenario).

      Thanks for Your help!
      Ralf

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @sistar_hh
        last edited by

        @sistar_hh 1
        This is normal, as download premaritally set the program to start on boot.
        To reset you have to use M5Burner to change the boot configuration.

        Yes, OTA only work in test mode (the "> Run" button if you download, wifi is not activated an you will need to manually activate the wifi interface and connect to the target wifi.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • Y
          yarixx
          last edited by

          @sistar_hh and every one who reads this in the future )))

          If you set in your program:

          Boot option set to 'Run main.py directly'
          set_boot_option(0)

          it will be executed by default on boot.

          But! If you press G0 (BtnA) button as soon as the device is powered on, then the default UIFlow2 app will be started.

          I've found it in https://github.com/m5stack/uiflow-micropython/blob/master/m5stack/fs/user/boot.py

          """
          boot_option:
              0 -> Run main.py directly
              1 -> Show startup menu and network setup
              2 -> Only network setup
          
          Quick reference:
              when use uiflow2.m5stack.com website, click RUN button to run workspace
              code, boot_option won't change, if you click DOWNLOAD button to download
              workspace code to device, boot_option will change to 2, it means after
              download code done, device will auto reboot and won't show startup menu, 
              only do the network connect, but after network connect success, you can
              still download or run workspace code. If you don't want do anything after
              boot, you can delete this whole file. If you want show startup menu again,
              you can hold BtnA(most device) and click reset button or repower device
              until show the startup menu(for those devices with screens, and this is a
              temporary method and may change in the future), after that the boot_option
              will change to 1, so next time still will show the startup menu.
          
              BTW, the network connection time has a default timeout (60s), you can modify
              the following definition to change this default value.
          """
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post