mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
@@ -76,7 +76,7 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
|
|||||||
return false;
|
return false;
|
||||||
memset(_buf, 0x00, 16);
|
memset(_buf, 0x00, 16);
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#if ESP_ARDUINO_VERSION_MAJOR < 3
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
mbedtls_md5_init(&_ctx);
|
mbedtls_md5_init(&_ctx);
|
||||||
mbedtls_md5_starts_ret(&_ctx);
|
mbedtls_md5_starts_ret(&_ctx);
|
||||||
mbedtls_md5_update_ret(&_ctx, data, len);
|
mbedtls_md5_update_ret(&_ctx, data, len);
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ StateUpdateResult APSettings::update(JsonObject root, APSettings & settings) {
|
|||||||
newSettings.ssidHidden = root["ssid_hidden"] | FACTORY_AP_SSID_HIDDEN;
|
newSettings.ssidHidden = root["ssid_hidden"] | FACTORY_AP_SSID_HIDDEN;
|
||||||
newSettings.maxClients = static_cast<uint8_t>(root["max_clients"] | FACTORY_AP_MAX_CLIENTS);
|
newSettings.maxClients = static_cast<uint8_t>(root["max_clients"] | FACTORY_AP_MAX_CLIENTS);
|
||||||
|
|
||||||
JsonUtils::readIP(root, "local_ip", newSettings.localIP, FACTORY_AP_LOCAL_IP);
|
JsonUtils::readIP(root, "local_ip", newSettings.localIP, String(FACTORY_AP_LOCAL_IP));
|
||||||
JsonUtils::readIP(root, "gateway_ip", newSettings.gatewayIP, FACTORY_AP_GATEWAY_IP);
|
JsonUtils::readIP(root, "gateway_ip", newSettings.gatewayIP,String(FACTORY_AP_GATEWAY_IP));
|
||||||
JsonUtils::readIP(root, "subnet_mask", newSettings.subnetMask, FACTORY_AP_SUBNET_MASK);
|
JsonUtils::readIP(root, "subnet_mask", newSettings.subnetMask, String(FACTORY_AP_SUBNET_MASK));
|
||||||
|
|
||||||
if (newSettings == settings) {
|
if (newSettings == settings) {
|
||||||
return StateUpdateResult::UNCHANGED;
|
return StateUpdateResult::UNCHANGED;
|
||||||
|
|||||||
@@ -65,12 +65,17 @@ void NetworkSettingsService::loop() {
|
|||||||
void NetworkSettingsService::manageSTA() {
|
void NetworkSettingsService::manageSTA() {
|
||||||
// Abort if already connected, or if we have no SSID
|
// Abort if already connected, or if we have no SSID
|
||||||
if (WiFi.isConnected() || _state.ssid.length() == 0) {
|
if (WiFi.isConnected() || _state.ssid.length() == 0) {
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
|
if (_state.ssid.length() == 0) {
|
||||||
|
ETH.enableIPv6(_state.enableIPv6);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect or reconnect as required
|
// Connect or reconnect as required
|
||||||
if ((WiFi.getMode() & WIFI_STA) == 0) {
|
if ((WiFi.getMode() & WIFI_STA) == 0) {
|
||||||
#ifdef TASMOTA_SDK
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
WiFi.enableIPv6(_state.enableIPv6);
|
WiFi.enableIPv6(_state.enableIPv6);
|
||||||
#endif
|
#endif
|
||||||
if (_state.staticIPConfig) {
|
if (_state.staticIPConfig) {
|
||||||
@@ -352,23 +357,25 @@ void NetworkSettingsService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info)
|
|||||||
if (_state.tx_power == 0) {
|
if (_state.tx_power == 0) {
|
||||||
setWiFiPowerOnRSSI();
|
setWiFiPowerOnRSSI();
|
||||||
}
|
}
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
if (_state.enableIPv6) {
|
if (_state.enableIPv6) {
|
||||||
WiFi.enableIpV6();
|
WiFi.enableIpV6();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
if (_state.enableIPv6) {
|
if (_state.enableIPv6) {
|
||||||
ETH.enableIpV6();
|
ETH.enableIpV6();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// IPv6 specific
|
// IPv6 specific
|
||||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
||||||
case ARDUINO_EVENT_ETH_GOT_IP6:
|
case ARDUINO_EVENT_ETH_GOT_IP6:
|
||||||
if (emsesp::EMSESP::system_.ethernet_connected()) {
|
emsesp::EMSESP::logger().info("IPv6=%s", IPAddress(IPv6, (uint8_t *)info.got_ip6.ip6_info.ip.addr, 0).toString().c_str());
|
||||||
emsesp::EMSESP::logger().info("Ethernet connected (IPv6=%s, speed %d Mbps)", ETH.localIPv6().toString().c_str(), ETH.linkSpeed());
|
|
||||||
}
|
|
||||||
emsesp::EMSESP::system_.has_ipv6(true);
|
emsesp::EMSESP::system_.has_ipv6(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
|
|||||||
if (ethernet_connected) {
|
if (ethernet_connected) {
|
||||||
// Ethernet
|
// Ethernet
|
||||||
root["local_ip"] = ETH.localIP().toString();
|
root["local_ip"] = ETH.localIP().toString();
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
root["local_ipv6"] = ETH.localIPv6().toString();
|
root["local_ipv6"] = ETH.localIPv6().toString();
|
||||||
|
#else
|
||||||
|
root["local_ipv6"] = ETH.linkLocalIPv6().toString();
|
||||||
|
#endif
|
||||||
root["mac_address"] = ETH.macAddress();
|
root["mac_address"] = ETH.macAddress();
|
||||||
root["subnet_mask"] = ETH.subnetMask().toString();
|
root["subnet_mask"] = ETH.subnetMask().toString();
|
||||||
root["gateway_ip"] = ETH.gatewayIP().toString();
|
root["gateway_ip"] = ETH.gatewayIP().toString();
|
||||||
@@ -50,7 +54,12 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
|
|||||||
}
|
}
|
||||||
} else if (wifi_status == WL_CONNECTED) {
|
} else if (wifi_status == WL_CONNECTED) {
|
||||||
root["local_ip"] = WiFi.localIP().toString();
|
root["local_ip"] = WiFi.localIP().toString();
|
||||||
|
// #if ESP_ARDUINO_VERSION_MAJOR < 3
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
root["local_ipv6"] = WiFi.localIPv6().toString();
|
root["local_ipv6"] = WiFi.localIPv6().toString();
|
||||||
|
#else
|
||||||
|
root["local_ipv6"] = WiFi.linkLocalIPv6().toString();
|
||||||
|
#endif
|
||||||
root["mac_address"] = WiFi.macAddress();
|
root["mac_address"] = WiFi.macAddress();
|
||||||
root["rssi"] = WiFi.RSSI();
|
root["rssi"] = WiFi.RSSI();
|
||||||
root["ssid"] = WiFi.SSID();
|
root["ssid"] = WiFi.SSID();
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ platform_packages=
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
|
board_upload.flash_size = 16MB
|
||||||
|
board_build.partitions = esp32_partition_16M.csv
|
||||||
|
board_build.extra_flags = -DBOARD_HAS_PSRAM
|
||||||
build_flags =
|
build_flags =
|
||||||
${factory_settings.build_flags}
|
${factory_settings.build_flags}
|
||||||
${common.my_build_flags}
|
${common.my_build_flags}
|
||||||
|
|||||||
@@ -2001,6 +2001,7 @@ bool Thermostat::set_control(const char * value, const int8_t id) {
|
|||||||
} else if (isRC300() || model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
} else if (isRC300() || model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||||
if (Helpers::value2enum(value, ctrl, FL_(enum_control1))) {
|
if (Helpers::value2enum(value, ctrl, FL_(enum_control1))) {
|
||||||
write_command(hpmode_typeids[hc->hc()], 3, ctrl);
|
write_command(hpmode_typeids[hc->hc()], 3, ctrl);
|
||||||
|
hc->control = ctrl; // set in advance, dont wait for verify
|
||||||
if (hc->remotetemp != EMS_VALUE_INT16_NOTSET && ctrl > 0) {
|
if (hc->remotetemp != EMS_VALUE_INT16_NOTSET && ctrl > 0) {
|
||||||
if (ctrl == 1) {
|
if (ctrl == 1) {
|
||||||
Roomctrl::set_remotetemp(Roomctrl::RC200, hc->hc(), hc->remotetemp);
|
Roomctrl::set_remotetemp(Roomctrl::RC200, hc->hc(), hc->remotetemp);
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ void System::send_info_mqtt() {
|
|||||||
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
|
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
|
||||||
doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
|
doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
|
||||||
doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
|
doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
|
||||||
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && ETH.localIPv6().toString() != "::") {
|
||||||
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
|
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -624,9 +624,17 @@ void System::send_info_mqtt() {
|
|||||||
doc["IPv4 address"] = uuid::printable_to_string(WiFi.localIP()) + "/" + uuid::printable_to_string(WiFi.subnetMask());
|
doc["IPv4 address"] = uuid::printable_to_string(WiFi.localIP()) + "/" + uuid::printable_to_string(WiFi.subnetMask());
|
||||||
doc["IPv4 gateway"] = uuid::printable_to_string(WiFi.gatewayIP());
|
doc["IPv4 gateway"] = uuid::printable_to_string(WiFi.gatewayIP());
|
||||||
doc["IPv4 nameserver"] = uuid::printable_to_string(WiFi.dnsIP());
|
doc["IPv4 nameserver"] = uuid::printable_to_string(WiFi.dnsIP());
|
||||||
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
|
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && WiFi.localIPv6().toString() != "::") {
|
||||||
doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
|
doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (WiFi.linkLocalIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && WiFi.linkLocalIPv6().toString() != "::") {
|
||||||
|
doc["IPv6 address"] = uuid::printable_to_string(WiFi.linkLocalIPv6());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Mqtt::queue_publish_retain(F_(info), doc.as<JsonObject>(), true); // topic called "info" and it's Retained
|
Mqtt::queue_publish_retain(F_(info), doc.as<JsonObject>(), true); // topic called "info" and it's Retained
|
||||||
@@ -739,7 +747,7 @@ void System::network_init(bool refresh) {
|
|||||||
// ETH_CLOCK_GPIO17_OUT = 3 RMII clock output from GPIO17, for 50hz inverted clock
|
// ETH_CLOCK_GPIO17_OUT = 3 RMII clock output from GPIO17, for 50hz inverted clock
|
||||||
auto clock_mode = (eth_clock_mode_t)eth_clock_mode_;
|
auto clock_mode = (eth_clock_mode_t)eth_clock_mode_;
|
||||||
|
|
||||||
#if ESP_ARDUINO_VERSION_MAJOR < 3
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
eth_present_ = ETH.begin(phy_addr, power, mdc, mdio, type, clock_mode);
|
eth_present_ = ETH.begin(phy_addr, power, mdc, mdio, type, clock_mode);
|
||||||
#else
|
#else
|
||||||
eth_present_ = ETH.begin(type, phy_addr, mdc, mdio, power, clock_mode);
|
eth_present_ = ETH.begin(type, phy_addr, mdc, mdio, power, clock_mode);
|
||||||
@@ -998,9 +1006,16 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
||||||
shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
||||||
shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
||||||
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
|
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && WiFi.localIPv6().toString() != "::") {
|
||||||
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(WiFi.localIPv6()).c_str());
|
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(WiFi.localIPv6()).c_str());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (WiFi.linkLocalIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && WiFi.linkLocalIPv6().toString() != "::") {
|
||||||
|
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(WiFi.linkLocalIPv6()).c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECT_FAILED:
|
case WL_CONNECT_FAILED:
|
||||||
@@ -1031,9 +1046,15 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
||||||
shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(ETH.gatewayIP()).c_str());
|
shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(ETH.gatewayIP()).c_str());
|
||||||
shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(ETH.dnsIP()).c_str());
|
shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(ETH.dnsIP()).c_str());
|
||||||
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
#if ESP_IDF_VERSION_MAJOR < 5
|
||||||
|
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && ETH.localIPv6().toString() != "::") {
|
||||||
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(ETH.localIPv6()).c_str());
|
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(ETH.localIPv6()).c_str());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (ETH.linkLocalIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && ETH.linkLocalIPv6().toString() != "::") {
|
||||||
|
shell.printfln(" IPv6 address: %s", uuid::printable_to_string(ETH.linkLocalIPv6()).c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
shell.println();
|
shell.println();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user