Please,How do I solve the network problem?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ws28422863
Posts: 4
Joined: Wed Nov 13, 2019 3:40 am

Please,How do I solve the network problem?

Post by ws28422863 » Sat Feb 08, 2020 1:45 pm

Image

You cannot interrupt and enter instructions in putty, it will continuously repeat the content on the picture

This is my wifi connection

Code: Select all

import network
def connectAP(ssid, pwd):
    
    wlan = network.WLAN(network.STA_IF)
    if not wlan.isconnected():
        wlan.active(True)
        wlan.connect(ssid, pwd)
        
        while not wlan.isconnected():
            pass
    print('network config:', wlan.ifconfig())

thank you!

kevinkk525
Posts: 647
Joined: Sat Feb 03, 2018 7:02 pm

Re: Please,How do I solve the network problem?

Post by kevinkk525 » Sat Feb 08, 2020 3:29 pm

Apparently it doesn't find your AP so it never connects?
Therefore it doesn't stop printing those messages, unless you issue wlan.active(False)

A small note, use this instead of a busy loop:

Code: Select all

while not wlan.isconnected():
            time.sleep_ms(50)
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

ws28422863
Posts: 4
Joined: Wed Nov 13, 2019 3:40 am

Re: Please,How do I solve the network problem?

Post by ws28422863 » Sun Feb 09, 2020 10:12 am

kevinkk525 wrote:
Sat Feb 08, 2020 3:29 pm
Apparently it doesn't find your AP so it never connects?
Therefore it doesn't stop printing those messages, unless you issue wlan.active(False)

A small note, use this instead of a busy loop:

Code: Select all

while not wlan.isconnected():
            time.sleep_ms(50)
Thanks for your reply
So if time.sleep_ms (50) is used, will it not be infinitely reincarnation?
Because I want to test without finding the AP

kevinkk525
Posts: 647
Joined: Sat Feb 03, 2018 7:02 pm

Re: Please,How do I solve the network problem?

Post by kevinkk525 » Sun Feb 09, 2020 11:07 am

No, time.sleep() doesn't change the behaviour. It is just the recommended way.

The messages in the repl are just debug messages, you can ignore them in your program. if you are writing to the repl, use wifi.active(False) to disable your wifi and they will go away.
There should be a command for disabling the esp-idf debug messages (something like esp.debug....) but I forgot the command, sorry.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

kevinkk525
Posts: 647
Joined: Sat Feb 03, 2018 7:02 pm

Re: Please,How do I solve the network problem?

Post by kevinkk525 » Sun Feb 09, 2020 1:30 pm

jimmo wrote:
Sun Feb 09, 2020 1:28 pm
The log messages come from the ESP32 IDF.
I think some of these messages can't be turned off due to bugs with the way the IDF log level checking works, but there is some control of this using esp.osdebug

e.g.

Code: Select all

import esp
esp.osdebug(esp.LOG_NONE)
I don't normally use esp32 other than when I was working on BLE support. I remember I found the logging fairly inconsistent. I'll double check when I check the write truncation tomorrow.
This might be it
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
jimmo
Posts: 1435
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Please,How do I solve the network problem?

Post by jimmo » Sun Feb 09, 2020 1:32 pm

It's esp.osdebug -- I just happened to mention to look that up for a different thread, see viewtopic.php?f=18&t=7719#p44072

(But like I said there, the IDF logging doesn't always check the value of this option...)

(Ah, sorry Kevin, looks like you just beat me to it :) )

Post Reply