Merge pull request #41 from lupus78/spiffs_http_info

Spiffs http info
pull/42/head
Paweł Jałocha 2021-06-06 18:29:24 +01:00 zatwierdzone przez GitHub
commit bc49ca37c9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
6 zmienionych plików z 62 dodań i 4 usunięć

Wyświetl plik

@ -42,6 +42,7 @@ void vTaskDISP(void* pvParameters)
OLED_DrawLogo(&U8G2_OLED); // draw logo
u8g2_SendBuffer(&U8G2_OLED);
vTaskDelay(2000); // allow 2sec for the user to see the logo
DISP_Page = Parameters.InitialPage;
#endif
#if defined(WITH_ST7789) || defined(WITH_ILI9341)
// LCD_Start();

Wyświetl plik

@ -23,6 +23,10 @@
#include "wifi.h"
#endif
#ifdef WITH_AP
#include "wifi.h"
#endif
#ifdef WITH_BT_SPP
#include "bt.h"
#endif
@ -592,6 +596,11 @@ void OLED_DrawStatusBar(u8g2_t *OLED, GPS_Position *GPS) // status bar on top
if(WIFI_isConnected())
{ u8g2_SetFont(OLED, u8g2_font_open_iconic_all_1x_t);
u8g2_DrawGlyph(OLED, 43, 11, 0x119); } // 0x50
#endif
#ifdef WITH_AP
if(WIFI_isAP())
{ u8g2_SetFont(OLED, u8g2_font_open_iconic_all_1x_t);
u8g2_DrawGlyph(OLED, 43, 11, 0xF8); } // 0x50
#endif
// u8g2_SetFont(OLED, u8g2_font_5x7_tr);
// u8g2_SetFont(OLED, u8g2_font_5x8_tr);
@ -744,10 +753,10 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
Line[Len]=0;
u8g2_SetFont(OLED, u8g2_font_fub20_tr);
uint8_t Altitude_width = u8g2_GetStrWidth(OLED, Line);
u8g2_DrawStr(OLED, 54-Altitude_width, 40, Line);
u8g2_DrawStr(OLED, 62-Altitude_width, 40, Line);
u8g2_SetFont(OLED, u8g2_font_9x15_tr);
u8g2_DrawStr(OLED, 58, 40, "m");
u8g2_DrawStr(OLED, 66, 40, "m");
u8g2_SetFont(OLED, u8g2_font_fub17_tr);
if(GPS && GPS->isValid())
@ -757,10 +766,10 @@ void OLED_DrawAltitudeAndSpeed(u8g2_t *OLED, GPS_Position *GPS)
Len=Format_String(Line, "---");
Line[Len]=0;
uint8_t Track_width = u8g2_GetStrWidth(OLED, Line);
u8g2_DrawStr(OLED, 116-Track_width, 40, Line);
u8g2_DrawStr(OLED, 118-Track_width, 40, Line);
u8g2_SetFont(OLED, u8g2_font_6x12_tr);
u8g2_DrawStr(OLED, 120, 28, "o");
u8g2_DrawStr(OLED, 122, 28, "o");
if(GPS && (GPS->hasBaro || GPS->isValid())) // if GPS has lock or just the pressure data
{ int16_t vario_value = GPS->ClimbRate; // [0.1m/s] climb rate

Wyświetl plik

@ -237,6 +237,13 @@ static void ParmForm_Other(httpd_req_t *Req) // produce HTML form for aircraft
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
Begin_Control_Row(Req, "Initial Page");
httpd_resp_sendstr_chunk(Req, "<input type=\"text\" name=\"InitialPage\" size=\"10\" value=\"");
Len=Format_UnsDec(Line, (uint8_t)Parameters.InitialPage);
httpd_resp_send_chunk(Req, Line, Len);
httpd_resp_sendstr_chunk(Req, "\">");
End_Control_Row(Req);
httpd_resp_sendstr_chunk(Req, "<div class=\"submit-row\"><input type=\"submit\" value=\"Apply\"></div>\n");
httpd_resp_sendstr_chunk(Req, "</form>\n"); }
@ -608,6 +615,35 @@ static void Table_Batt(httpd_req_t *Req)
httpd_resp_sendstr_chunk(Req, "</table>\n"); }
// -------------------------------------------------------------------------------------------------------------
#ifdef WITH_SPIFFS
static void Table_SPIFFS(httpd_req_t *Req)
{ char Line[128]; int Len;
httpd_resp_sendstr_chunk(Req, "<h2>SPIFFS</h2>");
httpd_resp_sendstr_chunk(Req, "<table class=\"table table-striped table-bordered\">\n");
size_t Total, Used;
if(SPIFFS_Info(Total, Used)==0) // get the SPIFFS usage summary
{
Len =Format_String(Line, "<tr><td>Free</td><td align=\"right\">");
Len+=Format_UnsDec(Line+Len, (Total-Used)/1024);
Len+=Format_String(Line+Len, " kB</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Used</td><td align=\"right\">");
Len+=Format_UnsDec(Line+Len, Used/1024);
Len+=Format_String(Line+Len, " kB</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
Len =Format_String(Line, "<tr><td>Total</td><td align=\"right\">");
Len+=Format_UnsDec(Line+Len, Total/1024);
Len+=Format_String(Line+Len, " kB</td></tr>\n");
httpd_resp_send_chunk(Req, Line, Len);
}
httpd_resp_sendstr_chunk(Req, "</table>\n"); }
#endif
// -------------------------------------------------------------------------------------------------------------
static void Html_Start(httpd_req_t *Req, const char *Title, const uint8_t ActiveMenuIndex)
@ -738,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

Wyświetl plik

@ -125,6 +125,7 @@ class FlashParameters
// char Category[16]
uint32_t PageMask; // enable/disable individual pages on the LCD or OLED screen
uint8_t InitialPage; // the first page to show after boot
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
char BTname[16];
@ -261,6 +262,7 @@ uint16_t StratuxPort;
FreqPlan = DEFAULT_FreqPlan; // [0..5]
PPSdelay = DEFAULT_PPSdelay; // [ms]
PageMask = 0xFF;
InitialPage = 0;
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
InfoParmValue(Idx)[0] = 0;
#ifdef WITH_LORAWAN
@ -667,6 +669,9 @@ uint16_t StratuxPort;
if(strcmp(Name, "PageMask")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
PageMask=Mode; return 1; }
if(strcmp(Name, "InitialPage")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
InitialPage=Mode; return 1; }
if(strcmp(Name, "Verbose")==0)
{ int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0;
Verbose=Mode; return 1; }
@ -850,6 +855,7 @@ uint16_t StratuxPort;
Write_Hex (Line, "Verbose" , (uint32_t)Verbose, 2); strcat(Line, " # [ 0..3]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_Hex (Line, "GNSS" , (uint32_t)GNSS, 2); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "InitialPage" , (uint32_t)InitialPage ); strcat(Line, " # [ ]\n"); if(fputs(Line, File)==EOF) return EOF;
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); if(fputs(Line, File)==EOF) return EOF;
#ifdef WITH_BT_PWR
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); if(fputs(Line, File)==EOF) return EOF;
@ -916,6 +922,7 @@ uint16_t StratuxPort;
Write_Hex (Line, "Verbose" , (uint32_t)Verbose, 2); strcat(Line, " # [ 0..3]\n"); Format_String(Output, Line);
Write_Hex (Line, "GNSS" , (uint32_t)GNSS , 2); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_Hex (Line, "PageMask" , (uint32_t)PageMask, 4); strcat(Line, " # [ mask]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "InitialPage" , (uint32_t)InitialPage ); strcat(Line, " # [ ]\n"); Format_String(Output, Line);
Write_UnsDec (Line, "PPSdelay" , (uint32_t)PPSdelay ); strcat(Line, " # [ ms]\n"); Format_String(Output, Line);
#ifdef WITH_BT_PWR
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); Format_String(Output, Line);

Wyświetl plik

@ -8,6 +8,7 @@ tcpip_adapter_ip_info_t WIFI_IP = { 0, 0, 0 }; // WIFI local IP address, mask a
WIFI_State_t WIFI_State;
bool WIFI_isConnected(void) { return WIFI_IP.ip.addr!=0; } // return "connected" status when IP from DHCP is there
bool WIFI_isAP(void) { return WIFI_Config.ap.ssid_len!=0; } // return if AP mode enabled
static esp_err_t WIFI_event_handler(void *ctx, system_event_t *event)
{

Wyświetl plik

@ -19,6 +19,7 @@ typedef union
extern WIFI_State_t WIFI_State;
bool WIFI_isConnected(void);
bool WIFI_isAP(void);
esp_err_t WIFI_Init(void);
esp_err_t WIFI_setPowerSave(bool ON);
esp_err_t WIFI_Start(void);