Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

ESP8266 Arduino 2.5.0 Compatability #481

Merged
merged 2 commits into from
Feb 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/esphomelib/ethernet_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ void EthernetComponent::loop() {
}

this->last_connected_ = this->connected_;

network_tick_mdns();
}
void EthernetComponent::dump_config() {
ESP_LOGCONFIG(TAG, "Ethernet:");
Expand Down
5 changes: 5 additions & 0 deletions src/esphomelib/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ void network_setup_mdns(const std::string &hostname) {
}
#endif
}
void network_tick_mdns() {
#ifdef ARDUINO_ARCH_ESP8266
MDNS.update();
#endif
}

IPAddress network_get_address() {
#ifdef USE_ETHERNET
Expand Down
1 change: 1 addition & 0 deletions src/esphomelib/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IPAddress network_get_address();
void network_setup();
void network_tick();
void network_setup_mdns(const std::string &hostname);
void network_tick_mdns();

ESPHOMELIB_NAMESPACE_END

Expand Down
12 changes: 12 additions & 0 deletions src/esphomelib/wifi_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ void WiFiComponent::loop() {
}
}
}

network_tick_mdns();
}

WiFiComponent::WiFiComponent() {
Expand Down Expand Up @@ -468,6 +470,9 @@ bool WiFiComponent::wifi_mode_(optional<bool> sta, optional<bool> ap) {
ESP_LOGV(TAG, "Enabling STA.");
} else if (!sta_ && current_sta) {
ESP_LOGV(TAG, "Disabling STA.");
// Stop DHCP client when disabling STA
// See https://github.com/esp8266/Arduino/pull/5703
wifi_station_dhcpc_stop();
}
if (ap_ && !current_ap) {
ESP_LOGV(TAG, "Enabling AP.");
Expand Down Expand Up @@ -608,6 +613,13 @@ bool WiFiComponent::wifi_sta_connect_(WiFiAP ap) {
conf.bssid_set = 0;
}

if (ap.get_ssid().empty()) {
conf.threshold.authmode = AUTH_OPEN;
} else {
conf.threshold.authmode = AUTH_WPA_PSK;
}
conf.threshold.rssi = -127;

ETS_UART_INTR_DISABLE();
bool ret = wifi_station_set_config_current(&conf);
ETS_UART_INTR_ENABLE();
Expand Down