Skip to content

Commit

Permalink
Merge pull request #8087 from anecdata/ap_chan
Browse files Browse the repository at this point in the history
validate wifi Access Point channel
  • Loading branch information
tannewt authored Jun 20, 2023
2 parents 9bce4ac + b0e0b4a commit 4789508
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shared-bindings/wifi/Radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
}
}

mp_int_t channel = mp_arg_validate_int_range(args[ARG_channel].u_int, 1, 13, MP_QSTR_channel);

if (authmodes == AUTHMODE_OPEN && password.len > 0) {
mp_raise_ValueError(translate("AuthMode.OPEN is not used with password"));
}
Expand All @@ -385,7 +387,7 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
}
}

common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmodes, args[ARG_max_connections].u_int);
common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, channel, authmodes, args[ARG_max_connections].u_int);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap);
Expand Down

0 comments on commit 4789508

Please sign in to comment.