Skip to content

Commit

Permalink
Fixes for OOK Reception
Browse files Browse the repository at this point in the history
@diepeterpan We needed to back these out to resolve user issues with the changes introduced in release 0.1.7 / #60
  • Loading branch information
NorthernMan54 committed Apr 19, 2023
1 parent 353b500 commit c90ea35
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/rtl_433/pulse_slicer.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ int pulse_slicer_pcm(pulse_data_t const* pulses, r_device* device) {

int const gap_limit = s_gap ? s_gap : s_reset;
int const max_zeros = gap_limit / s_long;
if (s_tolerance <= 0)
s_tolerance = s_long / 4; // default tolerance is +-25% of a bit period

// if there is a run of bit-wide toggles (preamble) tune the bit period
int min_count = s_short == s_long ? 12 : 4;
Expand Down Expand Up @@ -319,8 +317,8 @@ int pulse_slicer_pwm(pulse_data_t const* pulses, r_device* device) {
int s_sync = device->sync_width * samples_per_us;
int s_tolerance = device->tolerance * samples_per_us;

if (s_tolerance <= 0) // From https://github.com/NorthernMan54/rtl_433_ESP/pull/65
s_tolerance = s_long / 4; // default tolerance is +-25% of a bit period
// if (s_tolerance <= 0) // From https://github.com/NorthernMan54/rtl_433_ESP/pull/65
// s_tolerance = s_long / 4; // default tolerance is +-25% of a bit period

// check for rounding to zero
if ((device->short_width > 0 && s_short <= 0) || (device->long_width > 0 && s_long <= 0) || (device->reset_limit > 0 && s_reset <= 0) || (device->gap_limit > 0 && s_gap <= 0) || (device->sync_width > 0 && s_sync <= 0) || (device->tolerance > 0 && s_tolerance <= 0)) {
Expand Down
2 changes: 1 addition & 1 deletion src/rtl_433_ESP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void rtl_433_ESP::initReceiver(byte inputPin, float receiveFrequency) {
state = radio.setBitRate(1.2);
RADIOLIB_STATE(state, "setBitRate");

state = radio.setRxBandwidth(50); // Lowering to 125 lowered number of received signals
state = radio.setRxBandwidth(250); // Lowering to 125 lowered number of received signals
RADIOLIB_STATE(state, "setRxBandwidth");

} else {
Expand Down
2 changes: 1 addition & 1 deletion src/signalDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void rtl_433_DecoderTask(void* pvParameters) {
data_t* data;
/* clang-format off */
data = data_make(
"model", "", DATA_STRING, "unknown",
"model", "", DATA_STRING, "undecoded signal",
"protocol", "", DATA_STRING, "signal parsing failed",
"duration", "", DATA_INT, rtl_pulses->signalDuration,
"rssi", "", DATA_INT, rtl_pulses->signalRssi,
Expand Down

2 comments on commit c90ea35

@diepeterpan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make some of the items like the value of setRxBandwidth a #define directive to overwrite the fedault value of 250 where some 433 devices and signals require lower bw for more accurate decoding.

@NorthernMan54
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current master has this feature, will be part of the next release

Please sign in to comment.