Pycom STA_AP scan not working
Opened this issue · 1 comments
The board I'm using is a TTGO T-BEAN V1.1 and also a V1.0
The firmware I've tried are:
v1.20.2.r4-tbeamv1
v1.20.2.rc6-tbeamv1
v1.20.2.rc3-tbeamv1
v1.20.1.r2-tbeamv1
So my project goal is to build a collision detection system for vehicles. Each vehicle has a t-beam which constantly scans for surrounding Wi-Fi networks. Once a matching SSID is found, the RSSI is evaluated and the driver notified of his/her surroundings.
My issue is as follows; due to the fact that I need LoRaWAN, I've opted to use pycom firmware because it provides OTAA capabilities.
My issue is I am unable to have a Access Point and Station at the same time as like with Micropython. My Micropython code looks as follows:
ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid=ssid, password=password, channel=11, authmode=3)
while ap.active() == False:
pass
print('Connection successful')
print(ap.ifconfig())
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
while 1:
available_networks = wlan.scan()
for net in available_networks:
if net[0][0:7] == b'mySSID':
"do something"
When I declare my WLAN mode in STA_AP I get "OSError: Scan operation Failed!" with the following Pycom code:
import pycom
import network
pycom.wifi_on_boot(False)
ap=network.WLAN(mode=network.WLAN.STA_AP, ssid="hellooo")
wlan=network.WLAN(mode=network.WLAN.STA)
while 1:
print(wlan.scan())
I am able to have an AP and connect to another network, however, the scan operation does not seem to work. I do not wish to connect to another network and thus connecting isn't an option.
Any advice or help would be appreciated.
The board I'm using is a TTGO T-BEAN V1.1 and also a V1.0
The firmware I've tried are:
v1.20.2.r4-tbeamv1 v1.20.2.rc6-tbeamv1 v1.20.2.rc3-tbeamv1 v1.20.1.r2-tbeamv1
So my project goal is to build a collision detection system for vehicles. Each vehicle has a t-beam which constantly scans for surrounding Wi-Fi networks. Once a matching SSID is found, the RSSI is evaluated and the driver notified of his/her surroundings.
My issue is as follows; due to the fact that I need LoRaWAN, I've opted to use pycom firmware because it provides OTAA capabilities. My issue is I am unable to have a Access Point and Station at the same time as like with Micropython. My Micropython code looks as follows:
ap = network.WLAN(network.AP_IF) ap.active(True) ap.config(essid=ssid, password=password, channel=11, authmode=3) while ap.active() == False: pass print('Connection successful') print(ap.ifconfig()) wlan = network.WLAN(network.STA_IF) wlan.active(True) while 1: available_networks = wlan.scan() for net in available_networks: if net[0][0:7] == b'mySSID': "do something"
When I declare my WLAN mode in STA_AP I get "OSError: Scan operation Failed!" with the following Pycom code:
import pycom import network pycom.wifi_on_boot(False) ap=network.WLAN(mode=network.WLAN.STA_AP, ssid="hellooo") wlan=network.WLAN(mode=network.WLAN.STA) while 1: print(wlan.scan())
I am able to have an AP and connect to another network, however, the scan operation does not seem to work. I do not wish to connect to another network and thus connecting isn't an option.
Any advice or help would be appreciated.
Adding time.sleep(5) solved the issue. Unfortunately I have no idea why.
import time
from network import WLAN
wlan=WLAN(mode=WLAN.STA_AP, ssid="teste", auth=(WLAN.WPA2, 'passpass'))
time.sleep(5)
while 1:
print(wlan.scan())