diff --git a/README.md b/README.md index 577bd3d..c4d997a 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ The output data is semicolon separated and the meaning of the columns are: `MODE;CRC_OK;3OUTOF6OK;TIMESTAMP;PACKET_RSSI;CURRENT_RSSI;LINK_LAYER_IDENT_NO;DATAGRAM_WITHOUT_CRC_BYTES.` -3OUTOF6OK is only relevant for T1 and can be ignored for C1 (always set to 1). +3OUTOF6OK is only relevant for T1 and can be ignored for C1 and S1 (always set to 1). Bugfixing ----- @@ -81,6 +81,8 @@ L(ength) field from C1 mode B datagrams does not include CRC bytes anymore: L fi Significantly improved C1 receiver quality. Sad, but in the low-pass-filter was a bug: the stopband edge frequency was specified as 10kHz instead of 110kHz. I have changed the latter to 160kHz and recalculated filter coefficients. +Packet rssi value fixed for S1 mode (was always 0): thanks to alalons. + Improvements ----- A new method for picking datagrams out of the bit stream that _could_ probably better perform in C1 mode has been implemented. @@ -106,15 +108,15 @@ time2 clock recovery method has to be activated in this case (it's active by def Last but not least, you can try to receive all datagrams (S1, T1, C1) _simultaneously_: * rtl_sdr -f 868.7M -s 1600000 - 2>/dev/null | build/rtl_wmbus -s -Notice in the last line +Notice in the last line: * "-s": which is needed to inform rtl_wmbus about required frequency translation - * "868.7M": the new frequency to receive at. + * "868.7M": the new frequency to receive at rtl_wmbus will then shift all frequencies * by 250kHz to new center frequency at 868.95Mhz (T1 and C1) * by 400kHz to new center frequency at 868.3Mhz (S1) -I have tested this so far and can confirm that it works for T1/C1, but can't test for S1 as I have no such meter. +I have tested this so far and can confirm that it works for T1/C1 and S1. Thanks to alalons for providing me with bitstreams! License ------- diff --git a/rtl_wmbus.c b/rtl_wmbus.c index 8a94a22..a7af5cb 100644 --- a/rtl_wmbus.c +++ b/rtl_wmbus.c @@ -332,7 +332,7 @@ static inline float lp_fir_butter_800kHz_32kHz_36kHz(float sample) return firf(sample, &filter); } -static float rssi_filter(float sample) +static float rssi_filter_t1_c1(float sample) { static float old_sample; @@ -343,6 +343,16 @@ static float rssi_filter(float sample) return old_sample; } +static float rssi_filter_s1(float sample) +{ + static float old_sample; + +#define ALPHA 0.6789f + old_sample = ALPHA*sample + (1.0f - ALPHA)*old_sample; +#undef ALPHA + + return old_sample; +} static inline float polar_discriminator_t1_c1(float i, float q) { @@ -838,10 +848,10 @@ int main(int argc, char *argv[]) // We are using one simple filter to rssi value in order to // prevent unexpected "splashes" in signal power. float rssi_t1_c1 = sqrtf(i_t1_c1*i_t1_c1 + q_t1_c1*q_t1_c1); - rssi_t1_c1 = rssi_filter(rssi_t1_c1); // comment out, if rssi filtering is unwanted + rssi_t1_c1 = rssi_filter_t1_c1(rssi_t1_c1); // comment out, if rssi filtering is unwanted float rssi_s1 = sqrtf(i_s1*i_s1 + q_s1*q_s1); - rssi_s1 = rssi_filter(rssi_s1); // comment out, if rssi filtering is unwanted + rssi_s1 = rssi_filter_s1(rssi_s1); // comment out, if rssi filtering is unwanted #if defined(USE_MOVING_AVERAGE) // If using moving average, we would have multiples of I- and Q- signal components. rssi_t1_c1 /= opts_decimation_rate; diff --git a/s1_packet_decoder.h b/s1_packet_decoder.h index c7d2e90..a9c4643 100644 --- a/s1_packet_decoder.h +++ b/s1_packet_decoder.h @@ -172,6 +172,7 @@ static void s1_rx_bit2(unsigned bit, struct s1_packet_decoder_work *decoder) static void s1_rx_first_lfield_bit(unsigned bit, struct s1_packet_decoder_work *decoder) { decoder->byte = (bit & PACKET_DATABIT_MASK); + decoder->packet_rssi = decoder->current_rssi; } static void s1_rx_last_lfield_bit(unsigned bit, struct s1_packet_decoder_work *decoder)