Merge remote-tracking branch 'origin/main'

This commit is contained in:
Hosted Weblate 2022-02-09 20:01:18 +01:00
commit a24fd57d04
No known key found for this signature in database
GPG Key ID: A3FAAA06E6569B4C

View File

@ -55,7 +55,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_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_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 > 13) { if (args[ARG_channel].u_int < 1 || args[ARG_channel].u_int > 13) {
mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel); mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel);
} }
@ -83,7 +83,11 @@ STATIC mp_obj_t wifi_monitor_obj_get_channel(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_get_channel_obj, wifi_monitor_obj_get_channel); MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_get_channel_obj, wifi_monitor_obj_get_channel);
STATIC mp_obj_t wifi_monitor_obj_set_channel(mp_obj_t self_in, mp_obj_t channel) { STATIC mp_obj_t wifi_monitor_obj_set_channel(mp_obj_t self_in, mp_obj_t channel) {
common_hal_wifi_monitor_set_channel(self_in, mp_obj_get_int(channel)); mp_int_t c = mp_obj_get_int(channel);
if (c < 1 || c > 13) {
mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel);
}
common_hal_wifi_monitor_set_channel(self_in, c);
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_2(wifi_monitor_set_channel_obj, wifi_monitor_obj_set_channel); MP_DEFINE_CONST_FUN_OBJ_2(wifi_monitor_set_channel_obj, wifi_monitor_obj_set_channel);