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

    Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

    Micropython
    5
    36
    130.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.
    • ajb2k3A
      ajb2k3 @Foxhound
      last edited by

      @foxhound said in Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.:

      @heybin said in Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.:

      @foxhound said in Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.:

      i

      In main.py, add Wi-Fi ping router in your loop code, if ping fail, reconnect

      @ajb2k3 said in Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.:

      @foxhound Have you thought about adding something like

        if False:
          pass
        else:
          pass
      

      In order to create a time out function?
      You could then use the else: pass function to get the program to exit and return to the wifi select function.

      Hi Everyone, thanks for your replies. I'm a little bit confused, and I may be using the wrong firmware.

      What's the difference between m5go and m5cloud? I'm using m5cloud-psram-20180323-v0.3.8.bin as my firmware.
      Are they related?

      My boot.py is very different from the only boot.py I can find, inside M5GO.

      # This file is executed on every boot (including wake-boot from deepsleep)
      import sys
      sys.path[1] = '/flash/lib'
      from m5stack import lcd, speaker, buttonA, buttonB, buttonC
      
      # ---------- M5Cloud ------------
      if True:
          if buttonB.isPressed():
              lcd.println('On: OFF-LINE Mode', color=lcd.ORANGE)
          else:
              import wifisetup
              import m5cloud
      

      I cannot find that m5cloud anywhere. Also not sure where it calls main.py from so I can exit out of it.
      If that's the same wifisetup.py in M5GO, I should be able to modify that to continue to try connecting.
      My understanding is that M5cloud is depreciated and M5Go/uiflow is the current firmware.
      I haven't delved too far into Micropython yet but I'm read that main.py is always the first python called.

      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!

      F 1 Reply Last reply Reply Quote 0
      • F
        Foxhound @ajb2k3
        last edited by

        @ajb2k3

        Perfect, thanks for getting back to me on this. I'm not going to get to my comptuer for another 24hours give or take, but I'll flash the new firmware then and go from there.

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

          @foxhound no worries i’m In and out of the forum most of the time and try to help out when I can.

          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
          • F
            Foxhound
            last edited by

            @ajb2k3

            Hey mate, been a little caught up sorry. I flashed the latest m5Go Image/firmware from here. Obviously I can no longer see it in the cloud interface. How can I upload my code and make modifications to the Wifi? It's puzzling me a bit.

            THe M5Cloud image was fine besides the font size wouldn't change, and on top of that, I couldn't find the Wifi to modify.

            Thanks again for your help.
            Adam

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

              @foxhound Did you remember to change the ID code of the the M5go after flashing?
              UIFlow has been a bit buggy lately and several members have reported issue with connections dropping out between UIFlow and the M5stacks and M5Sticks..

              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!

              F 2 Replies Last reply Reply Quote 0
              • F
                Foxhound @ajb2k3
                last edited by

                @ajb2k3

                Sorry mate, Change the ID code?

                1 Reply Last reply Reply Quote 0
                • F
                  Foxhound @ajb2k3
                  last edited by

                  @ajb2k3

                  I feel I am missing something. I have written most of my code using M5Cloud. I have two issues, the fonts won't change (I need larger text), and I need to modify the Wifi Setup so I can keep trying if it doesn't boot. I am using an M5 Stack Fire.

                  I need to know which image I should be using (there seems to be a lot), and what is the best/proper way for me to put my code on it.

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

                    @foxhound the current firmware in 1.2.3 en for the M5Stack Fire.
                    I wasn’t aware the M5Cloud still works.
                    UIFlow is the current IDE and has a blocky and Micropython.

                    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
                    • F
                      Foxhound
                      last edited by

                      Interesting, mind throwing me a link to that firmware.

                      FWIW, what I'm currently using, I setup Wifi and then get to here, where nothing happens (besides io.m5stack.com/#/<id> opening) when I scan it

                      alt text

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

                        @foxhound on the computer or phone connect to the new M5Stack network and type in the address. This open a page on the M5Stacks internal micro server that allows you to set the M5Stack into station mode connected to your network. Select your network and insert the password and it should connect and restart disconnecting the M5Stack’s internal network. A new page should show up giving The M5Stack’s is code.
                        In the UIFlow tutorial section is a link to my documents that have a guide to setup, there is an issue with enterprise networks

                        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!

                        F 1 Reply Last reply Reply Quote 0
                        • F
                          Foxhound @ajb2k3
                          last edited by Foxhound

                          @ajb2k3

                          Thanks mate, I've followed this; however this is where it lands me after I've connected it to a network (and it's disconnected the M5Stack's internal network). I never get the ID code. DO you have a link to the 1.2.3 firmware you mentioned?

                          I suspect there is an issue with the firmware I am using. I will look for your guide now. Have you got a link to it?

                          Thankyou so much for your help, I really appreciate it.

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

                            @foxhound https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/software/M5Burner_MacOS.zip
                            or
                            https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/software/M5Burner.zip

                            when the downloader fully fils the black circle, wait 20 seconds then press the red button on the m5 stack to reset it then press button C to access setup.
                            Strange that yours isn't showing the ID code as I've just updated mine and they worked properly.

                            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!

                            F 1 Reply Last reply Reply Quote 0
                            • F
                              Foxhound @ajb2k3
                              last edited by

                              @ajb2k3

                              Thanks for this, it looks like in the link I can run the script to flash it using that flash.sh script, as I am on linux.

                              I couldn't find these this is really useful, thanks mate. I'll be home from my office soon to give it a go. Thanks.

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

                                @foxhound Did you get the connection Successful message when trying to connect?

                                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!

                                F 1 Reply Last reply Reply Quote 0
                                • F
                                  Foxhound @ajb2k3
                                  last edited by

                                  @ajb2k3

                                  Woohoo!! Thanks so much mate, finally in and have placed my code into the UI Flow Python Editor and have started running it :)

                                  Couple of questions related to my original question regarding wifi.

                                  1. How do I permenantly save the code to my device. I can run it, but I when I reboot it doesn't boot into my code again.
                                  2. Secondly, how on boot can I edit it so it automatically tries to reconnect if the Wifi isn't found.

                                  Thanks so much for your help, really appreciate it.

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

                                    @foxhound

                                    In the top right hand corner is an icon with 3 horizontal lines, click on that then click on "Download" to permanently save to the M5Go.

                                    I do believe that you use

                                    import wifisetup
                                    wifisetup.auto_connect() 
                                    

                                    at the beginning of the file above the

                                    from m5stack import *
                                    from m5ui import *
                                    

                                    Alternatively, save the file as main.py and copy it to the M5Stack using ampy.

                                    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!

                                    F 2 Replies Last reply Reply Quote 0
                                    • F
                                      Foxhound @ajb2k3
                                      last edited by

                                      @ajb2k3

                                      Awesome, thanks, I'll give this a go.

                                      1 Reply Last reply Reply Quote 0
                                      • F
                                        Foxhound @ajb2k3
                                        last edited by

                                        @ajb2k3
                                        Okay awesome, thanks mate, have it working well now. Just need to make some modifications.

                                        Auto connect seems to only work when called, and looks like it will throw an error if not connecting. I've found the code on the repo, so I'll modify that to continue trying when booting up if no wifi is found, and upon disconnection, call the function again.

                                        Won't get much time to work on it for a little bit but will report back next week with my progress. Thanks very much for your assistance.

                                        Also, download didn't work but ampy working really well now, thankyou!

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

                                          @foxhound Glad to hear that I could help.

                                          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!

                                          F 1 Reply Last reply Reply Quote 1
                                          • F
                                            Foxhound @ajb2k3
                                            last edited by

                                            @ajb2k3

                                            Quick one, do you know where the source code for m5base is?

                                            ALso, with ampy, have you been able to get into directories past /flash.

                                            WHenever I try and list things inside say lib(/flash/lib), it say it isn't a directory?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post