Skip to content

esp32,esp8266: Change network.WLAN from a function to a type. #11465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2023

Conversation

dpgeorge
Copy link
Member

When the network module was first introduced in the esp8266 port in ee3fec3 there was only one interface (STA) and, to save flash, the WLAN object was aliased to the network module, which had just static methods for WLAN operations. This was subsequently changed in 9e8396a when the AP interface was introduced, and the WLAN object became a true class.

But, network.WLAN remained a function that returned either the STA or AP object and was never upgraded to the type itself. This scheme was then copied over to the esp32 port when it was first introduced.

This commit changes network.WLAN from a function to a reference to the WLAN type. This makes it consistent with other ports and network objects, and allows accessing constants of network.WLAN without creating an instance.

When the network module was first introduced in the esp8266 port in
ee3fec3 there was only one interface (STA)
and, to save flash, the WLAN object was aliased to the network module,
which had just static methods for WLAN operations.  This was subsequently
changed in 9e8396a when the AP interface
was introduced, and the WLAN object became a true class.

But, network.WLAN remained a function that returned either the STA or AP
object and was never upgraded to the type itself.  This scheme was then
copied over to the esp32 port when it was first introduced.

This commit changes network.WLAN from a function to a reference to the WLAN
type.  This makes it consistent with other ports and network objects, and
allows accessing constants of network.WLAN without creating an instance.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the esp-expose-network-wlan-type branch from 6520d6b to 53cb073 Compare May 18, 2023 04:55
@dpgeorge dpgeorge merged commit 53cb073 into micropython:master May 18, 2023
@dpgeorge dpgeorge deleted the esp-expose-network-wlan-type branch May 18, 2023 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant