mirror of
https://github.com/esphome/esphome.git
synced 2026-02-20 16:35:37 -07:00
remove untested support for rp2040 and libretiny platforms
This commit is contained in:
committed by
Kevin Ahrendt
parent
a3677daee1
commit
5115aeeb2b
@@ -17,9 +17,7 @@
|
||||
extern "C" {
|
||||
#include <user_interface.h>
|
||||
}
|
||||
#elif defined(USE_RP2040)
|
||||
#include <pico/cyw43_arch.h>
|
||||
#endif // USE_ESP32 / USE_ESP8266 / USE_RP2040
|
||||
#endif // USE_ESP32 / USE_ESP8266
|
||||
#endif // USE_WIFI
|
||||
#endif // USE_TEXT_SENSOR
|
||||
|
||||
@@ -96,10 +94,6 @@ class DebugComponent : public PollingComponent {
|
||||
wifi_ps_type_t last_wifi_ps_mode_{};
|
||||
#elif defined(USE_WIFI) && defined(USE_ESP8266)
|
||||
sleep_type_t last_wifi_sleep_type_{};
|
||||
#elif defined(USE_WIFI) && defined(USE_RP2040)
|
||||
uint32_t last_wifi_pm_{CYW43_PERFORMANCE_PM};
|
||||
#elif defined(USE_WIFI) && defined(USE_LIBRETINY)
|
||||
bool last_wifi_sleep_{false};
|
||||
#endif
|
||||
#endif // USE_TEXT_SENSOR
|
||||
|
||||
|
||||
@@ -7,17 +7,6 @@ namespace debug {
|
||||
|
||||
static const char *const TAG = "debug";
|
||||
|
||||
#if defined(USE_TEXT_SENSOR) && defined(USE_WIFI)
|
||||
/// @brief Helper function to convert LibreTiny WiFi sleep state to string
|
||||
/// @param sleep_enabled WiFi sleep enabled state from WiFi.getSleep()
|
||||
/// @return const char pointer to the readable sleep state
|
||||
///
|
||||
/// LibreTiny WiFi sleep is a boolean on/off setting:
|
||||
/// - true (sleep enabled) -> "ON"
|
||||
/// - false (sleep disabled) -> "OFF"
|
||||
static const char *wifi_sleep_to_string(bool sleep_enabled) { return sleep_enabled ? "ON" : "OFF"; }
|
||||
#endif // USE_TEXT_SENSOR && USE_WIFI
|
||||
|
||||
std::string DebugComponent::get_reset_reason_() { return lt_get_reboot_reason_name(lt_get_reboot_reason()); }
|
||||
|
||||
uint32_t DebugComponent::get_free_heap_() { return lt_heap_get_free(); }
|
||||
@@ -48,17 +37,6 @@ void DebugComponent::update_platform_() {
|
||||
this->block_sensor_->publish_state(lt_heap_get_max_alloc());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_TEXT_SENSOR) && defined(USE_WIFI)
|
||||
if (this->wifi_power_save_ != nullptr) {
|
||||
bool sleep_enabled = WiFi.getSleep();
|
||||
// Publish if the state has changed or if this is the first read
|
||||
if (this->last_wifi_sleep_ != sleep_enabled || !this->wifi_power_save_->has_state()) {
|
||||
this->wifi_power_save_->publish_state(wifi_sleep_to_string(sleep_enabled));
|
||||
this->last_wifi_sleep_ = sleep_enabled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace debug
|
||||
|
||||
@@ -2,39 +2,11 @@
|
||||
#ifdef USE_RP2040
|
||||
#include "esphome/core/log.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef USE_WIFI
|
||||
#include <pico/cyw43_arch.h>
|
||||
#endif
|
||||
|
||||
namespace esphome {
|
||||
namespace debug {
|
||||
|
||||
static const char *const TAG = "debug";
|
||||
|
||||
#if defined(USE_TEXT_SENSOR) && defined(USE_WIFI)
|
||||
/// @brief Helper function to convert RP2040 CYW43 WiFi power mode to string
|
||||
/// @param pm WiFi power mode from cyw43_state.pm
|
||||
/// @return const char pointer to the readable power mode
|
||||
///
|
||||
/// Maps RP2040 CYW43 WiFi power modes to user-friendly strings:
|
||||
/// - CYW43_PERFORMANCE_PM (no power saving) -> "NONE"
|
||||
/// - CYW43_DEFAULT_PM (default power saving) -> "LIGHT"
|
||||
/// - CYW43_AGGRESSIVE_PM (aggressive power saving) -> "HIGH"
|
||||
static const char *wifi_pm_to_string(uint32_t pm) {
|
||||
switch (pm) {
|
||||
case CYW43_PERFORMANCE_PM:
|
||||
return "NONE";
|
||||
case CYW43_DEFAULT_PM:
|
||||
return "LIGHT";
|
||||
case CYW43_AGGRESSIVE_PM:
|
||||
return "HIGH";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
#endif // USE_TEXT_SENSOR && USE_WIFI
|
||||
|
||||
std::string DebugComponent::get_reset_reason_() { return ""; }
|
||||
|
||||
uint32_t DebugComponent::get_free_heap_() { return rp2040.getFreeHeap(); }
|
||||
@@ -44,18 +16,7 @@ void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
device_info += "CPU Frequency: " + to_string(rp2040.f_cpu());
|
||||
}
|
||||
|
||||
void DebugComponent::update_platform_() {
|
||||
#if defined(USE_TEXT_SENSOR) && defined(USE_WIFI)
|
||||
if (this->wifi_power_save_ != nullptr) {
|
||||
uint32_t pm = cyw43_state.pm;
|
||||
// Publish if the state has changed or if this is the first read
|
||||
if (this->last_wifi_pm_ != pm || !this->wifi_power_save_->has_state()) {
|
||||
this->wifi_power_save_->publish_state(wifi_pm_to_string(pm));
|
||||
this->last_wifi_pm_ = pm;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void DebugComponent::update_platform_() {}
|
||||
|
||||
} // namespace debug
|
||||
} // namespace esphome
|
||||
|
||||
@@ -32,7 +32,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
icon=ICON_WIFI,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
cv.only_on(["esp32", "esp8266", "rp2040", "bk72xx", "rtl87xx"]),
|
||||
cv.only_on(["esp32", "esp8266"]),
|
||||
cv.requires_component("wifi"),
|
||||
),
|
||||
}
|
||||
|
||||
@@ -1,10 +1 @@
|
||||
<<: !include common.yaml
|
||||
|
||||
wifi:
|
||||
ssid: "WIFI SSID"
|
||||
password: "WIFI PASSWORD"
|
||||
|
||||
text_sensor:
|
||||
- platform: debug
|
||||
power_save_mode:
|
||||
name: "WiFi Power Save Mode"
|
||||
|
||||
@@ -1,10 +1 @@
|
||||
<<: !include common.yaml
|
||||
|
||||
wifi:
|
||||
ssid: "WIFI SSID"
|
||||
password: "WIFI PASSWORD"
|
||||
|
||||
text_sensor:
|
||||
- platform: debug
|
||||
power_save_mode:
|
||||
name: "WiFi Power Save Mode"
|
||||
|
||||
Reference in New Issue
Block a user