1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

Merge remote-tracking branch 'upstream/dev' into integration

This commit is contained in:
J. Nick Koston
2026-02-06 17:41:17 +01:00
4 changed files with 7 additions and 13 deletions

View File

@@ -8,8 +8,8 @@ namespace gpio {
static const char *const TAG = "gpio.binary_sensor";
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
// Interrupt type strings indexed by InterruptType enum (1-3): RISING_EDGE, FALLING_EDGE, ANY_EDGE
// Index 0 is a placeholder (no enum value 0), also used as fallback for out-of-range
// Interrupt type strings indexed by edge-triggered InterruptType values:
// indices 1-3: RISING_EDGE, FALLING_EDGE, ANY_EDGE; other values (e.g. level-triggered) map to UNKNOWN (index 0).
PROGMEM_STRING_TABLE(InterruptTypeStrings, "UNKNOWN", "RISING_EDGE", "FALLING_EDGE", "ANY_EDGE");
static const LogString *interrupt_type_to_string(gpio::InterruptType type) {

View File

@@ -13,7 +13,8 @@ static const char *const TAG = "update";
PROGMEM_STRING_TABLE(UpdateStateStrings, "UNKNOWN", "NO UPDATE", "UPDATE AVAILABLE", "INSTALLING");
const LogString *update_state_to_string(UpdateState state) {
return UpdateStateStrings::get_log_str(static_cast<uint8_t>(state), 0);
return UpdateStateStrings::get_log_str(static_cast<uint8_t>(state),
static_cast<uint8_t>(UpdateState::UPDATE_STATE_UNKNOWN));
}
void UpdateEntity::publish_state() {

View File

@@ -743,9 +743,7 @@ class WiFiComponent : public Component {
#if USE_NETWORK_IPV6
uint8_t num_ipv6_addresses_{0};
#endif /* USE_NETWORK_IPV6 */
// 0 = no error, non-zero = disconnect reason code from callback
// This serves as both the error flag and stores the reason for deferred logging
uint8_t error_from_callback_{0};
bool error_from_callback_{false};
RetryHiddenMode retry_hidden_mode_{RetryHiddenMode::BLIND_RETRY};
RoamingState roaming_state_{RoamingState::IDLE};
#if defined(USE_ESP32) && defined(USE_WIFI_RUNTIME_POWER_SAVE)

View File

@@ -43,10 +43,6 @@ namespace esphome::wifi {
static const char *const TAG = "wifi_esp8266";
/// Special disconnect reason for authmode downgrade (CVE-2020-12638 mitigation)
/// Not a real WiFi reason code - used internally for deferred logging
static constexpr uint8_t WIFI_DISCONNECT_REASON_AUTHMODE_DOWNGRADE = 254;
static bool s_sta_connected = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
static bool s_sta_got_ip = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
static bool s_sta_connect_not_found = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
@@ -518,8 +514,7 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
}
s_sta_connected = false;
s_sta_connecting = false;
// Store reason as error flag; defer listener callbacks to main loop
global_wifi_component->error_from_callback_ = it.reason;
global_wifi_component->error_from_callback_ = true;
#ifdef USE_WIFI_CONNECT_STATE_LISTENERS
global_wifi_component->pending_.disconnect = true;
#endif
@@ -534,7 +529,7 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
if (it.old_mode != AUTH_OPEN && it.new_mode == AUTH_OPEN) {
ESP_LOGW(TAG, "Potential Authmode downgrade detected, disconnecting");
wifi_station_disconnect();
global_wifi_component->error_from_callback_ = WIFI_DISCONNECT_REASON_AUTHMODE_DOWNGRADE;
global_wifi_component->error_from_callback_ = true;
}
break;
}