From 24c03733909f0bc3127aa87f374318b42ed31774 Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Sun, 7 Mar 2021 16:28:19 +0000 Subject: [PATCH] More header lines for HTTP IGC and some bugs fixed --- main/http.cpp | 31 +++++++++++++++++++++++++++++++ main/sdlog.cpp | 9 ++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/main/http.cpp b/main/http.cpp index 34f6f02..0c7308d 100644 --- a/main/http.cpp +++ b/main/http.cpp @@ -715,6 +715,37 @@ static esp_err_t SendLog_IGC(httpd_req_t *Req, const char *FileName, uint32_t Fi { Len+=Format_String(Line+Len, "HFPLTPilotincharge:"); Len+=Format_String(Line+Len, Parameters.Pilot); Line[Len++]='\n'; } + if(Parameters.Reg[0]) + { Len+=Format_String(Line+Len, "HFGIDGliderID:"); + Len+=Format_String(Line+Len, Parameters.Reg); + Line[Len++]='\n'; } +#ifdef WITH_FollowMe + Len+=Format_String(Line+Len, "HFRHWHardwareVersion:FollowMe\n"); +#else + Len+=Format_String(Line+Len, "HFRHWHardwareVersion:ESP32+LoRa\n"); // hardware version +#endif + Len+=Format_String(Line+Len, "HFRFWFirmwareVersion:ESP32-OGN-TRACKER " __DATE__ " " __TIME__ "\n"); +#ifdef WITH_BMP180 + Len+=Format_String(Line+Len, "HFPRSPressAltSensor:BMP180\n"); // pressure sensor +#endif +#ifdef WITH_BMP280 + Len+=Format_String(Line+Len, "HFPRSPressAltSensor:BMP280\n"); // pressure sensor +#endif +#ifdef WITH_BME280 + Len+=Format_String(Line+Len, "HFPRSPressAltSensor:BME280/BMP280\n"); // pressure sensor +#endif + Len+=Format_String(Line+Len, "LOGN"); + Len+=Format_HHMMSS(Line+Len, FileTime); + Len+=Format_String(Line+Len, "ID "); + Len+=Format_Hex(Line+Len, Parameters.AcftID); + Line[Len++]='\n'; + uint64_t MAC = getUniqueID(); + Len+=Format_String(Line+Len, "LOGN"); + Len+=Format_HHMMSS(Line+Len, FileTime); + Len+=Format_String(Line+Len, "MAC "); + Len+=Format_Hex(Line+Len, (uint16_t)(MAC>>32)); // ESP32 48-bit ID + Len+=Format_Hex(Line+Len, (uint32_t) MAC ); + Line[Len++]='\n'; httpd_resp_send_chunk(Req, Line, Len); mbedtls_md5_update_ret(&MD5, (uint8_t *)Line, Len); OGN_LogPacket Packet; diff --git a/main/sdlog.cpp b/main/sdlog.cpp index 0a0aa14..2288ec0 100644 --- a/main/sdlog.cpp +++ b/main/sdlog.cpp @@ -204,9 +204,9 @@ static int IGC_Header(const GPS_Position &Pos) // write the IGC_HeadParm("HFCIDCompetitionID:", Parameters.ID); // competition ID { #ifdef WITH_FollowMe - int Len=Format_String(Line, "HFRHWHardwareVersion:FollowMe"); + int Len=Format_String(Line, "HFRHWHardwareVersion:FollowMe\n"); #else - int Len=Format_String(Line, "HFRHWHardwareVersion:ESP32-SX1276"); // hardware version + int Len=Format_String(Line, "HFRHWHardwareVersion:ESP32+LoRa\n"); // hardware version #endif Line[Len++]='\n'; Line[Len]=0; IGC_LogLine(Line, Len); } @@ -221,11 +221,14 @@ static int IGC_Header(const GPS_Position &Pos) // write the IGC_LogLine("HFGPSReceiver:MTK\n"); // GPS sensor #endif #endif +#ifdef WITH_BMP180 + IGC_LogLine("HFPRSPressAltSensor:BMP180\n"); // pressure sensor +#endif #ifdef WITH_BMP280 IGC_LogLine("HFPRSPressAltSensor:BMP280\n"); // pressure sensor #endif #ifdef WITH_BME280 - IGC_LogLine("HFPRSPressAltSensor:BME280\n"); // pressure sensor + IGC_LogLine("HFPRSPressAltSensor:BME280/BMP280\n"); // pressure sensor #endif return 0; }