Skip to content

Commit

Permalink
Define to disable the subghz worker filter.
Browse files Browse the repository at this point in the history
The subghz worker code inside the Flipper firmware has an hardcoded
filter discarding packets that are shorter than 30us. This code messes
with the opaque structure to disable it in order to try receiving higher
data rates messages.
  • Loading branch information
antirez committed Jan 9, 2023
1 parent a0c78b8 commit 811d8f3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions app.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@

#include "app.h"

/* If this define is enabled, ProtoView is going to mess with the
* otherwise opaque SubGhzWorker structure in order to disable
* its filter for samples shorter than a given amount (30us at the
* time I'm writing this comment).
*
* This structure must be taken in sync with the one of the firmware. */
#define PROTOVIEW_DISABLE_SUBGHZ_FILTER 0

#ifdef PROTOVIEW_DISABLE_SUBGHZ_FILTER
struct SubGhzWorker {
FuriThread* thread;
FuriStreamBuffer* stream;

volatile bool running;
volatile bool overrun;

LevelDuration filter_level_duration;
bool filter_running;
uint16_t filter_duration;

SubGhzWorkerOverrunCallback overrun_callback;
SubGhzWorkerPairCallback pair_callback;
void* context;
};
#endif

RawSamplesBuffer *RawSamples, *DetectedSamples;
extern const SubGhzProtocolRegistry protoview_protocol_registry;

Expand Down Expand Up @@ -75,6 +101,11 @@ ProtoViewApp* protoview_app_alloc() {

/* Setup rx worker and environment. */
app->txrx->worker = subghz_worker_alloc();

#ifdef PROTOVIEW_DISABLE_SUBGHZ_FILTER
app->txrx->worker->filter_running = 0;
#endif

app->txrx->environment = subghz_environment_alloc();
subghz_environment_set_protocol_registry(
app->txrx->environment, (void*)&protoview_protocol_registry);
Expand Down

0 comments on commit 811d8f3

Please sign in to comment.