Restore 'Used size' of running app in dump_config

This commit is contained in:
Mat931
2026-05-03 20:03:38 +02:00
parent 9a73ffbae9
commit 1895ef1c3e
2 changed files with 10 additions and 6 deletions
@@ -87,6 +87,10 @@ void ESPHomeOTAComponent::setup() {
// no wakes fire and loop() falls back to the self-disable safety net.
esphome_fast_select_set_ota_listener_sock(esphome_lwip_get_sock(this->server_->get_fd()));
#endif
#ifdef USE_OTA_PARTITIONS
ota::get_running_app_position(this->running_app_offset_, this->running_app_size_);
#endif
}
void ESPHomeOTAComponent::dump_config() {
@@ -101,16 +105,12 @@ void ESPHomeOTAComponent::dump_config() {
}
#endif
#ifdef USE_OTA_PARTITIONS
// running_app_part can be nullptr if the partition cache was unloaded by a prior aborted
// partition-table OTA; surface zeros instead of dereferencing.
const esp_partition_t *running_app_part = esp_ota_get_running_partition();
ESP_LOGCONFIG(TAG,
" Partition access allowed\n"
" Running app:\n"
" Partition address: 0x%X\n"
" Partition size: 0x%X bytes",
running_app_part != nullptr ? running_app_part->address : 0u,
running_app_part != nullptr ? running_app_part->size : 0u);
" Used size: %zu bytes (0x%X)",
this->running_app_offset_, this->running_app_size_, this->running_app_size_);
#ifdef USE_ESP32
ESP_LOGCONFIG(TAG, " Partition table:");
@@ -98,6 +98,10 @@ class ESPHomeOTAComponent final : public ota::OTAComponent {
uint32_t client_connect_time_{0};
static constexpr size_t HANDSHAKE_BUF_SIZE = 5;
#ifdef USE_OTA_PARTITIONS
uint32_t running_app_offset_{0};
size_t running_app_size_{0};
#endif
uint16_t port_;
uint8_t handshake_buf_[HANDSHAKE_BUF_SIZE];
OTAState ota_state_{OTAState::IDLE};