From 49b1ae92d14839420a631ebfbadce798c06cab41 Mon Sep 17 00:00:00 2001 From: Jeff Moe Date: Thu, 16 Jun 2022 10:29:27 -0600 Subject: [PATCH] Patch from ptudor galmon.us. https://www.ptudor.net/galmon/ublox-zed-f9t-10b/2022-04-10-galmon-patch.txt --- Makefile | 4 +- galileo.cc | 5 ++ galileo.hh | 1 + html/doalles.js | 10 ++- html/index.html | 3 + navnexus.cc | 2 +- navparse.cc | 30 ++++++- ubx.cc | 12 +++ ubx.hh | 1 + ubxtool.cc | 203 ++++++++++++++++++++++++++++++++++++++++++------ 10 files changed, 241 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index d277d79..f8f4f36 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CFLAGS = -O3 -Wall -ggdb -CXXFLAGS:= -std=gnu++17 -Wall -O3 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \ +CXXFLAGS:= -std=gnu++17 -Wall -O0 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \ -Iext/fmt-6.1.2/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/ \ -I/usr/local/opt/openssl/include/ \ -Iext/sgp4/libsgp4/ \ @@ -27,6 +27,8 @@ CHEAT_ARG := $(shell ./update-git-hash-if-necessary) PROGRAMS = navparse ubxtool navnexus navcat navrecv navdump testrunner navdisplay tlecatch reporter sp3feed \ galmonmon rinreport rinjoin rtcmtool gndate septool navmerge +PROGRAMS_d = ubxtool + all: navmon.pb.cc $(PROGRAMS) -include Makefile.local diff --git a/galileo.cc b/galileo.cc index 51eedd7..48ea135 100644 --- a/galileo.cc +++ b/galileo.cc @@ -25,6 +25,11 @@ bool getTOWFromInav(std::basic_string_view inav, uint32_t *satTOW, uint return false; } +bool getTOWFromFnav(std::basic_string_view fnav, uint32_t *satTOW, uint16_t *wn) +{ + return false; +} + int GalileoMessage::parseFnav(std::basic_string_view page) { const uint8_t* ptr = &page[0]; diff --git a/galileo.hh b/galileo.hh index 32326d8..b98d975 100644 --- a/galileo.hh +++ b/galileo.hh @@ -7,6 +7,7 @@ #include "bits.hh" bool getTOWFromInav(std::basic_string_view inav, uint32_t *satTOW, uint16_t *wn); +bool getTOWFromFnav(std::basic_string_view fnav, uint32_t *satTOW, uint16_t *wn); struct GalileoMessage : GPSLikeEphemeris { diff --git a/html/doalles.js b/html/doalles.js index cc848d6..e9aad91 100644 --- a/html/doalles.js +++ b/html/doalles.js @@ -61,7 +61,7 @@ function maketable(str, arr) else if(row["gnssid"] == 6) img='ext/glo.png'; - ret.value = ''; + ret.value = ''; // ret.value=""; ret.value += " "+row.sv+""; } @@ -303,6 +303,8 @@ function updateSats() wantIt = true; if(d3.select("#GPSL2C").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 4) wantIt = true; + if(d3.select("#GPSL5").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 6) + wantIt = true; if(d3.select("#BeiDouB1I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 0) wantIt = true; if(d3.select("#BeiDouB2I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 2) @@ -311,6 +313,10 @@ function updateSats() wantIt = true; if(d3.select("#GlonassL2").property("checked") && arr[n].gnssid==6 && arr[n].sigid == 2) wantIt = true; + if(d3.select("#NAVICL5").property("checked") && arr[n].gnssid==98 && arr[n].sigid == 6) + wantIt = true; + if(d3.select("#QZSSL5").property("checked") && arr[n].gnssid==99 && arr[n].sigid == 6) + wantIt = true; if(!wantIt) continue; @@ -383,7 +389,7 @@ function setButtonSetting(name) localStorage.setItem("want"+name, d3.select("#"+name).property("checked")); } -var modes=["GalE1", "GalE5b", "GPSL1CA", "GPSL2C", "BeiDouB1I", "BeiDouB2I", "GlonassL1", "GlonassL2"]; +var modes=["GalE1", "GalE5b", "GalE5a", "GPSL1CA", "GPSL2C", "GPSL5", "BeiDouB1I", "BeiDouB2I", "GlonassL1", "GlonassL2", "NAVICL5", "QZSSL5"]; function setButtonSettings() { diff --git a/html/index.html b/html/index.html index 2d97961..57f86ca 100644 --- a/html/index.html +++ b/html/index.html @@ -18,6 +18,9 @@       + + +
diff --git a/navnexus.cc b/navnexus.cc index 07f7fa2..e8cfcb1 100644 --- a/navnexus.cc +++ b/navnexus.cc @@ -154,7 +154,7 @@ int main(int argc, char** argv) CLI::App app(program); string localAddress("127.0.0.1"); - int hours = 4; + int hours = 1; app.add_flag("--version", doVERSION, "show program version and copyright"); app.add_option("--bind,-b", localAddress, "Address:port to bind to"); app.add_option("--storage,-s", g_storage, "Location of storage files"); diff --git a/navparse.cc b/navparse.cc index 8a24c85..5449ed4 100644 --- a/navparse.cc +++ b/navparse.cc @@ -39,6 +39,8 @@ #include "version.hh" //#include "nequick.hh" +bool doDEBUG{true}; + static char program[]="navparse"; using namespace std; @@ -818,6 +820,7 @@ try item["hna"] = ae.second.second.hna; item["observed"] = false; + // ptudor glonass for(uint32_t sigid : {0,1,2}) { // XXX SIGIDS if(auto iter = svstats.find({6, (uint32_t)ae.first, sigid}); iter != svstats.end()) { if(time(0) - nanoTime(6, iter->second.wn(), iter->second.tow())/1000000000 < 300) { @@ -872,7 +875,8 @@ try item["observed"] = false; - for(uint32_t sigid : {0,1,5}) { + // ptudor gal + for(uint32_t sigid : {0,1,5,6}) { if(auto iter = svstats.find({2, (uint32_t)ae.first, sigid}); iter != svstats.end()) { if(iter->second.completeIOD()) { @@ -937,7 +941,8 @@ try item["eph-latitude"]= 180*longlat.second/M_PI; item["observed"] = false; - for(uint32_t sigid : {0,1,4}) { + // ptudor gps + for(uint32_t sigid : {0,1,4,6}) { if(auto iter = svstats.find({0, (uint32_t)ae.first, sigid}); iter != svstats.end()) { if(time(0) - nanoTime(0, iter->second.wn(), iter->second.tow())/1000000000 < 300) item["observed"] = true; @@ -1928,6 +1933,12 @@ try int sigid = nmm.rd().sigid(); if(gnssid==2 && sigid == 0) sigid = 1; + // ptudor E5a testing + if(gnssid==2 && sigid == 4) + sigid = 3; + // testing the brain hurts section + // if(gnssid==0 && sigid == 7) + // sigid = 6; SatID id{(uint32_t)gnssid, (uint32_t)sv, (uint32_t)sigid}; auto& perrecv = g_svstats[id].perrecv[nmm.sourceid()]; @@ -2774,7 +2785,19 @@ try } else if(nmm.type()== NavMonMessage::GPSCnavType) { + +// brain hurts section + // if(gnssid ==0) { + // if(sigid==3) // L2C is sent as '4' and '3', but the '4' numbers here are bogus + // sigid=4; // if we see 3, use it, and change number to 4 to be consistent + // if(sigid==7) // L5-CNAV is sent as '6' and '7', but the '7' numbers here are bogus + // sigid=6; // if we see 7, use it, and change number to 6 to be consistent + // else if(sigid != 0) // sigid 0 = 0 + // continue; // ignore the rest + // } + //SatID id={2,(uint32_t)sv,6}; // E5a SatID id{nmm.gpsc().gnssid(), nmm.gpsc().gnsssv(), nmm.gpsc().sigid()}; + //hardcoding doesn't change results because data is fine. SatID id={0,nmm.gpsc().gnsssv(),6}; // GPS L5 ptudor brain g_svstats[id].perrecv[nmm.sourceid()].t = nmm.localutcseconds(); auto& svstat = g_svstats[id]; @@ -2785,7 +2808,8 @@ try std::basic_string((uint8_t*)nmm.gpsc().contents().c_str(), nmm.gpsc().contents().size()), gcns); - // cout<<"Got a message from "< getSBASFromSFRBXMsg(std::basic_string_view msg) return payload; } + +basic_string getFnavFromSFRBXMsg(std::basic_string_view msg) +{ + // byte order adjustment + std::basic_string payload; + for(unsigned int i = 0 ; i < (msg.size() - 8) / 4; ++i) + for(int j=1; j <= 4; ++j) + payload.append(1, msg[8 + (i+1) * 4 -j]); + + + return payload; +} diff --git a/ubx.hh b/ubx.hh index f1b3ec4..3476833 100644 --- a/ubx.hh +++ b/ubx.hh @@ -17,6 +17,7 @@ std::basic_string getGPSFromSFRBXMsg(std::basic_string_view ms std::basic_string getGlonassFromSFRBXMsg(std::basic_string_view msg); std::basic_string getBeidouFromSFRBXMsg(std::basic_string_view msg); std::basic_string getSBASFromSFRBXMsg(std::basic_string_view msg); +std::basic_string getFnavFromSFRBXMsg(std::basic_string_view msg); struct CRCMismatch{}; struct TrkSatStat diff --git a/ubxtool.cc b/ubxtool.cc index 62c3469..5f9d3ca 100644 --- a/ubxtool.cc +++ b/ubxtool.cc @@ -39,6 +39,7 @@ static char program[]="ubxtool"; bool doDEBUG{false}; +bool doDEBUGplus{true}; bool doLOGFILE{false}; bool doVERSION{false}; @@ -56,6 +57,8 @@ static int getBaudrate(int baud) { if(baud==115200) return B115200; + else if(baud==460800) + return B460800; else if(baud==57600) return B57600; else if(baud==38400) @@ -72,6 +75,8 @@ static int getBaudrateFromSymbol(int baud) { if(baud==B115200) return 115200; + else if(baud==B460800) + return 460800; else if(baud==B57600) return 57600; else if(baud==B38400) @@ -293,13 +298,14 @@ bool sendAndWaitForUBXAckNack(int fd, int seconds, basic_string_view ms -bool version9 = false; +bool version9_L2_E5b = false; +bool version9_L5_E5a = false; void enableUBXMessageOnPort(int fd, uint8_t ubxClass, uint8_t ubxType, uint8_t port, uint8_t rate=1) { for(int n=0 ; n < 5; ++n) { try { basic_string payload; - if(version9) { + if(version9_L2_E5b || version9_L5_E5a) { payload= basic_string({ubxClass, ubxType, rate}); } else { @@ -503,6 +509,7 @@ int main(int argc, char** argv) bool doGPS{true}, doGalileo{true}, doGlonass{false}, doBeidou{false}, doReset{false}, doWait{true}, doRTSCTS{true}, doSBAS{false}; + bool doQZSS(false), doNAVIC(false); bool doFakeFix{false}; bool doKeepNMEA{false}; bool doSTDOUT=false; @@ -528,6 +535,9 @@ int main(int argc, char** argv) app.add_flag("--glonass,-r", doGlonass, "Enable Glonass reception"); app.add_flag("--galileo,-e", doGalileo, "Enable Galileo reception"); app.add_flag("--sbas,-s", doSBAS, "Enable SBAS (EGNOS/WAAS/etc) reception"); + app.add_flag("--zed-e5a", version9_L5_E5a, "Enable uBlox ZED F9T-10B support for L5 signals"); + app.add_flag("--navic", doNAVIC, "Enable NAVIC reception"); + app.add_flag("--qzss", doQZSS, "Enable QZSS reception"); app.add_option("--rtscts", doRTSCTS, "Set hardware handshaking"); app.add_flag("--stdout", doSTDOUT, "Emit output to stdout"); auto pn = app.add_option("--port,-p", portName, "Device or file to read serial from"); @@ -592,8 +602,9 @@ int main(int argc, char** argv) if(!baudrate) baudrate = getBaudrateFromSymbol(g_baudval); + // ptudor @warning if(doFakeFix) // hack - version9 = true; + version9_L2_E5b = true; bool m8t = false; string hwversion; @@ -646,8 +657,12 @@ int main(int argc, char** argv) string line = (const char*)um1.getPayload().c_str() + 40 +30*n; cerr< msg; - if(version9) { + if(version9_L2_E5b) { cmd = 0x8a; msg = buildUbxMessage(0x06, cmd, {0x00, 0x01, 0x00, 0x00, 0x01,0x00,0x03,0x20, 1, // survey in mode @@ -930,12 +1005,15 @@ int main(int argc, char** argv) if (doDEBUG) { cerr<set_contents(string((char*)cnav.c_str(), cnav.size())); ns.emitNMM( nmm); } + // else if(id.first == 0 && sigid == 6) { // GPS L5 placeholder + //// if (doDEBUGplus) { cerr< reserved1, reserved2, sar, spare, crc; auto inav = getInavFromSFRBXMsg(payload, reserved1, reserved2, sar, spare, crc); unsigned int wtype = getbitu(&inav[0], 0, 6); @@ -1392,14 +1492,20 @@ int main(int argc, char** argv) uint32_t satTOW; int msgTOW{0}; if(getTOWFromInav(inav, &satTOW, &g_galwn)) { // 0, 6, 5 - // if (doDEBUG) { cerr<set_spare((const char*)&spare[0], spare.size()); ns.emitNMM( nmm); + } + // ptudor GAL E5a sigidthree + else if(sigid == 3) { + auto fnav = getFnavFromSFRBXMsg(payload); + uint32_t satTOW; + int msgTOW{0}; + if(getTOWFromFnav(fnav, &satTOW, &g_galwn)) { // 0, 6, 5 + // ptudor + //if (doDEBUGplus) { cerr<set_freq(payload[3]); + nmm.mutable_gf()->set_gnssid(id.first); + nmm.mutable_gf()->set_gnsssv(id.second); + nmm.mutable_gf()->set_sigid(sigid); + nmm.mutable_gf()->set_contents(string((char*)gstr.c_str(), gstr.size())); + //gf.gnssWN, gf.gnssTOW + nmm.mutable_gf()->set_gnsswn(g_galwn); + nmm.mutable_gf()->set_gnsstow(msgTOW); + //sep nmm.mutable_gf()->set_gnsswn(sf.wn - 1024); + //sep nmm.mutable_gf()->set_gnsstow(sf.towMsec/1000.0); + + ns.emitNMM( nmm); + + //sep nmm.mutable_gf()->set_contents((const char*)&payload[0], payload.size()); + + + + } } else if(id.first==3) { auto gstr = getGlonassFromSFRBXMsg(payload); @@ -1571,7 +1715,9 @@ int main(int argc, char** argv) } else if(msg.getClass() == 1 && msg.getType() == 0x35) { // UBX-NAV-SAT - if(version9) // we have UBX-NAV-SIG + //if(version9_L2_E5b) // we have UBX-NAV-SIG + // ptudor + if(version9_L2_E5b || version9_L5_E5a) continue; // if (doDEBUG) { cerr<set_qi(status & 7); nmm.mutable_rd()->set_used(status & 8); - /* + /* if (doDEBUG) { cerr<