mirror of
https://github.com/esphome/esphome.git
synced 2024-12-29 00:41:44 +01:00
[wifi] Make wifi_channel_() public (#7818)
This commit is contained in:
parent
dea297c8d7
commit
2ecd5cff07
7 changed files with 10 additions and 8 deletions
|
@ -444,7 +444,7 @@ void WiFiComponent::print_connect_params_() {
|
|||
if (this->selected_ap_.get_bssid().has_value()) {
|
||||
ESP_LOGV(TAG, " Priority: %.1f", this->get_sta_priority(*this->selected_ap_.get_bssid()));
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Channel: %" PRId32, wifi_channel_());
|
||||
ESP_LOGCONFIG(TAG, " Channel: %" PRId32, get_wifi_channel());
|
||||
ESP_LOGCONFIG(TAG, " Subnet: %s", wifi_subnet_mask_().str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Gateway: %s", wifi_gateway_ip_().str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " DNS1: %s", wifi_dns_ip_(0).str().c_str());
|
||||
|
@ -763,7 +763,7 @@ void WiFiComponent::load_fast_connect_settings_() {
|
|||
|
||||
void WiFiComponent::save_fast_connect_settings_() {
|
||||
bssid_t bssid = wifi_bssid();
|
||||
uint8_t channel = wifi_channel_();
|
||||
uint8_t channel = get_wifi_channel();
|
||||
|
||||
if (bssid != this->selected_ap_.get_bssid() || channel != this->selected_ap_.get_channel()) {
|
||||
SavedWifiFastConnectSettings fast_connect_save{};
|
||||
|
|
|
@ -317,6 +317,8 @@ class WiFiComponent : public Component {
|
|||
Trigger<> *get_connect_trigger() const { return this->connect_trigger_; };
|
||||
Trigger<> *get_disconnect_trigger() const { return this->disconnect_trigger_; };
|
||||
|
||||
int32_t get_wifi_channel();
|
||||
|
||||
protected:
|
||||
static std::string format_mac_addr(const uint8_t mac[6]);
|
||||
|
||||
|
@ -344,7 +346,7 @@ class WiFiComponent : public Component {
|
|||
#endif // USE_WIFI_AP
|
||||
|
||||
bool wifi_disconnect_();
|
||||
int32_t wifi_channel_();
|
||||
|
||||
network::IPAddress wifi_subnet_mask_();
|
||||
network::IPAddress wifi_gateway_ip_();
|
||||
network::IPAddress wifi_dns_ip_(int num);
|
||||
|
|
|
@ -799,7 +799,7 @@ bssid_t WiFiComponent::wifi_bssid() {
|
|||
}
|
||||
std::string WiFiComponent::wifi_ssid() { return WiFi.SSID().c_str(); }
|
||||
int8_t WiFiComponent::wifi_rssi() { return WiFi.RSSI(); }
|
||||
int32_t WiFiComponent::wifi_channel_() { return WiFi.channel(); }
|
||||
int32_t WiFiComponent::get_wifi_channel() { return WiFi.channel(); }
|
||||
network::IPAddress WiFiComponent::wifi_subnet_mask_() { return network::IPAddress(WiFi.subnetMask()); }
|
||||
network::IPAddress WiFiComponent::wifi_gateway_ip_() { return network::IPAddress(WiFi.gatewayIP()); }
|
||||
network::IPAddress WiFiComponent::wifi_dns_ip_(int num) { return network::IPAddress(WiFi.dnsIP(num)); }
|
||||
|
|
|
@ -825,7 +825,7 @@ bssid_t WiFiComponent::wifi_bssid() {
|
|||
}
|
||||
std::string WiFiComponent::wifi_ssid() { return WiFi.SSID().c_str(); }
|
||||
int8_t WiFiComponent::wifi_rssi() { return WiFi.RSSI(); }
|
||||
int32_t WiFiComponent::wifi_channel_() { return WiFi.channel(); }
|
||||
int32_t WiFiComponent::get_wifi_channel() { return WiFi.channel(); }
|
||||
network::IPAddress WiFiComponent::wifi_subnet_mask_() { return {(const ip_addr_t *) WiFi.subnetMask()}; }
|
||||
network::IPAddress WiFiComponent::wifi_gateway_ip_() { return {(const ip_addr_t *) WiFi.gatewayIP()}; }
|
||||
network::IPAddress WiFiComponent::wifi_dns_ip_(int num) { return {(const ip_addr_t *) WiFi.dnsIP(num)}; }
|
||||
|
|
|
@ -973,7 +973,7 @@ int8_t WiFiComponent::wifi_rssi() {
|
|||
}
|
||||
return info.rssi;
|
||||
}
|
||||
int32_t WiFiComponent::wifi_channel_() {
|
||||
int32_t WiFiComponent::get_wifi_channel() {
|
||||
uint8_t primary;
|
||||
wifi_second_chan_t second;
|
||||
esp_err_t err = esp_wifi_get_channel(&primary, &second);
|
||||
|
|
|
@ -473,7 +473,7 @@ bssid_t WiFiComponent::wifi_bssid() {
|
|||
}
|
||||
std::string WiFiComponent::wifi_ssid() { return WiFi.SSID().c_str(); }
|
||||
int8_t WiFiComponent::wifi_rssi() { return WiFi.RSSI(); }
|
||||
int32_t WiFiComponent::wifi_channel_() { return WiFi.channel(); }
|
||||
int32_t WiFiComponent::get_wifi_channel() { return WiFi.channel(); }
|
||||
network::IPAddress WiFiComponent::wifi_subnet_mask_() { return {WiFi.subnetMask()}; }
|
||||
network::IPAddress WiFiComponent::wifi_gateway_ip_() { return {WiFi.gatewayIP()}; }
|
||||
network::IPAddress WiFiComponent::wifi_dns_ip_(int num) { return {WiFi.dnsIP(num)}; }
|
||||
|
|
|
@ -189,7 +189,7 @@ bssid_t WiFiComponent::wifi_bssid() {
|
|||
}
|
||||
std::string WiFiComponent::wifi_ssid() { return WiFi.SSID().c_str(); }
|
||||
int8_t WiFiComponent::wifi_rssi() { return WiFi.RSSI(); }
|
||||
int32_t WiFiComponent::wifi_channel_() { return WiFi.channel(); }
|
||||
int32_t WiFiComponent::get_wifi_channel() { return WiFi.channel(); }
|
||||
|
||||
network::IPAddresses WiFiComponent::wifi_sta_ip_addresses() {
|
||||
network::IPAddresses addresses;
|
||||
|
|
Loading…
Reference in a new issue