update wifi_monitor_make_new and arg parsing
This commit is contained in:
parent
27b137f931
commit
41dcfda593
@ -45,7 +45,7 @@
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_channel, ARG_queue };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_channel, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },
|
||||
@ -53,7 +53,7 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
if (args[ARG_channel].u_int < 0 || args[ARG_channel].u_int > 11) {
|
||||
mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel);
|
||||
|
Loading…
Reference in New Issue
Block a user