pull/27/head
Zilog80 2020-11-01 17:34:58 +01:00
rodzic 690464aec9
commit f07cf16e4e
16 zmienionych plików z 239 dodań i 11 usunięć

16
c34/c50dft.c 100755 → 100644
Wyświetl plik

@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <complex.h>
#include <math.h>
@ -28,6 +29,7 @@ typedef struct {
float lat; float lon; float alt;
unsigned chk;
float T; float RH;
int jsn_freq; // freq/kHz (SDR)
} gpx_t;
static gpx_t gpx;
@ -335,6 +337,9 @@ static void printJSON() {
if (gpx.T > -273.0) printf(", \"temp\": %.1f", gpx.T);
if (gpx.RH > -0.5) printf(", \"humidity\": %.1f", gpx.RH);
}
if (gpx.jsn_freq > 0) {
printf(", \"freq\": %d", gpx.jsn_freq);
}
printf(" }\n");
//printf("\n");
}
@ -504,6 +509,7 @@ int main(int argc, char *argv[]) {
int len;
float k_f0, k_f1, k_df;
float cb0, cb1;
int cfreq = -1;
fpname = argv[0];
++argv;
@ -535,6 +541,13 @@ int main(int argc, char *argv[]) {
option_verbose = 1;
option_json = 1;
}
else if ( (strcmp(*argv, "--jsn_cfq") == 0) ) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else {
fp = fopen(*argv, "rb");
if (fp == NULL) {
@ -548,6 +561,9 @@ int main(int argc, char *argv[]) {
if (!wavloaded) fp = stdin;
gpx.jsn_freq = 0;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
i = read_wav_header(fp);
if (i) {
fclose(fp);

Wyświetl plik

@ -80,6 +80,7 @@ typedef struct {
pcksts_t pck[9];
option_t option;
int ptu_out;
int jsn_freq; // freq/kHz (SDR)
gpsdat_t gps;
} gpx_t;
@ -782,6 +783,9 @@ static void print_gpx(gpx_t *gpx) {
if (t > -270.0) printf(", \"temp\": %.1f", t);
}
if (dfm_typ > 0) printf(", \"subtype\": \"0x%1X\"", dfm_typ);
if (gpx->jsn_freq > 0) {
printf(", \"freq\": %d", gpx->jsn_freq);
}
printf(" }\n");
printf("\n");
}
@ -907,6 +911,7 @@ int main(int argc, char **argv) {
int wavloaded = 0;
int sel_wavch = 0; // audio channel: left
int spike = 0;
int cfreq = -1;
FILE *fp = NULL;
char *fpname = NULL;
@ -990,6 +995,13 @@ int main(int argc, char **argv) {
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
else if (strcmp(*argv, "--dist") == 0) { option_dist = 1; option_ecc = 1; }
else if (strcmp(*argv, "--json") == 0) { option_json = 1; option_ecc = 1; }
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
else if (strcmp(*argv, "--ths") == 0) {
++argv;
@ -1100,6 +1112,8 @@ int main(int argc, char **argv) {
gpx.option.dst = option_dist;
gpx.option.jsn = option_json;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
headerlen = strlen(dfm_rawheader);
@ -1129,6 +1143,11 @@ int main(int argc, char **argv) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
// dfm: BT=1?, h=2.4?
symlen = 2;

Wyświetl plik

@ -148,6 +148,7 @@ typedef struct {
int sf6;
int sfX;
int typ;
int jsn_freq; // freq/kHz (SDR)
float frm_rate;
int auto_detect;
int reset_dsp;
@ -760,6 +761,9 @@ static void print_frame(gpx_t *gpx, int crc_err, int len) {
gpx->std, gpx->min, gpx->sek, gpx->lat, gpx->lon, gpx->alt, gpx->vH, gpx->vD, gpx->vV );
printf(", \"gpstow\": %d", gpx->gpstow );
printf(", \"subtype\": \"%c\"", sntyp[3]); // "6":LMS6-403, "X":lms6X, "MK2A":LMS6-1680/Mk2a
if (gpx->jsn_freq > 0) {
printf(", \"freq\": %d", gpx->jsn_freq);
}
printf(" }\n");
printf("\n");
}
@ -957,6 +961,7 @@ int main(int argc, char **argv) {
int wavloaded = 0;
int sel_wavch = 0; // audio channel: left
int gpsweek = 0;
int cfreq = -1;
FILE *fp = NULL;
char *fpname = NULL;
@ -1103,6 +1108,13 @@ int main(int argc, char **argv) {
gpx->option.ecc = 1;
gpx->option.vit = 1;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "-") == 0) {
int sample_rate = 0, bits_sample = 0, channels = 0;
++argv;
@ -1151,6 +1163,8 @@ int main(int argc, char **argv) {
gpx->week = gpsweek;
if (cfreq > 0) gpx->jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_softin) {
@ -1182,6 +1196,11 @@ int main(int argc, char **argv) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx->jsn_freq = fq_kHz;
}
symlen = 1;
// init dsp

Wyświetl plik

@ -93,6 +93,7 @@ typedef struct {
ui8_t frame_bytes[FRAME_LEN+AUX_LEN+4];
char frame_bits[BITFRAME_LEN+BITAUX_LEN+8];
int auxlen; // 0 .. 0x76-0x64
int jsn_freq; // freq/kHz (SDR)
option_t option;
ui8_t type;
} gpx_t;
@ -1004,6 +1005,9 @@ static int print_pos(gpx_t *gpx, int csOK) {
fprintf(stdout, ", \"rawid\": \"M10_%02X%02X%02X%02X%02X\"", gpx->frame_bytes[pos_SN], gpx->frame_bytes[pos_SN+1],
gpx->frame_bytes[pos_SN+2], gpx->frame_bytes[pos_SN+3], gpx->frame_bytes[pos_SN+4]); // gpx->type
fprintf(stdout, ", \"subtype\": \"0x%02X\"", gpx->type);
if (gpx->jsn_freq > 0) {
fprintf(stdout, ", \"freq\": %d", gpx->jsn_freq);
}
fprintf(stdout, " }\n");
fprintf(stdout, "\n");
}
@ -1124,6 +1128,7 @@ int main(int argc, char **argv) {
int wavloaded = 0;
int sel_wavch = 0; // audio channel: left
int spike = 0;
int cfreq = -1;
FILE *fp = NULL;
char *fpname = NULL;
@ -1232,6 +1237,13 @@ int main(int argc, char **argv) {
option_min = 1;
}
else if (strcmp(*argv, "--json") == 0) { gpx.option.jsn = 1; }
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "-") == 0) {
int sample_rate = 0, bits_sample = 0, channels = 0;
++argv;
@ -1268,6 +1280,8 @@ int main(int argc, char **argv) {
gpx.option.ptu = option_ptu;
gpx.option.col = option_color;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_softin) {
@ -1295,6 +1309,11 @@ int main(int argc, char **argv) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
// m10: BT>1?, h=1.2 ?
symlen = 2;

Wyświetl plik

@ -95,6 +95,7 @@ typedef struct {
ui8_t frame_bytes[FRAME_LEN+AUX_LEN+4];
char frame_bits[BITFRAME_LEN+BITAUX_LEN+8];
int auxlen; // ? 0 .. 0x57-0x45
int jsn_freq; // freq/kHz (SDR)
option_t option;
ui8_t type;
} gpx_t;
@ -642,6 +643,9 @@ static int print_pos(gpx_t *gpx, int bcOK, int csOK) {
sn_id, gpx->jahr, gpx->monat, gpx->tag, gpx->std, gpx->min, gpx->sek, gpx->lat, gpx->lon, gpx->alt, gpx->vH, gpx->vD, gpx->vV);
fprintf(stdout, ", \"rawid\": \"M20_%02X%02X%02X\"", gpx->frame_bytes[pos_SN], gpx->frame_bytes[pos_SN+1], gpx->frame_bytes[pos_SN+2]); // gpx->type
fprintf(stdout, ", \"subtype\": \"0x%02X\"", gpx->type);
if (gpx->jsn_freq > 0) {
fprintf(stdout, ", \"freq\": %d", gpx->jsn_freq);
}
fprintf(stdout, " }\n");
fprintf(stdout, "\n");
}
@ -763,6 +767,7 @@ int main(int argc, char **argv) {
int wavloaded = 0;
int sel_wavch = 0; // audio channel: left
int spike = 0;
int cfreq = -1;
float baudrate = -1;
@ -880,6 +885,13 @@ int main(int argc, char **argv) {
option_min = 1;
}
else if (strcmp(*argv, "--json") == 0) { gpx.option.jsn = 1; }
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "-") == 0) {
int sample_rate = 0, bits_sample = 0, channels = 0;
++argv;
@ -916,6 +928,8 @@ int main(int argc, char **argv) {
gpx.option.ptu = option_ptu;
gpx.option.col = option_color;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_softin) {
@ -943,6 +957,11 @@ int main(int argc, char **argv) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
// m10: BT>1?, h=1.2 ?
symlen = 2;

Wyświetl plik

@ -134,6 +134,7 @@ typedef struct {
ui32_t _sn;
float sn; // 0 mod 16
float fq; // 15 mod 64
int jsn_freq; // freq/kHz (SDR)
RS_t RS;
} gpx_t;
@ -217,6 +218,7 @@ int main(int argc, char **argv) {
int option_pcmraw = 0;
int sel_wavch = 0;
int wavloaded = 0;
int cfreq = -1;
int option1 = 0,
option2 = 0;
@ -353,6 +355,13 @@ int main(int argc, char **argv) {
option_jsn = 1;
option_ecc = 1;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "-") == 0) {
int sample_rate = 0, bits_sample = 0, channels = 0;
++argv;
@ -383,6 +392,8 @@ int main(int argc, char **argv) {
}
if (!wavloaded) fp = stdin;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_softin) {
@ -410,6 +421,11 @@ int main(int argc, char **argv) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
symlen = 1;
// init dsp
@ -669,8 +685,8 @@ int main(int argc, char **argv) {
w16[0] = bits2val(subframe_bits+HEADLEN+46*1 , 16);
w16[1] = bits2val(subframe_bits+HEADLEN+46*1+17, 16);
w32 = (w16[1]<<16) | w16[0];
if (err_frm == 0) // oder kleineren subblock pruefen
// counter ok and w16[] ok (max 1 error)
if (err_frm == 0 && block_err[0] < 2 && block_err[1] < 2)
{
gpx.cfg[counter%64] = *fcfg;
@ -770,8 +786,12 @@ int main(int argc, char **argv) {
sprintf(id_str, "%.0f", gpx.sn);
}
printf("{ \"type\": \"%s\"", "IMS100");
printf(", \"frame\": %d, \"id\": \"IMS100-%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f }\n",
printf(", \"frame\": %d, \"id\": \"IMS100-%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f",
gpx.frnr, id_str, gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD );
if (gpx.jsn_freq > 0) { // not gpx.fq, because gpx.sn not in every frame
printf(", \"freq\": %d", gpx.jsn_freq);
}
printf(" }\n");
printf("\n");
}

Wyświetl plik

@ -110,7 +110,8 @@ typedef struct {
float ptu_co2[3]; // { -243.911 , 0.187654 , 8.2e-06 }
float ptu_calT2[3]; // calibration T2-Hum
float ptu_calH[2]; // calibration Hum
ui32_t freq; // freq/kHz
ui32_t freq; // freq/kHz (RS41)
int jsn_freq; // freq/kHz (SDR)
float batt; // battery voltage (V)
ui16_t conf_fw; // firmware
ui16_t conf_kt; // kill timer (sec)
@ -1588,6 +1589,11 @@ static int print_position(gpx_t *gpx, int ec) {
fprintf(stdout, ", \"encrypted\": false");
}
}
if (gpx->jsn_freq > 0) { // rs41-frequency: gpx->freq
int fq_kHz = gpx->jsn_freq;
if (gpx->freq > 0) fq_kHz = gpx->freq;
fprintf(stdout, ", \"freq\": %d", fq_kHz);
}
fprintf(stdout, " }\n");
fprintf(stdout, "\n");
}
@ -1758,6 +1764,7 @@ int main(int argc, char *argv[]) {
int wavloaded = 0;
int sel_wavch = 0; // audio channel: left
int rawhex = 0, xorhex = 0;
int cfreq = -1;
FILE *fp;
char *fpname = NULL;
@ -1886,6 +1893,13 @@ int main(int argc, char *argv[]) {
gpx.option.ecc = 2;
gpx.option.crc = 1;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "--rawhex") == 0) { rawhex = 2; } // raw hex input
else if (strcmp(*argv, "--xorhex") == 0) { rawhex = 2; xorhex = 1; } // raw xor input
else if (strcmp(*argv, "-") == 0) {
@ -1926,6 +1940,8 @@ int main(int argc, char *argv[]) {
// init gpx
memcpy(gpx.frame, rs41_header_bytes, sizeof(rs41_header_bytes)); // 8 header bytes
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_bin && !option_softin) {
@ -1955,6 +1971,11 @@ int main(int argc, char *argv[]) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
// rs41: BT=0.5, h=0.8,1.0 ?
symlen = 1;

Wyświetl plik

@ -117,7 +117,8 @@ typedef struct {
int sats[4];
double dop;
ui16_t conf_kt; // kill timer (sec)
int freq;
int freq; // freq/kHz (RS92)
int jsn_freq; // freq/kHz (SDR)
ui32_t crc;
ui8_t frame[FRAME_LEN]; // { 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x10}
unsigned short aux[4];
@ -1184,6 +1185,11 @@ static int print_position(gpx_t *gpx, int ec) { // GPS-Hoehe ueber Ellipsoid
if ((gpx->crc & crc_AUX)==0 && (gpx->aux[0] != 0 || gpx->aux[1] != 0 || gpx->aux[2] != 0 || gpx->aux[3] != 0)) {
fprintf(stdout, ", \"aux\": \"%04x%04x%04x%04x\"", gpx->aux[0], gpx->aux[1], gpx->aux[2], gpx->aux[3]);
}
if (gpx->jsn_freq > 0) { // rs92-frequency: gpx->freq
int fq_kHz = gpx->jsn_freq;
//if (gpx->freq > 0) fq_kHz = gpx->freq; // L-band: option.ngp ?
fprintf(stdout, ", \"freq\": %d", fq_kHz);
}
fprintf(stdout, " }\n");
}
}
@ -1245,6 +1251,7 @@ int main(int argc, char *argv[]) {
int sel_wavch = 0; // audio channel: left
int spike = 0;
int fileloaded = 0;
int cfreq = -1;
char bitbuf[BITS];
int bitpos = 0,
@ -1390,6 +1397,13 @@ int main(int argc, char *argv[]) {
gpx.option.crc = 1;
gpx.gps.opt_vel = 4;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "--spike") == 0) { spike = 1; }
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
@ -1488,6 +1502,8 @@ int main(int argc, char *argv[]) {
// init gpx
memcpy(gpx.frame, rs92_header_bytes, sizeof(rs92_header_bytes)); // 6 header bytes
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
#ifdef EXT_FSK
if (!option_softin) {
@ -1515,6 +1531,11 @@ int main(int argc, char *argv[]) {
}
}
if (cfreq > 0) {
int fq_kHz = (cfreq - dsp.xlt_fq*pcm.sr + 500)/1e3;
gpx.jsn_freq = fq_kHz;
}
// rs92-sgp: BT=0.5, h=1.0 ?
symlen = 2;

Wyświetl plik

@ -170,6 +170,7 @@ typedef struct {
thd_t thd;
int option_jsn;
int option_dc;
int jsn_freq;
} thargs_t;

Wyświetl plik

@ -73,6 +73,7 @@ typedef struct {
pcksts_t pck[9];
option_t option;
int ptu_out;
int jsn_freq; // freq/kHz (SDR)
} gpx_t;
@ -684,6 +685,9 @@ static int print_gpx(gpx_t *gpx) {
if (t > -270.0) printf(", \"temp\": %.1f", t);
}
if (dfm_typ > 0) printf(", \"subtype\": \"0x%1X\"", dfm_typ);
if (gpx->jsn_freq > 0) {
printf(", \"freq\": %d", gpx->jsn_freq);
}
printf(" }\n");
printf("\n");
}
@ -845,6 +849,7 @@ void *thd_dfm09(void *targs) {
*/
// init gpx
strcpy(gpx.frame_bits, dfm_header); //, sizeof(dfm_header);
for (k = 0; k < 9; k++) gpx.pck[k].ec = -1; // init ecc-status
@ -855,6 +860,8 @@ void *thd_dfm09(void *targs) {
gpx.option.dst = 0;
gpx.option.jsn = tharg->option_jsn;
gpx.jsn_freq = tharg->jsn_freq;
headerlen = strlen(dfm_rawheader);

Wyświetl plik

@ -135,6 +135,7 @@ typedef struct {
int sf6;
int sfX;
int typ;
int jsn_freq; // freq/kHz (SDR)
float frm_rate;
int auto_detect;
int reset_dsp;
@ -737,6 +738,9 @@ static int print_frame(gpx_t *gpx, int crc_err, int len) {
gpx->std, gpx->min, gpx->sek, gpx->lat, gpx->lon, gpx->alt, gpx->vH, gpx->vD, gpx->vV );
printf(", \"gpstow\": %d", gpx->gpstow );
printf(", \"subtype\": \"%c\"", sntyp[3]); // "6":LMS6-403, "X":lms6X, "MK2A":LMS6-1680/Mk2a
if (gpx->jsn_freq > 0) {
printf(", \"freq\": %d", gpx->jsn_freq);
}
printf(" }\n");
printf("\n");
}
@ -976,6 +980,8 @@ void *thd_lms6X(void *targs) { // pcm_t *pcm, double xlt_fq
*/
gpx_t _gpx = {0}; gpx_t *gpx = &_gpx;
// init gpx
gpx->auto_detect = 1;
gpx->reset_dsp = 0;
@ -993,8 +999,8 @@ void *thd_lms6X(void *targs) { // pcm_t *pcm, double xlt_fq
gpx->option.vit = 1;
gpx->option.ecc = 1;
gpx->jsn_freq = tharg->jsn_freq;
// init gpx
memcpy(gpx->blk_rawbits, blk_syncbits, sizeof(blk_syncbits));
memcpy(gpx->frame, frm_sync6, sizeof(frm_sync6));
gpx->frm_pos = 0; // ecc_blk <-> frm_blk
@ -1164,7 +1170,6 @@ void *thd_lms6X(void *targs) { // pcm_t *pcm, double xlt_fq
}
}
free_buffers(&dsp);
if (gpx->vit) { free(gpx->vit); gpx->vit = NULL; }

Wyświetl plik

@ -91,6 +91,7 @@ typedef struct {
ui8_t frame_bytes[FRAME_LEN+AUX_LEN+4];
char frame_bits[BITFRAME_LEN+BITAUX_LEN+8];
int auxlen; // 0 .. 0x76-0x64
int jsn_freq; // freq/kHz (SDR)
option_t option;
ui8_t type;
} gpx_t;
@ -1002,6 +1003,9 @@ static int print_pos(gpx_t *gpx, int csOK) {
}
}
fprintf(stdout, ", \"subtype\": \"0x%02X\"", gpx->type);
if (gpx->jsn_freq > 0) {
fprintf(stdout, ", \"freq\": %d", gpx->jsn_freq);
}
fprintf(stdout, " }\n");
fprintf(stdout, "\n");
}
@ -1151,14 +1155,16 @@ void *thd_m10(void *targs) { // pcm_t *pcm, double xlt_fq
setbuf(stdout, NULL);
*/
// init gpx
gpx.option.inv = 0; // irrelevant
gpx.option.vbs = 2;
gpx.option.ptu = 1;
gpx.option.jsn = tharg->option_jsn;
gpx.option.col = 0; //option_color;
gpx.jsn_freq = tharg->jsn_freq;
// init gpx
pcm->sel_ch = 0;

Wyświetl plik

@ -89,7 +89,8 @@ typedef struct {
float ptu_co2[3]; // { -243.911 , 0.187654 , 8.2e-06 }
float ptu_calT2[3]; // calibration T2-Hum
float ptu_calH[2]; // calibration Hum
ui32_t freq; // freq/kHz
ui32_t freq; // freq/kHz (RS41)
int jsn_freq; // freq/kHz (SDR)
float batt; // battery voltage (V)
ui16_t conf_fw; // firmware
ui16_t conf_kt; // kill timer (sec)
@ -1341,6 +1342,11 @@ static int print_position(gpx_t *gpx, int ec) {
fprintf(stdout, ", \"encrypted\": false");
}
}
if (gpx->jsn_freq > 0) { // rs41-frequency: gpx->freq
int fq_kHz = gpx->jsn_freq;
if (gpx->freq > 0) fq_kHz = gpx->freq;
fprintf(stdout, ", \"freq\": %d", fq_kHz);
}
fprintf(stdout, " }\n");
fprintf(stdout, "\n");
}
@ -1509,6 +1515,8 @@ void *thd_rs41(void *targs) { // pcm_t *pcm, double xlt_fq
setbuf(stdout, NULL);
*/
// init gpx
gpx.option.vbs = 1;
gpx.option.ptu = 1;
gpx.option.aut = 1;
@ -1520,9 +1528,10 @@ void *thd_rs41(void *targs) { // pcm_t *pcm, double xlt_fq
rs_init_RS255(&gpx.RS); // RS, GF
}
// init gpx
memcpy(gpx.frame, rs41_header_bytes, sizeof(rs41_header_bytes)); // 8 header bytes
gpx.jsn_freq = tharg->jsn_freq;
pcm->sel_ch = 0;

Wyświetl plik

@ -92,6 +92,7 @@ int main(int argc, char **argv) {
int wavloaded = 0;
int k;
int xlt_cnt = 0;
int cfreq = -1;
double base_fqs[MAX_FQ];
void *rstype[MAX_FQ];
int option_pcmraw = 0,
@ -166,6 +167,13 @@ int main(int argc, char **argv) {
else if (strcmp(*argv, "--json") == 0) {
option_jsn = 1;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 350000000 || frq > 450000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "--dc") == 0) {
option_dc = 1;
}
@ -232,6 +240,10 @@ int main(int argc, char **argv) {
tharg[k].thd.blk = block_decMB;
tharg[k].thd.max_fq = xlt_cnt;
tharg[k].thd.xlt_fq = -base_fqs[k]; // S(t)*exp(-f*2pi*I*t): fq baseband -> IF (rotate from and decimate)
if (cfreq > 0) {
int fq_kHz = (cfreq - tharg[k].thd.xlt_fq*pcm.sr_base + 500)/1e3;
tharg[k].jsn_freq = fq_kHz;
}
tharg[k].pcm = pcm;

Wyświetl plik

@ -41,6 +41,8 @@ typedef struct {
//
int gps_valid;
int ptu_valid;
//
int jsn_freq; // freq/kHz (SDR)
} gpx_t;
gpx_t gpx;
@ -428,9 +430,14 @@ int print_frame(int len) {
if (gpx.gps_valid && gpx.ptu_valid) // frameNb part of PTU-pck
{
fprintf(stdout, "{ \"type\": \"%s\"", "IMET");
fprintf(stdout, ", \"frame\": %d, \"id\": \"iMet\", \"datetime\": \"%02d:%02d:%02dZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %d, \"sats\": %d, \"temp\": %.2f, \"humidity\": %.2f, \"pressure\": %.2f, \"batt\": %.1f }\n",
fprintf(stdout, ", \"frame\": %d, \"id\": \"iMet\", \"datetime\": \"%02d:%02d:%02dZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %d, \"sats\": %d, \"temp\": %.2f, \"humidity\": %.2f, \"pressure\": %.2f, \"batt\": %.1f",
gpx.frame, gpx.hour, gpx.min, gpx.sec, gpx.lat, gpx.lon, gpx.alt, gpx.sats, gpx.temp, gpx.humidity, gpx.pressure, gpx.batt);
}
if (gpx.jsn_freq > 0) {
fprintf(stdout, ", \"freq\": %d", gpx.jsn_freq);
}
fprintf(stdout, " }\n");
}
if (out) fprintf(stdout, "\n");
@ -474,6 +481,8 @@ int main(int argc, char *argv[]) {
int bitbuf[3];
int cfreq = -1;
fpname = argv[0];
++argv;
while ((*argv) && (!wavloaded)) {
@ -499,6 +508,13 @@ int main(int argc, char *argv[]) {
else if ( (strcmp(*argv, "--json") == 0) ) {
option_json = 1;
}
else if ( (strcmp(*argv, "--jsn_cfq") == 0) ) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else {
fp = fopen(*argv, "rb");
if (fp == NULL) {
@ -511,6 +527,8 @@ int main(int argc, char *argv[]) {
}
if (!wavloaded) fp = stdin;
gpx.jsn_freq = 0;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
i = read_wav_header(fp);
if (i) {

Wyświetl plik

@ -5,6 +5,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@ -338,6 +339,7 @@ typedef struct {
double vH; double vD; double vV;
double vE; double vN; double vU;
//int freq;
int jsn_freq; // freq/kHz (SDR)
} gpx_t;
gpx_t gpx;
@ -641,6 +643,9 @@ void print_frame(int len) {
printf(", \"frame\": %d, \"id\": \"LMS6-%d\", \"datetime\": \"%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f",
gpx.frnr, gpx.id, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD, gpx.vV );
printf(", \"subtype\": \"%s\"", "MK2A");
if (gpx.jsn_freq > 0) {
printf(", \"freq\": %d", gpx.jsn_freq);
}
printf(" }\n");
printf("\n");
gpx.prev_frnr = gpx.frnr;
@ -662,6 +667,7 @@ int main(int argc, char **argv) {
int i, bit, len;
int pos;
int header_found = 0;
int cfreq = -1;
fpname = argv[0];
@ -692,6 +698,13 @@ int main(int argc, char **argv) {
option_crc = 1;
option_verbose = 1;
}
else if (strcmp(*argv, "--jsn_cfq") == 0) {
int frq = -1; // center frequency / Hz
++argv;
if (*argv) frq = atoi(*argv); else return -1;
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else {
fp = fopen(*argv, "rb");
if (fp == NULL) {
@ -704,6 +717,9 @@ int main(int argc, char **argv) {
}
if (!wavloaded) fp = stdin;
gpx.jsn_freq = 0;
if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;
i = read_wav_header(fp);
if (i) {
fclose(fp);