feat: Add build metadata to STATUS, enable size optimization

STATUS now includes built=, idf=, chip= fields for diagnostics.
Switch to -Os compiler optimization (saves ~75 KB).
This commit is contained in:
user
2026-02-05 22:42:45 +01:00
parent 456b4f0b9a
commit eb4c3d1657
2 changed files with 15 additions and 4 deletions

View File

@@ -36,6 +36,7 @@
#include "esp_ota_ops.h"
#include "esp_https_ota.h"
#include "esp_partition.h"
#include "esp_chip_info.h"
#include "esp_http_client.h"
#include "driver/gpio.h"
#include "soc/soc_caps.h"
@@ -1533,13 +1534,21 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
const esp_partition_t *running = esp_ota_get_running_partition();
uint32_t part_size = running ? running->size : 0;
/* Chip info */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
const char *chip_model = (chip_info.model == CHIP_ESP32S3) ? "ESP32S3" :
(chip_info.model == CHIP_ESP32C3) ? "ESP32C3" :
(chip_info.model == CHIP_ESP32) ? "ESP32" : "ESP32xx";
snprintf(reply, reply_size,
"OK STATUS uptime=%s uptime_s=%lld heap=%lu rssi=%d channel=%d tx_power=%d rate=%d csi_rate=%d"
" hostname=%s version=%s adaptive=%s motion=%d ble=%s target=%s:%d"
" temp=%.1f csi_count=%lu boots=%lu rssi_min=%d rssi_max=%d"
" csi_mode=%s hybrid_n=%d auth=%s flood_thresh=%d/%d powersave=%s"
" presence=%s pr_score=%.4f chanscan=%s"
" nvs_used=%lu nvs_free=%lu nvs_total=%lu part_size=%lu",
" nvs_used=%lu nvs_free=%lu nvs_total=%lu part_size=%lu"
" built=%s_%s idf=%s chip=%sr%dc%d",
uptime_str, (long long)up, (unsigned long)heap, rssi, channel, (int)s_tx_power_dbm,
s_send_frequency, actual_rate,
s_hostname, app_desc->version,
@@ -1556,7 +1565,9 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
(unsigned long)nvs_stats.used_entries,
(unsigned long)nvs_stats.free_entries,
(unsigned long)nvs_stats.total_entries,
(unsigned long)part_size);
(unsigned long)part_size,
app_desc->date, app_desc->time, app_desc->idf_ver,
chip_model, chip_info.revision, chip_info.cores);
return strlen(reply);
}