kopia lustrzana https://github.com/sp9skp/spdxl
testowe rozszerzone sprawdzanie pozycji dla PS
rodzic
22e2512cfe
commit
3c0fdf9f68
2
VER.txt
2
VER.txt
|
@ -1 +1 @@
|
|||
20180531
|
||||
20180706
|
|
@ -2553,12 +2553,26 @@ static void decodedfm6(const char rxb[], uint32_t rxb_len, uint32_t ip, uint32_t
|
|||
tmp[0]=rxb[81]; tmp[1]=rxb[82]; tmp[2]=0;
|
||||
sec= atoi(tmp);
|
||||
|
||||
|
||||
printf("%s[%i][%04i-%02i-%02i %02i:%02i:%02i]: La:%f, Lo:%f, Alt:%5.0f vH:%5.2f vV:%5.2f D:%3.1f T:%4.2f T1:%4.2f Vcc:%4.2f %6.3fMHz\r\n",id,frno,yr,mon,day,hr,min,sec,lat/1.7453292519943E-2,lon/1.7453292519943E-2,alt,vH,vV,Dir,T,T1,Vcc,frq);
|
||||
|
||||
|
||||
getcall(cb, 10ul, usercall, 11ul);
|
||||
if (usercall[0U]==0) aprsstr_Assign(usercall, 11ul, mycall, 100ul);
|
||||
|
||||
if (sondeaprs_verb && fromport>0UL) {
|
||||
osi_WrStr("UDP:", 5ul);
|
||||
aprsstr_ipv4tostr(ip, s, 1001ul);
|
||||
osi_WrStr(s, 1001ul);
|
||||
osi_WrStr(":", 2ul);
|
||||
osic_WrINT32(fromport, 1UL);
|
||||
if (usercall[0U]) {
|
||||
osi_WrStr(" (", 3ul);
|
||||
osi_WrStr(usercall, 11ul);
|
||||
osi_WrStr(")", 2ul);
|
||||
}
|
||||
osi_WrStrLn("", 1ul);
|
||||
}
|
||||
|
||||
printf("%s[%i][%04i-%02i-%02i %02i:%02i:%02i]: La:%f, Lo:%f, Alt:%5.0f vH:%5.2f vV:%5.2f D:%3.1f T:%4.2f T1:%4.2f Vcc:%4.2f %6.3fMHz\r\n",id,frno,yr,mon,day,hr,min,sec,lat/1.7453292519943E-2,lon/1.7453292519943E-2,alt,vH,vV,Dir,T,T1,Vcc,frq);
|
||||
|
||||
|
||||
rt = 0UL;
|
||||
for (j = 0UL; j<=3UL; j++) {
|
||||
rt = rt*256UL+(uint32_t)(uint8_t)rxb[i];
|
||||
|
@ -3629,7 +3643,7 @@ static void decodepils(const char rxb[], uint32_t rxb_len, uint32_t ip, uint32_t
|
|||
*/
|
||||
|
||||
if (lat>89.9) {lat=0.0;} //in case lat/lon invalid
|
||||
if (long0>179.0) {long0=0.0;}
|
||||
if (long0>179.9) {long0=0.0;}
|
||||
|
||||
if (heig<(-500.0) || heig>50000.0) { //make sure that wrong altitude eliminates all
|
||||
lat = 0.0;
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/* demodulate RS92 sonde (2400bit/s manchester)
|
||||
and SRS-C34 (2400Bd AFSK 2000/3800Hz
|
||||
and DFM06 (2500bit/s manchester)
|
||||
|
@ -224,6 +226,13 @@ struct PILS {
|
|||
char synbuf[64];
|
||||
char fixbytes[56]; //not sure what for
|
||||
uint8_t fixcnt[56];
|
||||
time_t lastfr;
|
||||
double poklat;
|
||||
double poklon;
|
||||
double pokalt;
|
||||
|
||||
|
||||
|
||||
// int16_t configequalizer;
|
||||
};
|
||||
//-------------------------------------------------------
|
||||
|
@ -432,11 +441,6 @@ static uint32_t dfmnametyp;
|
|||
|
||||
static uint16_t CRCTAB[256];
|
||||
|
||||
static double pils_poklat;
|
||||
|
||||
static double pils_poklon;
|
||||
|
||||
static double pils_pokalt;
|
||||
|
||||
|
||||
static void Error(char text[], uint32_t text_len)
|
||||
|
@ -773,6 +777,9 @@ static void Config(void)
|
|||
anonym5->rxbitc = 0UL;
|
||||
anonym5->rxbyte = 0UL;
|
||||
anonym5->synp = 0UL;
|
||||
anonym5->poklat=-1;
|
||||
anonym5->poklon=-1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2053,12 +2060,12 @@ static void sendpils(uint32_t m)
|
|||
chan[m].pils.rxbuf[5U] = 0;
|
||||
chan[m].pils.rxbuf[6U] = 0;
|
||||
|
||||
chan[m].pils.rxbuf[55U] = chan[m].freq[0];;
|
||||
chan[m].pils.rxbuf[56U] = chan[m].freq[1];;
|
||||
chan[m].pils.rxbuf[57U] = chan[m].freq[2];;
|
||||
chan[m].pils.rxbuf[58U] = chan[m].freq[3];;
|
||||
chan[m].pils.rxbuf[59U] = chan[m].freq[4];;
|
||||
chan[m].pils.rxbuf[60U] = chan[m].freq[5];;
|
||||
chan[m].pils.rxbuf[55U] = chan[m].freq[0];
|
||||
chan[m].pils.rxbuf[56U] = chan[m].freq[1];
|
||||
chan[m].pils.rxbuf[57U] = chan[m].freq[2];
|
||||
chan[m].pils.rxbuf[58U] = chan[m].freq[3];
|
||||
chan[m].pils.rxbuf[59U] = chan[m].freq[4];
|
||||
chan[m].pils.rxbuf[60U] = chan[m].freq[5];
|
||||
}
|
||||
alludp(chan[m].udptx, 55UL+6UL, chan[m].pils.rxbuf, 66ul);
|
||||
///osi_WrStrLn("sending UDP data...",19UL);
|
||||
|
@ -2128,6 +2135,7 @@ static void demodbytepilot(uint32_t m, char d)
|
|||
double lat;
|
||||
double long0;
|
||||
double heig;
|
||||
int ok;
|
||||
|
||||
|
||||
struct PILS * anonym;
|
||||
|
@ -2196,12 +2204,14 @@ static void demodbytepilot(uint32_t m, char d)
|
|||
long0=(double)getint32r(anonym->rxbuf,55UL,offs+4UL)*0.000001;
|
||||
heig=(double)getint32r(anonym->rxbuf,55UL,offs+8UL)*.01;
|
||||
cnt++;
|
||||
if (crc == crc16rev(anonym->rxbuf, 48UL)) {
|
||||
for (cz_1 = 49UL; cz_1>1UL; cz_1--) {anonym->rxbuf[cz_1+5UL] = anonym->rxbuf[cz_1];} //move cells by 5 up
|
||||
|
||||
pils_poklat=lat;
|
||||
pils_poklon=long0;
|
||||
pils_pokalt=heig;
|
||||
|
||||
|
||||
|
||||
if (crc == crc16rev(anonym->rxbuf, 48UL) && lat>0 && lat<89.9 && long0>0 && long0<179.9 && heig>1 && heig<35000) {
|
||||
anonym->poklat=lat;
|
||||
anonym->poklon=long0;
|
||||
anonym->pokalt=heig;
|
||||
anonym->lastfr=time(NULL);
|
||||
//if (verb) osi_WrStr(" CRC [OK+] ",12UL);
|
||||
if (verb) { //if more verbous print lat/long/h
|
||||
pok++;
|
||||
|
@ -2215,13 +2225,29 @@ static void demodbytepilot(uint32_t m, char d)
|
|||
osi_WrStrLn("m ", 3ul);
|
||||
printf("BR: %li:%li\r\n",anonym->configbaud,anonym->baudfine);
|
||||
}
|
||||
|
||||
sendpils(m); //send data to udp port - our job here is done.
|
||||
for (cz_1 = 49UL; cz_1>1UL; cz_1--) {anonym->rxbuf[cz_1+5UL] = anonym->rxbuf[cz_1];} //move cells by 5 up
|
||||
sendpils(m);
|
||||
} //crc ok
|
||||
else {
|
||||
if (verb) osi_WrStrLn(" parity error",14UL);
|
||||
//if position not too far from last good one....
|
||||
if ((fabs(pils_poklat-lat)<0.01f) && (fabs(pils_poklon-long0)<0.01f) && (abs(pils_pokalt-heig)<500)) {
|
||||
|
||||
ok=0;
|
||||
if(time(NULL)-anonym->lastfr<=60){
|
||||
if ((fabs(anonym->poklat-lat)<0.003f) && (fabs(anonym->poklon-long0)<0.003f) && (abs(anonym->pokalt-heig)<1500))
|
||||
ok=1;
|
||||
}else if ((time(NULL)-anonym->lastfr>60) && (time(NULL)-anonym->lastfr<=1800)){
|
||||
if ((fabs(anonym->poklat-lat)<0.03f) && (fabs(anonym->poklon-long0)<0.03f) && (abs(anonym->pokalt-heig)<4500))
|
||||
ok=1;
|
||||
}
|
||||
|
||||
if (ok || (anonym->poklat==-1 && anonym->poklon==-1 && lat>0 && lat<89.9 && long0>0 && long0<179.9 && heig>1 && heig<35000)) {
|
||||
|
||||
anonym->poklat=(lat+anonym->poklat)/2;
|
||||
anonym->poklon=(long0+anonym->poklon)/2;
|
||||
anonym->pokalt=(heig+anonym->pokalt)/2;
|
||||
anonym->lastfr=time(NULL);
|
||||
|
||||
if (verb) {
|
||||
nok++;
|
||||
osi_WrStr(" !Lat=",6ul);
|
||||
|
@ -2234,10 +2260,6 @@ static void demodbytepilot(uint32_t m, char d)
|
|||
printf("***BR: %li:%li\r\n",anonym->configbaud,anonym->baudfine);
|
||||
}
|
||||
|
||||
/* for (cz_1 = 15UL; cz_1<50; cz_1++) {anonym->rxbuf[cz_1]=0UL;} //fill in not relevant data with 0
|
||||
crc=crc16rev(anonym->rxbuf, 48UL); //calculate new checksum
|
||||
anonym->rxbuf[49UL]=(crc&255UL);
|
||||
anonym->rxbuf[48UL]=(crc>>8UL);*/
|
||||
for (cz_1 = 49UL; cz_1>1UL; cz_1--) {anonym->rxbuf[cz_1+5UL] = anonym->rxbuf[cz_1];} //move cells by 5 up
|
||||
sendpils(m); //send data to sondemod
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue