Skip to content

ipv4_address_ap not available immediately #9855

Description

@stanelie

CircuitPython version

Adafruit CircuitPython 9.2.0 on 2024-10-28; Waveshare ESP32-S3-Zero with ESP32S3

Code/REPL

import wifi
import ipaddress

ip_address_str = 0

ipv4 = ipaddress.IPv4Address("2.0.0.2")
netmask = ipaddress.IPv4Address("255.0.0.0")
gateway = ipaddress.IPv4Address("2.0.0.1")

def create_wifi_AP():
    wifi.radio.set_ipv4_address_ap(ipv4=ipv4, netmask=netmask, gateway=gateway)
    wifi.radio.start_ap("potato", "barbecue_chips", channel=1, max_connections=4)
    banana = str(wifi.radio.ipv4_address_ap)
    
create_wifi_AP()
ip_address_str = wifi.radio.ipv4_address_ap
print(f"my IP addr: {ip_address_str}" )

Behavior

If I run this code, it prints out the correct IP address in the console.
However, if I comment out the line 13 (the line that starts with banana), it prints out "my IP addr: None", the ipv4_address_ap is empty.

Description

Is this a bug? Or expected behavior? I was trying to get the ip address from the wifi radio and it took me a while to figure this out. Maybe there is something that I don't get...

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions