mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
127e5c2e7f
1692 changed files with 116 additions and 37 deletions
|
@ -694,15 +694,15 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
info.netmask = network::IPAddress(255, 255, 255, 0);
|
||||
}
|
||||
|
||||
err = esp_netif_dhcpc_stop(s_ap_netif);
|
||||
err = esp_netif_dhcps_stop(s_ap_netif);
|
||||
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcpc_stop failed: %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_stop failed: %s", esp_err_to_name(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -712,20 +712,20 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
start_address += 99;
|
||||
lease.start_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||
start_address += 100;
|
||||
start_address += 10;
|
||||
lease.end_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
||||
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
err = esp_netif_dhcps_start(s_ap_netif);
|
||||
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -716,12 +716,12 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
|
||||
if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
||||
if (!wifi_softap_dhcps_stop()) {
|
||||
ESP_LOGV(TAG, "Stopping DHCP server failed!");
|
||||
ESP_LOGW(TAG, "Stopping DHCP server failed!");
|
||||
}
|
||||
}
|
||||
|
||||
if (!wifi_set_ip_info(SOFTAP_IF, &info)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP info failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP info failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -735,17 +735,17 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
start_address += 99;
|
||||
lease.start_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||
start_address += 100;
|
||||
start_address += 10;
|
||||
lease.end_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||
if (!wifi_softap_set_dhcps_lease(&lease)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP DHCP lease failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// lease time 1440 minutes (=24 hours)
|
||||
if (!wifi_softap_set_dhcps_lease_time(1440)) {
|
||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease time failed!");
|
||||
ESP_LOGE(TAG, "Setting SoftAP DHCP lease time failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -755,13 +755,13 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
uint8_t mode = 1;
|
||||
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
|
||||
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
|
||||
ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
||||
ESP_LOGE(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!wifi_softap_dhcps_start()) {
|
||||
ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!");
|
||||
ESP_LOGE(TAG, "Starting SoftAP DHCPS failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -823,15 +823,15 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
info.netmask = network::IPAddress(255, 255, 255, 0);
|
||||
}
|
||||
|
||||
err = esp_netif_dhcpc_stop(s_ap_netif);
|
||||
err = esp_netif_dhcps_stop(s_ap_netif);
|
||||
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcpc_stop failed: %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_stop failed: %s", esp_err_to_name(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -841,20 +841,20 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||
start_address += 99;
|
||||
lease.start_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||
start_address += 100;
|
||||
start_address += 10;
|
||||
lease.end_ip = start_address;
|
||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
||||
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
err = esp_netif_dhcps_start(s_ap_netif);
|
||||
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -887,12 +887,12 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
|
|||
|
||||
esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &conf);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGV(TAG, "esp_wifi_set_config failed! %d", err);
|
||||
ESP_LOGE(TAG, "esp_wifi_set_config failed! %d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this->wifi_ap_ip_config_(ap.get_manual_ip())) {
|
||||
ESP_LOGV(TAG, "wifi_ap_ip_config_ failed!");
|
||||
ESP_LOGE(TAG, "wifi_ap_ip_config_ failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ fi
|
|||
|
||||
start_esphome() {
|
||||
# create dynamic yaml file in `build` folder.
|
||||
# `./tests/test_build_components/build/[target_component].[test_name].[target_platform].yaml`
|
||||
component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform.yaml"
|
||||
# `./tests/test_build_components/build/[target_component].[test_name].[target_platform_with_version].yaml`
|
||||
component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform_with_version.yaml"
|
||||
|
||||
cp $target_platform_file $component_test_file
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
|
@ -36,7 +36,7 @@ start_esphome() {
|
|||
fi
|
||||
|
||||
# Start esphome process
|
||||
echo "> [$target_component] [$test_name] [$target_platform]"
|
||||
echo "> [$target_component] [$test_name] [$target_platform_with_version]"
|
||||
set -x
|
||||
# TODO: Validate escape of Command line substitution value
|
||||
python -m esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
|
||||
|
@ -76,16 +76,17 @@ for f in ./tests/components/$target_component/*.*.yaml; do
|
|||
# 2. `./tests/test_build_components/build_components_base.[target_platform]-ard.yaml`
|
||||
target_platform_file="./tests/test_build_components/build_components_base.$target_platform.yaml"
|
||||
if ! [ -f "$target_platform_file" ]; then
|
||||
# Try find arduino test framework as platform.
|
||||
target_platform_ard="$target_platform-ard"
|
||||
target_platform_file="./tests/test_build_components/build_components_base.$target_platform_ard.yaml"
|
||||
if ! [ -f "$target_platform_file" ]; then
|
||||
echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml, ./tests/build_components_base.$target_platform_ard.yaml] for component test [$f] found."
|
||||
echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml] for component test [$f] found."
|
||||
exit 1
|
||||
fi
|
||||
target_platform=$target_platform_ard
|
||||
fi
|
||||
|
||||
for target_platform_file in ./tests/test_build_components/build_components_base.$target_platform*.yaml; do
|
||||
# trim off "./tests/test_build_components/build_components_base." prefix
|
||||
target_platform_with_version=${target_platform_file:52}
|
||||
# ...now remove suffix starting with "." leaving just the test target hardware and software platform (possibly with version)
|
||||
# For example: "esp32-s3-idf-50"
|
||||
target_platform_with_version=${target_platform_with_version%.*}
|
||||
start_esphome
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue