diff --git a/FollowMe_old.cfg b/FollowMe_old.cfg index c808af8..a0a68d5 100644 --- a/FollowMe_old.cfg +++ b/FollowMe_old.cfg @@ -60,8 +60,8 @@ #define WITH_LORAWAN -#define WITH_AP -// #define WITH_STRATUX +#define WITH_AP // creat WiFi Access Point for data, setup and log files +// #define WITH_STRATUX // connect to Stratux WiFi as a client // #define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link // #define WITH_APRS // attempt to connect to the wifi router for uploading the log files to APRS diff --git a/main/gps.cpp b/main/gps.cpp index b5973e1..00f4be1 100644 --- a/main/gps.cpp +++ b/main/gps.cpp @@ -24,10 +24,10 @@ // #define DEBUG_PRINT -#ifdef DEBUG_PRINT +// #ifdef DEBUG_PRINT static char Line[128]; static void CONS_HexDump(char Byte) { Format_Hex(CONS_UART_Write, (uint8_t)Byte); } -#endif +// #endif // ---------------------------------------------------------------------------- @@ -255,6 +255,28 @@ static void GPS_BurstStart(void) // wh { if(!GPS_Status.ModeConfig) // if GPS navigation mode is not done yet { // Format_String(CONS_UART_Write, "CFG_NAV5 query...\n"); #ifdef WITH_GPS_UBX + if(Parameters.NavRate) + { UBX_CFG_RATE CFG_RATE; + CFG_RATE.measRate = 1000/Parameters.NavRate; + CFG_RATE.navRate = 1; + CFG_RATE.timeRef = 0; + UBX_RxMsg::Send(0x06, 0x08, GPS_UART_Write, (uint8_t*)(&CFG_RATE), sizeof(CFG_RATE)); +// #ifdef DEBUG_PRINT + Format_String(CONS_UART_Write, "GPS <- CFG-RATE: "); + UBX_RxMsg::Send(0x06, 0x08, CONS_HexDump, (uint8_t*)(&CFG_RATE), sizeof(CFG_RATE)); + Format_String(CONS_UART_Write, "\n"); +// #endif + } + { UBX_CFG_NAV5 CFG_NAV5; + CFG_NAV5.setDynModel(Parameters.NavMode); + UBX_RxMsg::Send(0x06, 0x24, GPS_UART_Write, (uint8_t*)(&CFG_NAV5), sizeof(CFG_NAV5)); +// #ifdef DEBUG_PRINT + Format_String(CONS_UART_Write, "GPS <- CFG-NAV5: "); + UBX_RxMsg::Send(0x06, 0x24, CONS_HexDump, (uint8_t*)(&CFG_NAV5), sizeof(CFG_NAV5)); + Format_String(CONS_UART_Write, "\n"); +// #endif + } + UBX_RxMsg::Send(0x06, 0x08, GPS_UART_Write); // send the query for the navigation rate UBX_RxMsg::Send(0x06, 0x24, GPS_UART_Write); // send the query for the navigation mode setting if(!GPS_Status.NMEA) // if NMEA sentences are not there { UBX_CFG_MSG CFG_MSG; // send CFG_MSG to enable the NMEA sentences diff --git a/main/http.cpp b/main/http.cpp index be4c0a1..8c40675 100644 --- a/main/http.cpp +++ b/main/http.cpp @@ -23,6 +23,7 @@ // ============================================================================================================ +// generic HTML list for submit forms static void SelectList(httpd_req_t *Req, const char *Name, const char **List, int Size, int Sel=0) { char Line[64]; int Len; Len =Format_String(Line, "\n"); @@ -75,7 +77,8 @@ static void ParmForm_Info(httpd_req_t *Req) // produce HTML form for aircraft p httpd_resp_sendstr_chunk(Req, "\n"); } -static void ParmForm_Acft(httpd_req_t *Req) // produce HTML form for aircraft parameters +// HTML form for the Aircraft identification: address, address-type, aircraft-type +static void ParmForm_Acft(httpd_req_t *Req) { char Line[16]; httpd_resp_sendstr_chunk(Req, "
\n\n"); @@ -99,13 +102,51 @@ static void ParmForm_Acft(httpd_req_t *Req) // produce HTML form for aircraft p httpd_resp_sendstr_chunk(Req, "
\n"); } +static void ParmForm_GPS(httpd_req_t *Req) // produce HTML form for GPS parameters +{ char Line[16]; int Len; + + httpd_resp_sendstr_chunk(Req, "
\n\n"); +#ifdef WITH_GPS_UBX + httpd_resp_sendstr_chunk(Req, "\n"); +#else +#ifdef WITH_GPS_MTK + httpd_resp_sendstr_chunk(Req, "\n"); +#else + httpd_resp_sendstr_chunk(Req, "\n"); +#endif +#endif + + httpd_resp_sendstr_chunk(Req, "\n"); + + httpd_resp_sendstr_chunk(Req, "\n"); + + httpd_resp_sendstr_chunk(Req, "\n"); + + httpd_resp_sendstr_chunk(Req, "
GPS: UBX
GPS: MTK
GPS
Nav. rate [Hz]
Nav. mode
Geoid-Separ.\n"); + + const char *GeoidSeparTable[2] = { "GPS", "Override" } ; + SelectList(Req, "manGeoidSepar", GeoidSeparTable, 2, Parameters.manGeoidSepar); + + httpd_resp_sendstr_chunk(Req, "\n"); + + httpd_resp_sendstr_chunk(Req, "
\n"); } + static void ParmForm_Other(httpd_req_t *Req) // produce HTML form for aircraft parameters { char Line[16]; int Len; httpd_resp_sendstr_chunk(Req, "
\n\n"); httpd_resp_sendstr_chunk(Req, "\n"); - const char *FreqPlanTable[16] = { "Auto", "Europe/Africa", "USA/Canada", "Australia/Chile", "New Zeeland", "Izrael" }; + const char *FreqPlanTable[6] = { "Auto", "Europe/Africa", "USA/Canada", "Australia/Chile", "New Zeeland", "Izrael" }; httpd_resp_sendstr_chunk(Req, "\n"); @@ -161,12 +202,12 @@ static void ParmForm_Stratux(httpd_req_t *Req) // Connection to Stratux WiFi par 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"); @@ -194,7 +235,7 @@ static void ParmForm_AP(httpd_req_t *Req) // Wi-Fi access point parameters { cha httpd_resp_send_chunk(Req, Line, Len); httpd_resp_sendstr_chunk(Req, "\">\n"); - httpd_resp_sendstr_chunk(Req, "\n"); @@ -461,7 +502,7 @@ static void Top_Bar(httpd_req_t *Req) { char Line[32]; int Len; httpd_resp_sendstr_chunk(Req, "

