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
esp8266: Some API additions + misc fixes #1267
Conversation
Did you test stability of this? In standard SDK, such frequency is enabled only for short periods of time for hard number crunching (SSL). |
I have not done any extensive testing, but the chip does not seem to be heating (more than usual) or crashing. There are no mentions of problems on the internet too, so it is probably safe. |
Thanks @atalax, lots of new features! But parts of this PR will need some thought/discussion first. Mainly, there is existing API for things like ADC, unique id, version number, etc, and we should try to use these "standards" instead of inventing new ones. |
espconn_delete(s->espconn); | ||
} | ||
|
||
STATIC mp_obj_t esp_deepsleep(mp_uint_t n_args, const mp_obj_t *args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't yet have a standard for sleep modes (pyboard has pyb.stop(), cc3200 has pyb.Sleep() class, and there is a discussion to put it in the machine module), so this can stay here for now.
Updated. I also removed Edit: Ugh, apparently I suck at git and not all changes got commited, wait a few minutes... |
Ok, everything should be in order now |
Any idea when this'll get merged? |
Merging big changes is always hard. Merging changes which involve splits and rename is well, pretty hard - there should be reason provided why that's needed, which is not there. @atalax : I cherry-picked "esp8266: Add uos module", please rebase. |
Merged "esp8266: Move initialization to system_init_done_cb". @atalax : Please confirm that ADC stuff is tested. |
@dpgeorge : Let's discuss https://github.com/atalax/micropython/commit/5214cb0fde2207213982e7dd066c92ab634d0ea3 "esp8266: Enable setting CPU frequency to 160MHz". So, this gets rid of a HAL function and calls vendor API directly from a micropython module. I'm +1 on that, I don't see why we should maintain any "HAL", I assume for pyboard it's just means to organize hw-related code, not that we try to maintain some kind of "HAL" API. But maybe I'm missing something. |
I was kind off afraid that eventually, it would be hard to recognize which functions do what (for example, it is not exactly obvious that
Works. Note that for reading vdd33:
This is probably supposed to be done by manufacturer of the board, but I have no idea to what extent it actually is.
Done |
It's a bit hard to understand what the original quote is about, but to make sure we don't spur more confusion then it already has: why do you think anything there should be done by manufacturer of the board? |
If I understand the programming guide correctly, it seems that measuring vdd and tout voltage is mutually exclusive. As it depends on the board whether tout is used, the manufacturer should set the byte accordingly on initial firmware load. |
Ok, to clarify, with esp8266, you're that manufacturer. What that excerpt refers to is esp_init_data_default.bin file in the SDK. Contents of that file are programmed somewhere closer to the end of the (external, SPI) flash, and any user can do it anytime (and sometimes it needs to be done, as esp8266 stores runtime params in that area too, and sometimes it can get into a weird state). As for hardware capabilities and actual semantics of this or another config byte, I can't comment, only experimentation and disassembly could show ;-). |
Yes, I'm fine with it also.
For stdio stuff it's necessary so that, eg, readline and pyexec can be used across multiple ports.
Yes, for things that are not cross-port it's a way of collecting board-related code. Eg for pic16bit, mp_hal_milli_delay is just the name of the delay function. For the specific function at hand, mp_hal_get_cpu_freq(), I did it that way in the ESP port because at that time you couldn't include the ESP headers in uPy code because of clashes with stdio (or something like that). But since this function is only ever used by modpyb.c we don't need it and can call the system provided function directly. Summary: this patch is good to merge as-is. |
"esp8266: Add a bunch of miscellaneous methods" - I'm merging this, but as preliminary implementation, subject to change (e.g. SLEEP_MODEM is a bit weird from user friendliness perspective. Modem? What modem? Well, certainly there's modulator-demodulator somewhere there. But calling setting SLEEP_WIFI or SLEEP_RF makes more sense.) |
Please rebase. |
Also separated the wifi functions to esp.wifi submodule
Turns out this is supposed to be called only for UDP connections.
Done |
Build with esp8266 SDK1.1 error:
|
Strange, are you using SDK from esp-open-sdk? |
Ok, sow what's left here:
2 points here:
2.1) As I elaborated previously "esp" is intended to be analog of "socket" module, but with a callback API. It's not called "espsocket" because it's also a bucket to drop other esp8266-related stuff which doesn't fit anywhere else. Drop, as a temporary bucket. No need to create structures and superstructures there. There's no "socket.wifi", so can't be "esp.wifi" either. 2.2) So, how to do it right? Here's the doc: http://docs.micropython.org/en/latest/library/network.html . All interface-level configuration in uPy happens via "network" module (@dpgeorge, @danicampora: is that still true?). So, feel free to introduce "network" module for esp8266 which follows interface as describe in the docs above. Start with just a module skeleton, move functions one by one to ease review. If not, keeping all stuff flat in "esp" is ok for time being. Summing up: -2 from me on "esp8266: Split modesp.c" |
Yes, that's still true :-) |
"esp8266: Do not call espconn_create in constructor of esp.socket" is applied manually to pre-rename file, I couldn't preserve authorship due to path conflict. |
Thanks. So, all patches except one above were merged. Not closing right away to catch any feedback/objections. |
Closing. |
No description provided.