Fix OpenBSD/clang errors; fix Makefile to use CXX and add some

include paths.
pull/1/head
Otto Moerbeek 2019-08-16 10:51:29 +02:00
parent ac76ba1d28
commit ef79c0e21c
5 changed files with 19 additions and 16 deletions

View File

@ -1,4 +1,4 @@
CXXFLAGS:= -std=gnu++17 -Wall -O3 -MMD -MP -ggdb -fno-omit-frame-pointer -Iext/fmt-5.2.1/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/
CXXFLAGS:= -std=gnu++17 -Wall -O3 -MMD -MP -ggdb -fno-omit-frame-pointer -Iext/fmt-5.2.1/include/ -Iext/powerblog/ext/simplesocket -Iext/powerblog/ext/ -I/usr/local/include
PROGRAMS = navparse ubxtool navnexus navrecv navdump
@ -16,19 +16,19 @@ navparse: navparse.o ext/fmt-5.2.1/src/format.o $(H2OPP) $(SIMPLESOCKETS) minicu
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -lh2o-evloop -lssl -lcrypto -lz -lcurl -lprotobuf # -lwslay
navdump: navdump.o ext/fmt-5.2.1/src/format.o bits.o navmon.pb.o
$(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -lprotobuf
navnexus: navnexus.o ext/fmt-5.2.1/src/format.o $(SIMPLESOCKETS) ubx.o bits.o navmon.pb.o storage.o
$(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -lprotobuf
navrecv: navrecv.o ext/fmt-5.2.1/src/format.o $(SIMPLESOCKETS) navmon.pb.o storage.o
$(CXX) -std=gnu++17 $^ -o $@ -pthread -lprotobuf
$(CXX) -std=gnu++17 $^ -o $@ -pthread -L/usr/local/lib -lprotobuf
navmon.pb.cc: navmon.proto
protoc --cpp_out=./ navmon.proto
ubxtool: navmon.pb.o ubxtool.o ubx.o bits.o ext/fmt-5.2.1/src/format.o galileo.o gps.o
$(CXX) -std=gnu++17 $^ -o $@ -lprotobuf
$(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lprotobuf

View File

@ -1,13 +1,14 @@
#pragma once
#include "minivec.hh"
void getCoordinates(int wn, double tow, const auto& iod, Point* p, bool quiet=true)
template <typename T>
void getCoordinates(int wn, double tow, const T& iod, Point* p, bool quiet=true)
{
using namespace std;
// here goes
constexpr double mu = 3.986004418 * pow(10.0, 14.0);
constexpr double omegaE = 7.2921151467 * pow(10.0, -5);
const double mu = 3.986004418 * pow(10.0, 14.0);
const double omegaE = 7.2921151467 * pow(10.0, -5);
double sqrtA = 1.0*iod.sqrtA / (1ULL<<19);
double deltan = M_PI * 1.0*iod.deltan / (1LL<<43);

View File

@ -14,6 +14,7 @@
#include <sys/types.h>
#include "storage.hh"
#include <dirent.h>
#include <inttypes.h>
using namespace std;
@ -45,7 +46,7 @@ vector<uint64_t> getSources()
}
if(result->d_name[0] != '.') {
uint64_t src;
if(sscanf(result->d_name, "%08lx", &src)==1)
if(sscanf(result->d_name, "%08" PRIx64, &src)==1)
ret.push_back(src);
}
}

View File

@ -348,14 +348,16 @@ struct InfluxPusher
explicit InfluxPusher(std::string_view dbname) : d_dbname(dbname)
{
}
void addValue( const pair<pair<int,int>,SVStat>& ent, string_view name, auto value)
template <typename T>
void addValue( const pair<pair<int,int>,SVStat>& ent, string_view name, T value)
{
d_buffer+= string(name)+",gnssid="+to_string(ent.first.first)+ +",sv=" +to_string(ent.first.second)+" value="+to_string(value)+
" "+to_string(nanoTime(ent.first.first, ent.second.wn, ent.second.tow))+"\n";
checkSend();
}
void addValue(pair<int,int> id, string_view name, auto value)
template <typename T>
void addValue(pair<int,int> id, string_view name, T value)
{
if(g_svstats[id].wn ==0 && g_svstats[id].tow == 0)
return;

View File

@ -28,8 +28,7 @@ using namespace std;
uint16_t g_srcid{2};
#define BAUDRATE B921600
#define MODEMDEVICE "/dev/ttyACM0"
#define BAUDRATE B115200
namespace {
struct EofException{};
@ -427,7 +426,7 @@ int main(int argc, char** argv)
tm.tm_sec = pvt.sec;
uint32_t satt = timegm(&tm);
double satutc = timegm(&tm) + pvt.nano/1000000000.0; // negative is no problem here
//double satutc = timegm(&tm) + pvt.nano/1000000000.0; // negative is no problem here
if(pvt.nano < 0) {
pvt.sec--;
satt--;
@ -446,7 +445,7 @@ int main(int argc, char** argv)
time_t ourt = timestamp.tv_sec;
gmtime_r(&ourt, &ourtime);
double ourutc = ourt + timestamp.tv_usec/1000000.0;
//double ourutc = ourt + timestamp.tv_usec/1000000.0;
seconds = ourtime.tm_sec + timestamp.tv_usec/1000000.0;
// fmt::fprintf(stderr, "Our UTC : %02d:%02d:%06.4f -> %.4f or %d:%f -> delta = %.4fs\n", tm.tm_hour, tm.tm_min, seconds, ourutc, timestamp.tv_sec, 1.0*timestamp.tv_usec, ourutc - satutc);
@ -473,7 +472,7 @@ int main(int argc, char** argv)
uint8_t prStddev = payload[43+23*n] & 0xf;
uint8_t cpStddev = payload[44+23*n] & 0xf;
uint8_t doStddev = payload[45+23*n] & 0xf;
uint8_t trkStat = payload[46+23*n] & 0xf;
//uint8_t trkStat = payload[46+23*n] & 0xf;
NavMonMessage nmm;
nmm.set_type(NavMonMessage::RFDataType);