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

    Wifi Invalid Mode

    Scheduled Pinned Locked Moved UiFlow 2.0
    3 Posts 2 Posters 2.1k Views
    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.
    • J Offline
      JensH
      last edited by

      Hi All,

      I have an issue where, if I create this as main.py, I will get an error when I try to start my M5 paper. The error is Wifi Invalid Mode.

      My script is below. I have the same configuration in M5 burner and it seems to correctly trying to start main.py as I get the error straight away. If I chose to show the menu at start up then I can see the M5 paper in UIFlow 2 and I can see the device has connected to my account. Any ideas? It's a bit of a pain having choose the app from the applist on the devices screen, but I can run it like that. My app is a bit more complicated than this but this script does the same thing:

      import os, sys, io
      import M5
      from M5 import *
      import network

      label0 = None
      wlan = None

      def setup():
      global label0, wlan

      wlan = network.WLAN(network.STA_IF)
      M5.begin()
      Widgets.fillScreen(0xeeeeee)
      label0 = Widgets.Label("label0", 124, 542, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu18)

      wlan.connect('network', 'testtesttest')
      label0.setFont(Widgets.FONTS.DejaVu24)
      label0.setText(str(wlan.ifconfig()[0]))

      def loop():
      global label0, wlan
      M5.update()

      if name == 'main':
      try:
      setup()
      while True:
      loop()
      except (Exception, KeyboardInterrupt) as e:
      try:
      from utility import print_error_msg
      print_error_msg(e)
      except ImportError:
      print("please update to latest firmware")

      Thanks,

      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue @JensH
        last edited by

        Hello @JensH

        please check my example in UIFlow2 Project Zone: M5Paper_WLAN_Test_UIFlow2.2.5

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          JensH @felmue
          last edited by

          @felmue

          Thanks Felix. I've added the same delay as in your code and that has fixed my issue. I still have an error in the terminal if I have it connected to my PC but at least the app is functioning now and I can restart my M5 Paper straight into the app.

          Thanks very much for your help.

          J

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post