8000 esp8266: Added wifi_opmode() to read and set WiFi operating mode by owens-bill · Pull Request #1318 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

esp8266: Added wifi_opmode() to read and set WiFi operating mode #1318

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

Closed
wants to merge 1 commit into from

Conversation

owens-bill
Copy link
Contributor

I wanted this function to use while testing the esp.connect() crash, but it's also come in handy for verifying the problem and the fix with esp.scan(). I tried to follow conventions for the names of the three constants, hopefully I've parsed that correctly.

@pfalcon
Copy link
Contributor
pfalcon commented Jun 11, 2015

Nope, sorry, that's unlikely right. We should have common API for such functionality across ports, and other ports unlikely have it named like that. Please review how cc3200 port does it, spin a discussion if needed. Thanks.

@danicampora
Copy link
Member

The CC3200 adopted the same approach that other network cards (wiznet, cc3k) were using, so the operation mode (STA, AP, right?) is configured with the constructor.
In order to query the configuration of the NIC, I implemented aninfo() method which returns a named tuple with (operating mode, ssid, security, mac). If that doesn't seem right, we can discuss it of course.

@pfalcon
Copy link
Contributor
pfalcon commented Jun 11, 2015

#1319 for discussion

@pfalcon
Copy link
Contributor
pfalcon commented Aug 26, 2015

Based on HackerNews discussion, I would like to merge this. The idea with postponing this patch was the hope that we'd come to new API conventions and to motivate contributors to participate in their discussion and moving forward. Neither did happen, and in the meantime, esp8266 port stalled. Between not having progress at all, and having some gradual progress, even if not in the exactly ultimate direction, I guess the latter is better.

@danicampora
Copy link
Member

The idea with postponing this patch was the hope that we'd come to new API conventions and to motivate contributors to participate in their discussion and moving forward. Neither did happen, and in the meantime, esp8266 port stalled.

We had #1319, and we were getting to something there, but of course pleasing everyone was impossible. Besides that ticket, we also have #1430 and the API proposal in the wiki, so I would say that we are doing a lot to come with an unified API, but it happens to be a quite challenging task ;-).

Anyway, I think it is a good idea to merge this and keep progressing on the ESP8266 port :-).

@pfalcon
Copy link
Contributor
pfalcon commented Aug 26, 2015

Well, networking API doesn't depend on hardware access API and vice-versa, and #1319 and #876 were there long before #1430. It's certainly challenging task, and exactly where we have problems. Implementing existing Python APIs, agreeing which of them to implement and which not - no problems. But when it comes to implementing new, uPy-specific APIs, here it's a lot of slipping (and why I skip participating in #1430 discussion).

@dpgeorge
Copy link
Member

+1 on merging. I think we should look at these patches as adding functionality (functionality that people have tested and is working) and then once the API is done hopefully most of the work in fixing said patches is simple renaming.

As per #1439, do we want to raise an error if the mode could not be set?

@danicampora
Copy link
Member

I think we should look at these patches as adding functionality (functionality that people have tested and is working) and then once the API is done hopefully most of the work in fixing said patches is simple renaming.

+1.

@danicampora
Copy link
Member

Well, networking API doesn't depend on hardware access API and vice-versa, and #1319 and #876 were there long before #1430.

I think it does. The network card is a piece of hardware, and like SPI, I2C, etc. we have to accommodate the API to suite different platforms. Furthermore, in the API proposal in the wiki we are defining the design goals and principles, which should hopefully serve as a set of rules to follow from now on.

@danicampora
Copy link
Member

As per #1439, do we want to raise an error if the mode could not be set?

I think we should raise an OSError ("Operation failed" or something).

@pfalcon
Copy link
Contributor
pfalcon commented Aug 29, 2015

Ok, merged with few naming changes: function is called wifi_mode() for consistency with existing phy_mode(). Station constants are named STA, which is standard abbreviation (STAT is something completely different).

@pfalcon pfalcon closed this Aug 29, 2015
tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0