input validation consistent with esp-idf is moved to common-hal
This commit is contained in:
parent
7884e73089
commit
5742a12497
@ -213,7 +213,12 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_
|
||||
config->ap.password[password_len] = 0;
|
||||
config->ap.channel = channel;
|
||||
config->ap.authmode = authmode;
|
||||
|
||||
if (max_connections < 0 || max_connections > 10) {
|
||||
mp_raise_ValueError(translate("max_connections must be between 0 and 10"));
|
||||
}
|
||||
config->ap.max_connection = max_connections;
|
||||
|
||||
esp_wifi_set_config(WIFI_IF_AP, config);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
|
||||
//| otherwise ``WPA_WPA2_PSK``.
|
||||
//|
|
||||
//| If ``max_connections`` is given, the access point will allow up to
|
||||
//| that number of stations to connect. Default is 4. Maximum is 10."""
|
||||
//| that number of stations to connect."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
@ -288,10 +288,6 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
|
||||
authmode = 1;
|
||||
}
|
||||
|
||||
if (args[ARG_max_connections].u_int < 0 || args[ARG_max_connections].u_int > 10) {
|
||||
mp_raise_ValueError(translate("max_connections must be between 0 and 10"));
|
||||
}
|
||||
|
||||
common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmode, args[ARG_max_connections].u_int);
|
||||
return mp_const_none;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user