commit
c56f363a23
@ -139,14 +139,14 @@ void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t
|
||||
esp_wifi_set_mac(ESP_IF_WIFI_STA, mac);
|
||||
}
|
||||
|
||||
uint8_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) {
|
||||
mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) {
|
||||
int8_t tx_power;
|
||||
esp_wifi_get_max_tx_power(&tx_power);
|
||||
return tx_power / 4;
|
||||
return tx_power / 4.0f;
|
||||
}
|
||||
|
||||
void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const uint8_t tx_power) {
|
||||
esp_wifi_set_max_tx_power(tx_power * 4);
|
||||
void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t tx_power) {
|
||||
esp_wifi_set_max_tx_power(tx_power * 4.0f);
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self) {
|
||||
|
@ -138,17 +138,17 @@ MP_PROPERTY_GETSET(wifi_radio_mac_address_obj,
|
||||
(mp_obj_t)&wifi_radio_get_mac_address_obj,
|
||||
(mp_obj_t)&wifi_radio_set_mac_address_obj);
|
||||
|
||||
//| tx_power: int
|
||||
//| tx_power: float
|
||||
//| """Wifi transmission power, in dBm."""
|
||||
//|
|
||||
STATIC mp_obj_t wifi_radio_get_tx_power(mp_obj_t self_in) {
|
||||
wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
return mp_obj_new_int(common_hal_wifi_radio_get_tx_power(self));
|
||||
return mp_obj_new_float(common_hal_wifi_radio_get_tx_power(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_tx_power_obj, wifi_radio_get_tx_power);
|
||||
|
||||
STATIC mp_obj_t wifi_radio_set_tx_power(mp_obj_t self_in, mp_obj_t tx_power_in) {
|
||||
mp_int_t tx_power = mp_obj_get_int(tx_power_in);
|
||||
mp_float_t tx_power = mp_obj_get_float(tx_power_in);
|
||||
wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_wifi_radio_set_tx_power(self, tx_power);
|
||||
return mp_const_none;
|
||||
|
@ -82,8 +82,8 @@ extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const
|
||||
extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self);
|
||||
extern void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint8_t *mac);
|
||||
|
||||
extern uint8_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self);
|
||||
extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const uint8_t power);
|
||||
extern mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self);
|
||||
extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t power);
|
||||
|
||||
extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self);
|
||||
extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self);
|
||||
|
Loading…
Reference in New Issue
Block a user