From 1e1502da6c3550e42752a21ce5948e642d9699bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Farkas=20Szil=C3=A1rd?= Date: Sun, 6 Jun 2021 18:13:54 +0200 Subject: [PATCH] SPIFFS info on HTTP interface --- main/http.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/main/http.cpp b/main/http.cpp index 2a5ab19..5ee7fc0 100644 --- a/main/http.cpp +++ b/main/http.cpp @@ -615,6 +615,35 @@ static void Table_Batt(httpd_req_t *Req) httpd_resp_sendstr_chunk(Req, "\n"); } +// ------------------------------------------------------------------------------------------------------------- +#ifdef WITH_SPIFFS +static void Table_SPIFFS(httpd_req_t *Req) +{ char Line[128]; int Len; + + httpd_resp_sendstr_chunk(Req, "

SPIFFS

"); + httpd_resp_sendstr_chunk(Req, "\n"); + + size_t Total, Used; + if(SPIFFS_Info(Total, Used)==0) // get the SPIFFS usage summary + { + Len =Format_String(Line, "\n"); + httpd_resp_send_chunk(Req, Line, Len); + + Len =Format_String(Line, "\n"); + httpd_resp_send_chunk(Req, Line, Len); + + Len =Format_String(Line, "\n"); + httpd_resp_send_chunk(Req, Line, Len); + } + httpd_resp_sendstr_chunk(Req, "
Free"); + Len+=Format_UnsDec(Line+Len, (Total-Used)/1024); + Len+=Format_String(Line+Len, " kB
Used"); + Len+=Format_UnsDec(Line+Len, Used/1024); + Len+=Format_String(Line+Len, " kB
Total"); + Len+=Format_UnsDec(Line+Len, Total/1024); + Len+=Format_String(Line+Len, " kB
\n"); } +#endif + // ------------------------------------------------------------------------------------------------------------- static void Html_Start(httpd_req_t *Req, const char *Title, const uint8_t ActiveMenuIndex) @@ -745,6 +774,9 @@ static esp_err_t top_get_handler(httpd_req_t *Req) Table_GPS(Req); Table_RF(Req); Table_Batt(Req); +#ifdef WITH_SPIFFS + Table_SPIFFS(Req); +#endif #ifdef WITH_LOOKOUT Table_LookOut(Req); #endif