diff --git a/libraries/SX1278FSK/SX1278FSK.cpp b/libraries/SX1278FSK/SX1278FSK.cpp index ba11527..9f0263a 100644 --- a/libraries/SX1278FSK/SX1278FSK.cpp +++ b/libraries/SX1278FSK/SX1278FSK.cpp @@ -701,8 +701,6 @@ uint8_t SX1278FSK::receivePacketTimeout(uint32_t wait, byte *data) state = receive(); if(state != 0) { return state; } - boolean p_received = false; - #if (SX1278FSK_debug_mode > 0) Serial.println(F("RX mode sucessfully activated")); #endif diff --git a/libraries/SondeLib/DFM.cpp b/libraries/SondeLib/DFM.cpp index 227a5c8..1243b69 100644 --- a/libraries/SondeLib/DFM.cpp +++ b/libraries/SondeLib/DFM.cpp @@ -162,7 +162,7 @@ void DFM::printRaw(const char *label, int len, int ret, const uint8_t *data) Serial.print(" "); } -int DFM::decodeCFG(uint8_t *cfg) +void DFM::decodeCFG(uint8_t *cfg) { static int lowid, highid, idgood=0, type=0; if((cfg[0]>>4)==0x06 && type==0) { // DFM-6 ID @@ -189,7 +189,7 @@ int DFM::decodeCFG(uint8_t *cfg) } } -int DFM::decodeDAT(uint8_t *dat) +void DFM::decodeDAT(uint8_t *dat) { Serial.print(" DAT["); Serial.print(dat[6]); Serial.print("]: "); switch(dat[6]) { @@ -256,7 +256,7 @@ int DFM::decodeDAT(uint8_t *dat) } } -int DFM::bitsToBytes(uint8_t *bits, uint8_t *bytes, int len) +void DFM::bitsToBytes(uint8_t *bits, uint8_t *bytes, int len) { int i; for(i=0; i> -n) & m; } +#if 0 static double atang2(double x, double y) { double w; @@ -57,7 +58,7 @@ static double atang2(double x, double y) else w = 0.0; return w; } /* end atang2() */ - +#endif static void Gencrctab(void) { @@ -183,7 +184,7 @@ RS92::RS92() { */ - +#if 0 static char crcrs(const byte frame[], uint32_t frame_len, int32_t from, int32_t to) { @@ -269,68 +270,7 @@ static void wgs84r(double x, double y, double z, /* lat:=atan(z/(rh*(1.0 - E2))); */ /* heig:=sqrt(h + z*z) - EARTHA; */ } /* end wgs84r() */ -static void posrs41(const byte b[], uint32_t b_len, uint32_t p) -{ - double dir; - double vu; - double ve; - double vn; - double vz; - double vy; - double vx; - double heig; - double long0; - double lat; - double z; - double y; - double x; - x = (double)getint32(b, b_len, p)*0.01; - y = (double)getint32(b, b_len, p+4UL)*0.01; - z = (double)getint32(b, b_len, p+8UL)*0.01; - wgs84r(x, y, z, &lat, &long0, &heig); - Serial.print(" "); - sonde.si()->lat = (float)(X2C_DIVL(lat,1.7453292519943E-2)); - Serial.print(sonde.si()->lat); - Serial.print(" "); - sonde.si()->lon = (float)(X2C_DIVL(long0,1.7453292519943E-2)); - Serial.print(sonde.si()->lon); - if (heig<1.E+5 && heig>(-1.E+5)) { - Serial.print(" "); - Serial.print((uint32_t)heig); - Serial.print("m"); - } - /*speed */ - vx = (double)getint16(b, b_len, p+12UL)*0.01; - vy = (double)getint16(b, b_len, p+14UL)*0.01; - vz = (double)getint16(b, b_len, p+16UL)*0.01; - vn = (-(vx*(double)sin((float)lat)*(double) - cos((float)long0))-vy*(double) - sin((float)lat)*(double)sin((float) - long0))+vz*(double)cos((float)lat); - ve = -(vx*(double)sin((float)long0))+vy*(double) - cos((float)long0); - vu = vx*(double)cos((float)lat)*(double) - cos((float)long0)+vy*(double) - cos((float)lat)*(double)sin((float) - long0)+vz*(double)sin((float)lat); - dir = X2C_DIVL(atang2(vn, ve),1.7453292519943E-2); - if (dir<0.0) dir = 360.0+dir; - sonde.si()->dir = dir; - Serial.print(" "); - sonde.si()->hs = sqrt((float)(vn*vn+ve*ve))*3.6f; - Serial.print(sonde.si()->hs); - Serial.print("km/h "); - Serial.print(dir); - Serial.print("deg "); - Serial.print((float)vu); - sonde.si()->vs = vu; - Serial.print("m/s "); - Serial.print(getcard16(b, b_len, p+18UL)&255UL); - Serial.print("Sats"); - sonde.si()->alt = heig; - sonde.si()->validPos = true; -} /* end posrs41() */ - +#endif static int32_t reedsolomon92(uint8_t *buf, uint32_t buf_len) @@ -371,18 +311,16 @@ void printRaw(uint8_t *data, int len) Serial.println(); } -static struct CONTEXTR9 contextr9; - void RS92::decodeframe92(uint8_t *data) { - uint32_t gpstime; - uint32_t flen; - uint32_t j; + //uint32_t gpstime; + //uint32_t flen; + //uint32_t j; int32_t corr; corr = reedsolomon92(data, 301ul); - int calok; - int mesok; - uint32_t calibok; + //int calok; + //int mesok; + //uint32_t calibok; Serial.printf("rs corr is %d\n", corr); print_frame(data, 240); #if 0 @@ -468,6 +406,8 @@ void RS92::printRaw(uint8_t *data, int len) Serial.println(); } +#if 0 +// I guess this is old copy&paste stuff from RS41?? int RS92::bitsToBytes(uint8_t *bits, uint8_t *bytes, int len) { int i; @@ -492,6 +432,7 @@ static uint8_t scramble[64] = {150U,131U,62U,81U,177U,73U,8U,152U,50U,5U,89U, 153U,162U,44U,147U,124U,48U,99U,245U,16U,46U,97U,208U,188U, 180U,182U,6U,170U,244U,35U,120U,110U,59U,174U,191U,123U,76U, 193U}; +#endif static byte data[5000]; @@ -582,6 +523,7 @@ int RS92::receive() { #define RS92MAXLEN (240) int RS92::waitRXcomplete() { +#if 0 int res=0; uint32_t t0 = millis(); while( rxtask.receiveResult == 0xFFFF && millis()-t0 < 2000) { delay(20); } @@ -596,6 +538,8 @@ int RS92::waitRXcomplete() { rxtask.receiveResult = 0xFFFF; Serial.printf("RS92::waitRXcomplete returning %d (%s)\n", res, RXstr[res]); return res; +#endif + return 0; } diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index 5aa470e..f3136f1 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -259,7 +259,7 @@ void Sonde::setup() { } void Sonde::receive() { - uint16_t res; + uint16_t res = 0; SondeInfo *si = &sondeList[rxtask.currentSonde]; switch(si->type) { case STYPE_RS41: @@ -342,7 +342,7 @@ uint16_t Sonde::waitRXcomplete() { uint8_t Sonde::timeoutEvent() { uint32_t now = millis(); #if 1 - Serial.printf("Timeout check: %ld - %ld vs %ld; %ld - %ld vs %ld; %ld - %ld vs %ld\n", + Serial.printf("Timeout check: %d - %d vs %d; %d - %d vs %d; %d - %d vs %d\n", now, sonde.si()->viewStart, disp.layout->timeouts[0], now, sonde.si()->rxStart, disp.layout->timeouts[1], now, sonde.si()->norxStart, disp.layout->timeouts[2]); diff --git a/libraries/SondeLib/Sonde.h b/libraries/SondeLib/Sonde.h index bb07320..b64309f 100644 --- a/libraries/SondeLib/Sonde.h +++ b/libraries/SondeLib/Sonde.h @@ -60,7 +60,7 @@ typedef struct st_RXTask { // via waitRXcomplete function uint16_t receiveResult; // status variabe set by decoder to indicate something is broken - int fifoOverflo; + // int fifoOverflo; } RXTask; extern RXTask rxtask; diff --git a/libraries/SondeLib/nav_gps_vel.inc b/libraries/SondeLib/nav_gps_vel.inc index a5b8ce6..0d7abad 100644 --- a/libraries/SondeLib/nav_gps_vel.inc +++ b/libraries/SondeLib/nav_gps_vel.inc @@ -307,17 +307,16 @@ static EPHEM_t *te; //EPHEM_t *read_RNXpephs(FILE *fp) { -EPHEM_t *read_RNXpephs(char *file) { - int l, i, n; - char buffer[86]; +EPHEM_t *read_RNXpephs(const char *file) { + int l, i; + //char buffer[86]; char buf[64], str[20]; - int pbuf; unsigned ui; double dbl; int c; EPHEM_t ephem = {}; - int count = 0; - long fpos; + // int count = 0; + //long fpos; File fp = SPIFFS.open(file, "r"); if(!fp) { Serial.printf("Error opening %s\n", file); } @@ -329,7 +328,6 @@ EPHEM_t *read_RNXpephs(char *file) { //buffer[82] = '\0'; Serial.printf("Skipping header: %s\n", line.c_str()); } while ( fp.available() && !strstr((const char *)line.c_str(), "END OF HEADER") ); - Serial.printf("pbuf is %d\n", pbuf); if (!fp.available()) return NULL; /* fpos = ftell(fp); @@ -352,7 +350,8 @@ EPHEM_t *read_RNXpephs(char *file) { te = (EPHEM_t *)calloc( 34, sizeof(ephem) ); // calloc( 1, sizeof(ephem) ); if (te == NULL) return NULL; - n = 0; + //int n = 0; + while (true) { // brdc/hour-rinex sollte nur Daten von einem Tag enthalten @@ -437,7 +436,7 @@ EPHEM_t *read_RNXpephs(char *file) { ephem.week = 1; // ephem.gpsweek Serial.printf("Reading ephem for prn %d\n", ui); - if(ui>=0 && ui<33) { + if(ui<33) { te[ui] = ephem; } else { Serial.printf("bad prn: %d\n", ui); diff --git a/libraries/SondeLib/rs92gps.inc b/libraries/SondeLib/rs92gps.inc index ccf7f71..930249d 100644 --- a/libraries/SondeLib/rs92gps.inc +++ b/libraries/SondeLib/rs92gps.inc @@ -762,7 +762,7 @@ int calc_satpos_alm(EPHEM_t alm[], double t, SAT_t *satp) { int calc_satpos_rnx(EPHEM_t eph[][24], double t, SAT_t *satp) { double X, Y, Z, vX, vY, vZ; int j, i, ti; - int week; + int week = 0; double cl_corr, cl_drift; double tdiff, td; @@ -818,7 +818,7 @@ int calc_satpos_rnx(EPHEM_t eph[][24], double t, SAT_t *satp) { int calc_satpos_rnx2(EPHEM_t *eph, double t, SAT_t *satp) { double X, Y, Z, vX, vY, vZ; int j; - int week; + int week = 0; double cl_corr, cl_drift; double tdiff, td; int count, count0, satfound; @@ -985,7 +985,7 @@ int get_pseudorange() { */ Serial.printf("j=%d: prns=%d status=%d dist=%f\n", j, prns[j], sat_status[j], dist(sat[prns[j]].X, sat[prns[j]].Y, sat[prns[j]].Z, 0, 0, 0)); int o=prns[j]; - Serial.printf("x=%d y=%d z=%d\n", sat[o].X, sat[o].Y, sat[o].Z); + Serial.printf("x=%f y=%f z=%f\n", sat[o].X, sat[o].Y, sat[o].Z); if ( (prns[j] > 0) && ((sat_status[j] & 0x0F) == 0xF) && (dist(sat[prns[j]].X, sat[prns[j]].Y, sat[prns[j]].Z, 0, 0, 0) > 6700000) ) { @@ -1063,7 +1063,7 @@ int get_GPSkoord(int N) { SAT_t Sat_B[12]; // N <= 12 SAT_t Sat_B1s[12]; SAT_t Sat_C[12]; // 11 - double diter; + double diter = 0; int exN = -1; if (option_vergps == 8) { @@ -1387,7 +1387,7 @@ void print_frame(uint8_t *data, int len) { else print_position(); } -void get_eph(char *file) { +void get_eph(const char *file) { ephs = read_RNXpephs(file); if (ephs) { ephem = 1;