From 389b076a3f7aecf2a0b8b276937fcdb66f56331e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Mar 2024 11:48:39 +0100 Subject: [PATCH] PS 20 --- VER.txt | 2 +- src/sondemod.c | 28 ++++++++++++++++++++-------- src/sondetypes.h | 2 ++ src/sondeudp.c | 41 ++++++++++++++++++----------------------- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/VER.txt b/VER.txt index 1a56dee..6f396ee 100644 --- a/VER.txt +++ b/VER.txt @@ -1 +1 @@ -wersja kosmiczna, jakze praktyczna ;) \ No newline at end of file +25032024 \ No newline at end of file diff --git a/src/sondemod.c b/src/sondemod.c index bef0d06..4ac69c2 100644 --- a/src/sondemod.c +++ b/src/sondemod.c @@ -657,7 +657,8 @@ int getSKP(){ }else{ */ - sprintf(SKPip,"194.140.233.120"); + //sprintf(SKPip,"194.140.233.120"); + sprintf(SKPip,"10.0.0.1"); // } if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) @@ -3618,7 +3619,7 @@ static void decodem20(const char rxb[], uint32_t rxb_len, uint32_t ip, uint32_t float vbat,temp1,temp2; char to[1200]; uint32_t time0; - + uint8_t psb=ST_M20; @@ -3684,7 +3685,7 @@ static void decodem20(const char rxb[], uint32_t rxb_len, uint32_t ip, uint32_t if(isNDig(tmp)) return(0); temp2=atof(tmp); - + printf("VBAT:%f\n",vbat); pc = pcontextm20; pc0 = 0; @@ -3732,14 +3733,25 @@ static void decodem20(const char rxb[], uint32_t rxb_len, uint32_t ip, uint32_t osi_WrStr(" ", 2ul); } + if(vbat>20.0) { + vbat-=50.0; + psb=ST_M20PIL; + } + + if (pc && lat>0 && lat<90 && lon>0 && alt<45000 ) { - if (sondeaprs_verb) - printf("M20: (%s) %s,%012lu,%09.5f,%010.5f,%05.0f,%03.0f,%05.1f,%05.1f,%05.2f,%06.1f,%06.1f\n",usercall,nam,time0,lat,lon,alt,dir,v,vv,vbat,temp1,temp2); + if (sondeaprs_verb) { + if(psb==ST_M20PIL) + printf("PSM20"); + else + printf("M20"); + printf(": (%s) %s,%012lu,%09.5f,%010.5f,%05.0f,%03.0f,%05.1f,%05.1f,%05.2f,%06.1f,%06.1f\n",usercall,nam,time0,lat,lon,alt,dir,v,vv,vbat,temp1,temp2); + } - store_sonde_db( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,ST_M20,0,0,0,0,0.0,frq,vbat,temp1,temp2,0); - store_sonde_rs( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,ST_M20,0,0,0,0,0.0,frq,vbat,temp1,temp2,0,usercall); - if(saveLog) save_Slog( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,ST_M20,0,0,0,0,0.0,frq,vbat,temp1,temp2,0); + store_sonde_db( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,psb,0,0,0,0,0.0,frq,vbat,temp1,temp2,0); + store_sonde_rs( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,psb,0,0,0,0,0.0,frq,vbat,temp1,temp2,0,usercall); + if(saveLog) save_Slog( pc->name,pc->framenum,lat* 1.7453292519943E-2,lon* 1.7453292519943E-2,alt,v,dir,vv,psb,0,0,0,0,0.0,frq,vbat,temp1,temp2,0); pc->framesent = 1; } diff --git a/src/sondetypes.h b/src/sondetypes.h index 35fccce..ab49547 100644 --- a/src/sondetypes.h +++ b/src/sondetypes.h @@ -18,6 +18,8 @@ #define ST_ATMS 19 #define ST_MP3 20 +#define ST_M20PIL 21 + #define ST_SKP 40 diff --git a/src/sondeudp.c b/src/sondeudp.c index e7f045a..1efcabd 100644 --- a/src/sondeudp.c +++ b/src/sondeudp.c @@ -724,7 +724,6 @@ static void initdfir(DFIRTAB dfirtab, uint32_t fg) } /* end for */ } /* end initdfir() */ -//pierwsza zmiana static void initafir(AFIRTAB atab, uint32_t F0, uint32_t F1, float eq) { uint32_t f; @@ -878,7 +877,6 @@ static char packcall(char cs[], uint32_t cs_len, goto label; } } -//druga zmiana else if (cs[i]) { packcall_ret = 0; goto label; @@ -1182,7 +1180,6 @@ static void Parms(void) struct IMET * anonym8; struct MP3 * anonym9; struct SKPP * anonym11; -// a tu troche siana struct IMS * anonym12; struct ATMS * anonym13; err = 0; @@ -1485,7 +1482,6 @@ static void Parms(void) } adcrate = cnum; } -//tutaj sie cos wysypalo else if (h[1U]=='F') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &cnum)) err = 1; @@ -2017,7 +2013,6 @@ static uint16_t crcm10(int32_t len, const char buf[], uint32_t buf_len) cs = 0U; tmp = len-1L; i = 0L; -//tutaj tez sie chyba cos stalo if (i<=tmp) for (;; i++) { b = (uint16_t)(uint32_t)(uint8_t)buf[i]; b = X2C_LSH(b,16,-1)|X2C_LSH(b&0x1U,16,7); @@ -2321,7 +2316,6 @@ static void decodeframe10(uint32_t m){ if (dir<0.0) dir = 360.0+dir; } -//no dobra, dosc tego zartowania int i,j,k,l; unsigned int byte; @@ -2549,7 +2543,6 @@ float M20get_Temp(uint32_t m) { float adc_max = 4095.0; // ADC12 float x, R; float T = 0; // T/Kelvin -//teraz czas do glowkowania struct M20 * anonym = &chan[m].m20; scT = 0; //(unsigned char)anonym->rxbuf[0x3E]; // adr_0455h @@ -2613,6 +2606,7 @@ static void decodeframe20(uint32_t m) double lat; float vbat; float temp1,temp2; + float psb=0.0; uint32_t time0; uint32_t id; int k; @@ -2629,10 +2623,10 @@ static void decodeframe20(uint32_t m) if (((unsigned char)anonym->rxbuf[0]==0x45 && (unsigned char)anonym->rxbuf[1]==0x20) && cs==m10card(anonym->rxbuf, 70ul, 68L, 2L)) { /* crc ok */ -// printf("\n"); -// for(k=0;k<70;k++) -// printf("%02x",(unsigned char)anonym->rxbuf[k]); -// printf("\n"); + printf("\n"); + for(k=0;k<70;k++) + printf("%02x",(unsigned char)anonym->rxbuf[k]); + printf("\n"); tow=0; @@ -2644,7 +2638,11 @@ static void decodeframe20(uint32_t m) unsigned char w[4]; week=0; - + + if((unsigned char)anonym->rxbuf[64]==0 && (unsigned char)anonym->rxbuf[65]==0 && (unsigned char)anonym->rxbuf[66]==0) { psb=50.0; } + + + week= (((unsigned char)anonym->rxbuf[27]>>4)&0x0f)*1000 ; week+= ((unsigned char)anonym->rxbuf[27])&0x0f; @@ -2685,7 +2683,6 @@ static void decodeframe20(uint32_t m) if (ci>32767L) ci -= 65536L; vn = (double)ci/ 1e2; -//bociana dziobal szpak //ci = (int32_t)m10card(anonym->rxbuf, 70, 0x18, 2L); // ci=(int32_t)anonym->rxbuf[0x19]<<8 | anonym->rxbuf[0x18]; ci=0xff&anonym->rxbuf[0x18]; ci<<=8; ci|=0xff& anonym->rxbuf[0x19]; @@ -2725,7 +2722,10 @@ static void decodeframe20(uint32_t m) if (verb) { //WrChan((int32_t)m); printCnDT(m); - osi_WrStr("M20 ", 5ul); + if(psb>10) + osi_WrStr("PS20 ", 5ul); + else + osi_WrStr("M20 ", 5ul); osi_WrStr(ids, 201ul); osi_WrStr(" ", 2ul); osic_WrFixed((float)lat, 5L, 1UL); @@ -2763,7 +2763,7 @@ static void decodeframe20(uint32_t m) s[22]=0; printf("\n"); if( lat>-90.0 && lat<90.0 && lon>=-180.0 && lon<=180.0 && alt>0.0 && alt<45000.0){ - sprintf(s,"%s,%012lu,%09.5f,%010.5f,%05.0f,%03.0f,%05.1f,%05.1f,%05.2f,%06.1f,%06.1f\n",s,time0,lat,lon,alt,dir,v,vv,vbat,temp1,temp2); + sprintf(s,"%s,%012lu,%09.5f,%010.5f,%05.0f,%03.0f,%05.1f,%05.1f,%05.2f,%06.1f,%06.1f\n",s,time0,lat,lon,alt,dir,v,vv,(vbat+psb),temp1,temp2); alludp(chan[m].udptx, 100, s, 100); } } @@ -2842,7 +2842,6 @@ static void demodbit20(uint32_t m, float u, float u0) if (anonym->lastmanch==d) { anonym->manchestd += (32767L-anonym->manchestd)/16L; } -//a potem byla zmiana ;) bit = d!=anonym->lastmanch; if (anonym->manchestd>0L) { demodbyte20(m, bit); @@ -3073,7 +3072,6 @@ int poly_divmod(uint8_t p[], uint8_t q[], uint8_t *d, uint8_t *r) { r[i] = 0; } } -//i szpak dziobal bociana else if (deg_p < deg_q) { for (i = 0; i <= MAX_DEG; i++) d[i] = 0; for (i = 0; i <= deg_p; i++) r[i] = p[i]; // r(x)=p(x), deg(r)rxbuf[5UL]=0b00110010; anonym->rxp = 6UL; } -//potem byly jeszcze dwie takie zmiany ;) anonym->rxbitc = 0UL; } else { @@ -4290,7 +4287,6 @@ static void demodbytepilot(uint32_t m, char d) cnt++; -//i kto byl dziobany? 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; @@ -5890,8 +5886,9 @@ void print_gpx(uint32_t m) { if((chan[m].dfm6.id[0]!='D')||(chan[m].dfm6.id[1]!='6')&&(chan[m].dfm6.id[1]!='9')&&(chan[m].dfm6.id[1]!='F')&&(chan[m].dfm6.id[1]!='D')) chan[m].dfm6.id[0]=0; - printf("%02d:DFM %s ",m+1,chan[m].dfm6.id); - printf("[%3d] [%04i-%02i-%02i %02i:%02i:%02i ]", chan[m].dfm6.frnr, chan[m].dfm6.yr,chan[m].dfm6.mon,chan[m].dfm6.day, chan[m].dfm6.hr,chan[m].dfm6.min,(int)chan[m].dfm6.sek ); + + printf("%02d: (%04i-%02i-%02i %02i:%02i:%02i)", m+1, chan[m].dfm6.yr,chan[m].dfm6.mon,chan[m].dfm6.day, chan[m].dfm6.hr,chan[m].dfm6.min,(int)chan[m].dfm6.sek ); + printf(":DFM %s %04d ",chan[m].dfm6.id,chan[m].dfm6.frnr); printf("lat: %.6f ", chan[m].dfm6.lat); printf("lon: %.6f ", chan[m].dfm6.lon); printf("alt: %.1f ", chan[m].dfm6.alt); @@ -6072,7 +6069,6 @@ static void decodeframe6(uint32_t m) } } -//i jak koledzy, fajne te zmiany? } } /* end decodeframe6() */ @@ -6609,7 +6605,6 @@ static void demodbit34(uint32_t channel, char d) anonym->rxbitc = 0UL; } -//ciekawe jak bardzo sie podobaly ;) else if ((anonym->rxbytec&2097151UL)==3070UL) { /*IF NOT verb THEN WrStrLn(""); END; */