OGN-Tracker

\n"); - httpd_resp_sendstr_chunk(Req, "CPU ID: "); + httpd_resp_sendstr_chunk(Req, "EUID: "); Len=Format_Hex(Line, getUniqueID()); httpd_resp_send_chunk(Req, Line, Len); httpd_resp_sendstr_chunk(Req, "
\n"); @@ -514,6 +555,8 @@ static esp_err_t parm_get_handler(httpd_req_t *Req) httpd_resp_sendstr_chunk(Req, "\n
\n\n\n
Other
Freq. plan\n"); SelectList(Req, "FreqPlan", FreqPlanTable, 6, Parameters.FreqPlan); httpd_resp_sendstr_chunk(Req, "
Tx [dBm]Tx power [dBm]>2, 2, 1); httpd_resp_send_chunk(Req, Line, Len); httpd_resp_sendstr_chunk(Req, "\">
Min. signal [dBm]Min. RSSI [dBm]
Tx [dBm]Tx power [dBm]>2, 2, 1); httpd_resp_send_chunk(Req, Line, Len); httpd_resp_sendstr_chunk(Req, "\">
\n"); ParmForm_Info(Req); httpd_resp_sendstr_chunk(Req, "
\n"); + ParmForm_GPS(Req); + httpd_resp_sendstr_chunk(Req, "
\n"); #ifdef WITH_AP ParmForm_AP(Req); httpd_resp_sendstr_chunk(Req, "
\n"); diff --git a/main/nmea.h b/main/nmea.h index 94c71cd..04fc337 100644 --- a/main/nmea.h +++ b/main/nmea.h @@ -141,7 +141,7 @@ inline uint8_t NMEA_AppendCheckCRNL(char *NMEA, uint8_t Len) { return NMEA_Appen if(Data[4]!='G') return 0; return Data[5]=='A'; } - uint8_t isGPGSA(void) const // + uint8_t isGPGSA(void) const // GPS satellite data { if(!isGP()) return 0; if(Data[3]!='G') return 0; if(Data[4]!='S') return 0; diff --git a/main/parameters.h b/main/parameters.h index eb06042..0de6c90 100644 --- a/main/parameters.h +++ b/main/parameters.h @@ -212,12 +212,14 @@ uint16_t StratuxPort; Flags = 0; #ifdef WITH_GPS_UBX - NavMode = 6; // Avionic mode 1g for UBX + NavMode = 6; // 6 = Avionic mode 1g for UBX #endif #ifdef WITH_GPS_MTK - NavMode = 2; // Avionic mode for MTK + NavMode = 2; // 2 = Avionic mode for MTK #endif NavRate = 1; // [Hz] + GeoidSepar = 10*DEFAULT_GeoidSepar; // [0.1m] + Verbose = 1; RFchipTempCorr = 0; // [degC] @@ -225,7 +227,6 @@ uint16_t StratuxPort; CONprot = 0xFF; PressCorr = 0; // [0.25Pa] TimeCorr = 0; // [sec] - GeoidSepar = 10*DEFAULT_GeoidSepar; // [0.1m] FreqPlan = DEFAULT_FreqPlan; // [0..5] PPSdelay = DEFAULT_PPSdelay; // [ms] diff --git a/main/ubx.h b/main/ubx.h index 0f8f8ff..fe0b352 100644 --- a/main/ubx.h +++ b/main/ubx.h @@ -57,6 +57,41 @@ class UBX_NAV_SOL // 0x01 0x06 uint8_t reserved2[4]; // } ; +class UBX_NAV_PVT // 0x01 0x07 +{ public: + uint32_t iTOW; // [ms] + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t min; + uint8_t sec; + uint8_t valid; + uint32_t tAcc; + int32_t nano; + uint8_t fixType; + uint8_t flags; + uint8_t flags2; + uint8_t numSV; + int32_t lon; + int32_t lat; + int32_t height; + int32_t hMSL; + uint32_t hAcc; + uint32_t vAcc; + int32_t velN; + int32_t velE; + int32_t velD; + int32_t gSpeed; + int32_t headMot; + uint32_t sAcc; + uint32_t headAcc; + uint16_t pDOP; + uint8_t reserved1[6]; + int32_t headVeh; + uint8_t reserved2[4]; +} ; + class UBX_NAV_VELNED // 0x01 0x12 { public: uint32_t iTOW; // [ms] Time-of-Week @@ -126,6 +161,9 @@ class UBX_CFG_PRT // 0x06 0x00 int16_t outProtoMask; // bit 0:UBX, bit 1:NMEA uint16_t flags; // bit 1:extendedTxTimeout uint16_t reserved2; + public: + // void setBaudRate(uint32_t BaudRate) + // { } } ; class UBX_CFG_MSG // 0x06 0x01 @@ -171,6 +209,8 @@ class UBX_CFG_NAV5 // 0x06 0x24 uint8_t reserved2[2]; uint32_t reserved3; uint32_t reserved4; + public: + void setDynModel(uint8_t DynModel) { mask = 0x0001; dynModel=DynModel; } // only change the dynamic model } ; // UBX Class packet numbers @@ -280,9 +320,9 @@ class UBX_RxMsg // receiver for the UBX sentences CheckB += CheckA; (*SendByte)(DataLen); CheckA += DataLen; - CheckB += CheckA; // pass PollDataLen + CheckB += CheckA; // pass DataLen LSB (*SendByte)(0x00); - CheckB += CheckA; // pass 0x00 + CheckB += CheckA; // pass DataLen MSB = 0x00 if(Data) { for(uint8_t Idx=0; Idx