Skip to content

Commit

Permalink
Fix esp_reset_reason_t constant names (#483)
Browse files Browse the repository at this point in the history
The esp_reset_reason_t ESP_RST_PG and ESP_RST_CPU constant names don't
seem to exist. Instead, the actual names (added in esp-idf 5.2.2) are
ESP_RST_PWR_GLITCH and ESP_RST_CPU_LOCKUP.

The incorrect names caused the second-to-last match arm to be
interpreted as a binding name (that is, a catch-all), causing incorrect
behavior and build warnings when using esp-idf 5.2.2 and up.
  • Loading branch information
elipsitz authored Sep 26, 2024
1 parent d3247c2 commit 3dbf3fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ impl From<esp_reset_reason_t> for ResetReason {
esp_idf_version_full = "5.2.0",
esp_idf_version_full = "5.2.1",
)))]
esp_reset_reason_t_ESP_RST_PG => Self::PowerGlitch,
esp_reset_reason_t_ESP_RST_PWR_GLITCH => Self::PowerGlitch,
#[cfg(not(any(
esp_idf_version_major = "4",
all(esp_idf_version_major = "5", esp_idf_version_minor = "0"),
all(esp_idf_version_major = "5", esp_idf_version_minor = "1"),
esp_idf_version_full = "5.2.0",
esp_idf_version_full = "5.2.1",
)))]
esp_reset_reason_t_ESP_RST_CPU => Self::CPULockup,
esp_reset_reason_t_ESP_RST_CPU_LOCKUP => Self::CPULockup,
_ => unreachable!(),
}
}
Expand Down

0 comments on commit 3dbf3fe

Please sign in to comment.