Wykres commitów

29 Commity (94beeabd2ee179d587942046555833e022241f24)

Autor SHA1 Wiadomość Data
Jim Mussared 94beeabd2e py/obj: Convert make_new into a mp_obj_type_t slot.
Instead of being an explicit field, it's now a slot like all the other
methods.

This is a marginal code size improvement because most types have a make_new
(100/138 on PYBV11), however it improves consistency in how types are
declared, removing the special case for make_new.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:15 +10:00
Jim Mussared 9dce82776d all: Remove unnecessary locals_dict cast.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:01 +10:00
Jim Mussared 662b9761b3 all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.
In preparation for upcoming rework of mp_obj_type_t layout.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:01 +10:00
glenn20 e6e60f4330 esp8266/modnetwork: Add support for WLAN.config(protocol=XX) option.
Following esp32.  This is preferred to using the phy_mode() function.
2022-08-23 16:33:19 +10:00
IhorNehrutsa 1ea82b6dcc esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.
But retain old name for backwards compatibility.
2022-07-05 23:40:32 +10:00
iabdalkader 82b8a2d193 esp8266/modnetwork: Rename WLAN keyword args to ssid/security/key.
The WLAN.config() method now supports "ssid", "security" and "key" as
aliases to the existing "essid", "authmode" and "password", which are now
deprecated.  The help text and setup helper are also updated.

Addresses issue #8083.
2022-06-17 21:43:44 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Jim Mussared bb794f05b7 extmod: Make port-included extmod modules use MP_REGISTER_MODULES.
_onewire, socket, and network were previously added by the port rather
than objmodule.c.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Damien George 5adb1fa40e esp32,esp8266: Extract qstr from object when comparing keys in config().
Following on from a previous fix for the same problem made in
3a431fba50.

Fixes issue #8052.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 14:27:13 +11:00
Damien George 8616129f2e esp8266,esp32: Include hidden networks in WLAN.scan results.
Addresses issues #2697 and #5329.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:28:34 +10:00
Damien George 136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
David Lechner ca920f7218 py/mpstate: Make exceptions thread-local.
This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t.
This allows exceptions to be scheduled on a specific thread.

Signed-off-by: David Lechner <david@pybricks.com>
2021-06-19 09:43:44 +10:00
Damien George a41cd150be esp8266/modnetwork: Use mp_handle_pending() to raise pending exception.
If MICROPY_ENABLE_SCHEDULER is enabled then MP_STATE_VM(sched_state) must
be updated after handling the pending exception, which is done by the
mp_handle_pending() function.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Jim Mussared def76fe4d9 all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
Damien George 9fa32169e9 esp8266/modnetwork: Add support for wlan.ifconfig('dhcp').
Fixes issue #5780.
2020-03-25 00:43:04 +11:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George c13f9f209d all: Convert nlr_raise(mp_obj_new_exception_msg(x)) to mp_raise_msg(x).
This helper function was added a while ago and these are the remaining
cases to convert, to save a bit of code size.
2019-11-05 11:35:45 +11:00
Damien George 6e30f96b0b ports: Convert legacy uppercase macro names to lowercase. 2019-02-12 14:54:51 +11:00
Damien George 62b4bebf64 esp8266/modnetwork: Wait for iface to go down before forcing power mgmt.
If the STA interface is connected to an AP then it must be fully
disconnected and deactivated before forcing the power management on.
2018-12-04 10:20:45 +11:00
Damien George 321d75e087 esp8266/modnetwork: Automatically do radio sleep if no interface active.
Reduces current of device by about 55mA when radio is sleeping.
2018-12-01 17:20:05 +11:00
Damien George dd13065843 esp8266/modnetwork: Raise ValueError when getting invalid WLAN id.
Instead of crashing due to out-of-bounds array access.  Fixes #3348.
2018-05-17 22:12:24 +10:00
Damien George f8a5cd24d8 esp8266/modnetwork: Return empty str for hostname if STA is inactive.
Instead of crashing due to NULL pointer dereference.  Fixes issue #3341.
2018-05-17 22:11:22 +10:00
Lars Kellogg-Stedman d8fdb77ac9 esp8266/modnetwork: Allow to get ESSID of AP that STA is connected to.
This patch enables iface.config('essid') to work for both AP and STA
interfaces.
2018-05-01 16:37:02 +10:00
Damien George c5fe610ba1 esp8266/modnetwork: Implement WLAN.status('rssi') for STA interface.
This will return the RSSI of the AP that the STA is connected to.
2018-02-26 16:41:13 +11:00
Paul Sokolovsky 3a431fba50 esp8266/modnetwork: Make sure to intern string passed to .config("param").
This is the proper fix for
https://github.com/micropython/micropython/issues/3442.
2017-12-04 00:13:10 +02:00
Damien George 4601759bf5 py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.
This patch simplifies the str creation API to favour the common case of
creating a str object that is not forced to be interned.  To force
interning of a new str the new mp_obj_new_str_via_qstr function is added,
and should only be used if warranted.

Apart from simplifying the mp_obj_new_str function (and making it have the
same signature as mp_obj_new_bytes), this patch also reduces code size by a
bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
2017-11-16 13:17:51 +11:00
Damien George 6db132e130 esp8266/modnetwork: Add "bssid" keyword arg to WLAN.connect() method. 2017-10-09 23:09:06 +11:00
Damien George a3dc1b1957 all: Remove inclusion of internal py header files.
Header files that are considered internal to the py core and should not
normally be included directly are:
    py/nlr.h - internal nlr configuration and declarations
    py/bc0.h - contains bytecode macro definitions
    py/runtime0.h - contains basic runtime enums

Instead, the top-level header files to include are one of:
    py/obj.h - includes runtime0.h and defines everything to use the
        mp_obj_t type
    py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
        and defines everything to use the general runtime support functions

Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-10-04 12:37:50 +11:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00