From 6531ea48a7933ac8289724672059e54fd8aad8eb Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" Date: Wed, 13 Dec 2017 09:54:00 +0100 Subject: [PATCH] change grab file name to gNNN_FFFM_RRRk.cu8 (#642) --- README.md | 6 +++--- src/rtl_433.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f80e9f49..cfb26bc4 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ Examples: | `rtl_433 -p NN -R 1 -R 9 -R 36 -R 40` | Typical usage: Enable device decoders for desired devices. Correct rtl-sdr tuning error (ppm offset). | `rtl_433 -a` | Will run in analyze mode and you will get a text description of the received signal. | `rtl_433 -A` | Enable pulse analyzer. Summarizes the timings of pulses, gaps, and periods. Can be used in either the normal decode mode, or analyze mode. -| `rtl_433 -a -t` | Will run in analyze mode and save a test file per detected signal (gfile###.data). Format is uint8, 2 channels. +| `rtl_433 -a -t` | Will run in analyze mode and save a test file per detected signal (`g###_###M_###k.cu8`). Format is uint8, 2 channels. | `rtl_433 -r file_name` | Play back a saved data file. | `rtl_433 file_name` | Will save everything received from the rtl-sdr during the session into a single file. The saves file may become quite large depending on how long rtl_433 is left running. Note: saving signals into individual files wint `rtl_433 -a -t` is preferred. | `rtl_433 -F json -U \| mosquitto_pub -t home/rtl_433 -l` | Will pipe the output to network as JSON formatted MQTT messages. A test MQTT client can be found in `tests/mqtt_rtl_433_test.py`. @@ -215,10 +215,10 @@ Note: Not all device protocol decoders are enabled by default. When testing to s is decoded by rtl_433, use `-G` to enable all device protocols. The first step in decoding new devices is to record the signals using `-a -t`. The signals will be -stored individually in files named gfileNNN.data that can be played back with `rtl_433 -r gfileNNN.data`. +stored individually in files named gNNN_FFFM_RRRk.cu8 that can be played back with `rtl_433 -r gNNN_FFFM_RRRk.cu8`. These files are vital for understanding the signal format as well as the message data. Use both analyzers -`-a` and `-A` to look at the recorded signal and determine the pulse characteristics, e.g. `rtl_433 -r gfileNNN.data -a -A`. +`-a` and `-A` to look at the recorded signal and determine the pulse characteristics, e.g. `rtl_433 -r gNNN_FFFM_RRRk.cu8 -a -A`. Make sure you have recorded a proper set of test signals representing different conditions together with any and all information about the values that the signal should represent. For example, make a diff --git a/src/rtl_433.c b/src/rtl_433.c index 6038a239..76bef793 100644 --- a/src/rtl_433.c +++ b/src/rtl_433.c @@ -34,6 +34,7 @@ static int do_exit = 0; static int do_exit_async = 0, frequencies = 0; uint32_t frequency[MAX_PROTOCOLS]; +uint32_t center_frequency = 0; time_t rawtime_old; int duration = 0; time_t stop_time; @@ -542,7 +543,7 @@ static void pwm_analyze(struct dm_state *demod, int16_t *buf, uint32_t len) { FILE *sgfp; while (1) { - sprintf(sgf_name, "gfile%03d.data", demod->signal_grabber); + sprintf(sgf_name, "g%03d_%gM_%gk.cu8", demod->signal_grabber, frequency[0]/1000000.0, samp_rate/1000.0); demod->signal_grabber++; if (access(sgf_name, F_OK) == -1 || overwrite_mode) { break; @@ -1345,7 +1346,8 @@ int main(int argc, char **argv) { } while (!do_exit) { /* Set the frequency */ - r = rtlsdr_set_center_freq(dev, frequency[frequency_current]); + center_frequency = frequency[frequency_current]; + r = rtlsdr_set_center_freq(dev, center_frequency); if (r < 0) fprintf(stderr, "WARNING: Failed to set center freq.\n"); else