🤖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.
    • 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
                        • lukasmaximusL
                          lukasmaximus
                          last edited by

                          0_1556077238314_Screen Shot 2019-04-24 at 11.39.47.png

                          1 Reply Last reply Reply Quote 0
                          • lukasmaximusL
                            lukasmaximus
                            last edited by

                            which micropython version are you using? if you did a custom flash not from the official m5stack burner you may have forgotten to flash the .spiffs file which contains all the folders and files you want to put on the filesystem

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

                              @lukasmaximus

                              Hey Luke,
                              thanks for getting back to me. I flashed with the flash.sh (I'm on linux) including all the .spiffs file.

                              However, when I try to get I get the following.

                              0_1556078818398_caf04472-80f1-4d4e-96a8-89d0f7ae5bfa-image.png

                              1 Reply Last reply Reply Quote 0
                              • lukasmaximusL
                                lukasmaximus
                                last edited by

                                Strange, which version of the firmware are you using, could you post the log from flash.sh process or the command you used, maybe the files are not getting written to the correct memory addresses, usually it should look like this

                                "--chip esp32 --port %port --baud %baud write_flash -z 0x1000 %PATH\bootloader.bin 0xf000 %PATH\phy_init_data.bin 0x10000 %PATH\MicroPython.bin 0x8000 %PATH\partitions_mpy.bin",
                                "--chip esp32 --port %port --baud %baud --before default_reset --after no_reset write_flash -z --flash_freq 40m 0x170000 %PATH\spiffs_image_0x170000.img"

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

                                  Yep sure will, I'll get it for you tonight.

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

                                    @lukasmaximus

                                    esptool.py --chip esp32 --port /dev/${port} --baud 921600 --before default_reset --after no_reset write_flash -z \
                                    --flash_mode dio --flash_freq 80m --flash_size detect \
                                    0x1000 bootloader.bin \
                                    0xf000 phy_init_data.bin \
                                    0x10000 MicroPython.bin \
                                    0x8000 partitions_mpy.bin \
                                    0x170000 spiffs_image_0x170000.img
                                    

                                    I have a feeling however, I did not do this properly. However everything seems to be working fine besides not being able to get into the system, and not being able to change font..

                                    m5-docsM 1 Reply Last reply Reply Quote 0
                                    • m5-docsM
                                      m5-docs @Foxhound
                                      last edited by

                                      @foxhound Maybe, you need install python2.7 for compiling this firmware. A year ago, I compiled a micropython firmware with python3. And the serial monitor displayed some error which seem like yours.

                                      M5Stack documentation URL

                                      https://docs.m5stack.com

                                      F 1 Reply Last reply Reply Quote 0
                                      • F
                                        Foxhound @m5-docs
                                        last edited by

                                        @m5-docs

                                        Good idea, thanks mate!

                                        Also, can you tell me how to properly change the font? I'm trying to increase the size.

                                        lcd.font(FONT_DejaVu18)
                                        

                                        Doesn't compile

                                         lcd.font("FONT_DejaVu18")
                                        

                                        Doesn't do anything?

                                        ajb2k3A 1 Reply Last reply Reply Quote 0
                                        • 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.:

                                          @m5-docs

                                          Good idea, thanks mate!

                                          Also, can you tell me how to properly change the font? I'm trying to increase the size.

                                          lcd.font(FONT_DejaVu18)
                                          

                                          Doesn't compile

                                           lcd.font("FONT_DejaVu18")
                                          

                                          Doesn't do anything?

                                          lcd.font doesn't work. try something like

                                          from m5stack import *
                                          from m5ui import *
                                          
                                          clear_bg(0x222222)
                                          
                                          
                                          
                                          btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
                                          btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
                                          btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
                                          label1 = M5TextBox(118, 116, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
                                          
                                          
                                          label1.setFont(lcd.FONT_DejaVu24)
                                          

                                          Here I am using a label for text.

                                          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
                                          • lukasmaximusL
                                            lukasmaximus
                                            last edited by

                                            The fonts used on the m5stack are bitmap fonts and therefore are not scalable, they are whatever size they were converted in. A while back on our forums one of our users loboris who is an active developer in the micropython community developed a cool tool to convert any font file in any size you want to a .fon bitmap font format, you cant find it here http://forum.m5stack.com/topic/388/cahnge-font-size-in-python/20

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