Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Foxhound
    3. Posts
    F
    • Continue chat with Foxhound
    • Start new chat with Foxhound
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by Foxhound

    • RE: [Solved]Exceptions & timeouts with GET Requests

      @m5-docs so it turns out I was forgetting to close the response.

      try:
          lResponse = urequests.get( URL , headers = self.fHeaders )
          content = ujson.loads( lResponse.content )
          lResponse.close()
          return abs( content )
      except:
          return 0
      

      Solved the issue.

      posted in Micropython
      F
      Foxhound
    • RE: [Solved]Exceptions & timeouts with GET Requests

      @m5-docs said in Exceptions & timeouts with GET Requests:

      pass

      Thanks for your response, but a little confused with how this differs from mine?

      I'd love to do a timeout, is there a way to write a function that will timeout, similar to eventlib in Python? Or is there a different way I am supposed to be doing a get request that won't block.

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @ajb2k3

      Awesome, of course, I needed to call lcd.FONT_DejaVu24.
      However, I did manage to get lcd.font(lcd.FONT_DejaVu24) to work fine for me. I just called it at the top of my script and all is well.

      @lukasmaximus
      Thanks, I'll take a look at that, so far DejaVu24 is working well for me. But if i need to make it larger I'll be sure to check that out.

      posted in Micropython
      F
      Foxhound
    • [Solved]Exceptions & timeouts with GET Requests

      Hi,

      Thanks everyone on this forum for their help. Currently finishing off my project. However, somtimes my GET request fails, and it's causing my device to crash. What's the proper way to set a timeout or catch an error?

      I'm currently trying the following.

      try:
              lResponse = urequests.get( URL , headers = self.fHeaders )
              content = ujson.loads( lResponse.content )
              return abs( content )
          except:
              return 0
      

      However, this doesn't seem to be solving it. Any pointers would be greatly appreciated.

      Kind Regards,
      Fox

      posted in Micropython
      F
      Foxhound
    • RE: 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?

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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..

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

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

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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?

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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!

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @ajb2k3

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

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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.

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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.

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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.

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      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

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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.

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @ajb2k3

      Sorry mate, Change the ID code?

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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

      posted in Micropython
      F
      Foxhound
    • RE: Continue to try Wifi Connection indefinitely, and go back to the connection/reboot if a try fails.

      @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.

      posted in Micropython
      F
      Foxhound
    • RE: 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.

      posted in Micropython
      F
      Foxhound