Date | ");
Len+=Format_UnsDec(Line+Len, GPS->Year+2000 , 4); Line[Len++]='.';
@@ -361,8 +434,9 @@ static void Table_GPS(httpd_req_t *Req)
#ifdef WITH_LOOKOUT
static void Table_LookOut(httpd_req_t *Req)
{ char Line[128]; int Len;
- httpd_resp_sendstr_chunk(Req, "\n");
- httpd_resp_sendstr_chunk(Req, "LookOut | | | \n");
+ httpd_resp_sendstr_chunk(Req, "LookOut");
+ httpd_resp_sendstr_chunk(Req, "\n");
+ httpd_resp_sendstr_chunk(Req, "LookOut | Time Margin | Distance | \n\n");
for( uint8_t Idx=0; IdxAlloc) continue;
@@ -375,15 +449,16 @@ static void Table_LookOut(httpd_req_t *Req)
Len+=Format_String(Line+Len, "km\n");
httpd_resp_send_chunk(Req, Line, Len); }
- httpd_resp_sendstr_chunk(Req, " \n"); }
+ httpd_resp_sendstr_chunk(Req, "\n \n"); }
#endif
// -------------------------------------------------------------------------------------------------------------
static void Table_Relay(httpd_req_t *Req)
{ char Line[128]; int Len;
- httpd_resp_sendstr_chunk(Req, "\n");
- httpd_resp_sendstr_chunk(Req, "Relay | Rank | [sec] | \n");
+ httpd_resp_sendstr_chunk(Req, "Relay");
+ httpd_resp_sendstr_chunk(Req, "\n");
+ httpd_resp_sendstr_chunk(Req, "Relay | Rank | [sec] | \n\n");
for( uint8_t Idx=0; Idx *Packet = RelayQueue.Packet+Idx; if(Packet->Rank==0) continue;
@@ -398,15 +473,16 @@ static void Table_Relay(httpd_req_t *Req)
Len+=Format_String(Line+Len, "\n");
httpd_resp_send_chunk(Req, Line, Len); }
- httpd_resp_sendstr_chunk(Req, " \n"); }
+ httpd_resp_sendstr_chunk(Req, "\n \n"); }
// -------------------------------------------------------------------------------------------------------------
static void Table_RF(httpd_req_t *Req)
{ char Line[128]; int Len;
- httpd_resp_sendstr_chunk(Req, "\n");
- Len=Format_String(Line, "RF chip | ");
+ httpd_resp_sendstr_chunk(Req, "RF chip");
+ httpd_resp_sendstr_chunk(Req, "\n");
+ Len=Format_String(Line, "RF chip | ");
#ifdef WITH_RFM69
Len+=Format_String(Line+Len, "RFM69");
#endif
@@ -466,8 +542,8 @@ static uint8_t BattCapacity(uint16_t mVolt)
static void Table_Batt(httpd_req_t *Req)
{ char Line[128]; int Len;
- httpd_resp_sendstr_chunk(Req, "\n");
- httpd_resp_sendstr_chunk(Req, "Battery | | \n");
+ httpd_resp_sendstr_chunk(Req, "Battery");
+ httpd_resp_sendstr_chunk(Req, "\n");
Len =Format_String(Line, "Voltage | ");
#ifdef WITH_MAVLINK
@@ -534,20 +610,55 @@ static void Table_Batt(httpd_req_t *Req)
// -------------------------------------------------------------------------------------------------------------
-static void Top_Bar(httpd_req_t *Req)
-{ char Line[32]; int Len;
+static void Html_Start(httpd_req_t *Req, const char *Title, const uint8_t ActiveMenuIndex)
+{
+ httpd_resp_sendstr_chunk(Req, "\
+\n\
+\n\
+\n\
+");
+ httpd_resp_sendstr_chunk(Req, Title);
+ httpd_resp_sendstr_chunk(Req, "\n\
+\n\
+\
+\n\
+\n\
+");
+ httpd_resp_sendstr_chunk(Req, "OGN-Tracker\n");
- httpd_resp_sendstr_chunk(Req, "OGN-Tracker\n");
- httpd_resp_sendstr_chunk(Req, "EUID: ");
- Len=Format_Hex(Line, getUniqueID());
- httpd_resp_send_chunk(Req, Line, Len);
- httpd_resp_sendstr_chunk(Req, " \n");
+ httpd_resp_sendstr_chunk(Req, "\n");
+
+ httpd_resp_sendstr_chunk(Req, "\n");
+}
+
+static void Html_End(httpd_req_t *Req)
+{
+ httpd_resp_sendstr_chunk(Req, " \n\n\n");
+ httpd_resp_send_chunk(Req, 0, 0);
}
// ============================================================================================================
@@ -576,56 +687,33 @@ static esp_err_t parm_get_handler(httpd_req_t *Req)
Line++; }
free(URL);
Parameters.WriteToNVS(); }
- httpd_resp_sendstr_chunk(Req, "\
-\n\
-\n\
-\n\
-\n\
-\n\
-\n\
-OGN-Tracker configuration\n\
-");
- Top_Bar(Req);
+ Html_Start(Req, "OGN-Tracker configuration", 2);
- httpd_resp_sendstr_chunk(Req, "\n\n");
ParmForm_Acft(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
ParmForm_Info(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
ParmForm_GPS(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
#ifdef WITH_AP
ParmForm_AP(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
#endif
#ifdef WITH_STRATUX
ParmForm_Stratux(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
#endif
ParmForm_Other(Req);
- httpd_resp_sendstr_chunk(Req, " | \n\n");
+
httpd_resp_sendstr_chunk(Req, "\
\n");
- // httpd_resp_sendstr_chunk(Req, "\n");
+
httpd_resp_sendstr_chunk(Req, "\
\n");
- // httpd_resp_sendstr_chunk(Req, "\n");
- httpd_resp_sendstr_chunk(Req, " | \n \n");
- httpd_resp_sendstr_chunk(Req, "\n\n");
- httpd_resp_send_chunk(Req, 0, 0);
+
+ Html_End(Req);
if(Restart)
{
@@ -639,28 +727,23 @@ static esp_err_t parm_get_handler(httpd_req_t *Req)
static esp_err_t top_get_handler(httpd_req_t *Req)
{
- httpd_resp_sendstr_chunk(Req, "\
-\n\
-\n\
-OGN-Tracker status\n\
-");
+ Html_Start(Req, "OGN-Tracker status", 1);
- Top_Bar(Req);
+ char Line[32]; int Len;
+ httpd_resp_sendstr_chunk(Req, "EUID: ");
+ Len=Format_Hex(Line, getUniqueID());
+ httpd_resp_send_chunk(Req, Line, Len);
+ httpd_resp_sendstr_chunk(Req, " \n");
Table_GPS(Req);
- httpd_resp_sendstr_chunk(Req, " \n");
Table_RF(Req);
- httpd_resp_sendstr_chunk(Req, " \n");
Table_Batt(Req);
#ifdef WITH_LOOKOUT
- httpd_resp_sendstr_chunk(Req, " \n");
Table_LookOut(Req);
#endif
- httpd_resp_sendstr_chunk(Req, " \n");
Table_Relay(Req);
- httpd_resp_sendstr_chunk(Req, "\n");
- httpd_resp_sendstr_chunk(Req, 0);
+ Html_End(Req);
return ESP_OK; }
static int Format_DateTime(char *Out, time_t Time)
@@ -842,17 +925,7 @@ static esp_err_t log_get_handler(httpd_req_t *Req)
return SendLog_TLG(Req, FullName, Time); }
}
}
- httpd_resp_sendstr_chunk(Req, "\
-\n\
-\n\
-\n\
-\n\
-\n\
-\n\
-OGN-Tracker log files\n\
-");
-
- Top_Bar(Req);
+ Html_Start(Req, "OGN-Tracker log files", 3);
std::vector FileList; // list of log files
DIR *Dir=opendir(Path); // open the log file directory
@@ -870,7 +943,7 @@ static esp_err_t log_get_handler(httpd_req_t *Req)
closedir(Dir);
std::sort(FileList.begin(), FileList.end());
- httpd_resp_sendstr_chunk(Req, "\nFile | | | [KB] | Date | \n");
+ httpd_resp_sendstr_chunk(Req, "\nFile | | | [KB] | Date | \n\n");
for(size_t Idx=0; Idx\n");
httpd_resp_send_chunk(Req, Line, Len);
vTaskDelay(1); }
- httpd_resp_sendstr_chunk(Req, " \n");
+ httpd_resp_sendstr_chunk(Req, " \n");
- httpd_resp_sendstr_chunk(Req, "\n\n");
- httpd_resp_send_chunk(Req, 0, 0);
+ Html_End(Req);
return ESP_OK; }
static esp_err_t logo_get_handler(httpd_req_t *Req)
| | |
---|
|