mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-24 11:14:26 +03:00
Revert SubGhz FA changes
This commit is contained in:
parent
0321717a86
commit
757b218397
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#define TAG "SubghzFrequencyAnalyzerWorker"
|
#define TAG "SubghzFrequencyAnalyzerWorker"
|
||||||
|
|
||||||
|
#define SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD -97.0f
|
||||||
|
|
||||||
static const uint8_t subghz_preset_ook_58khz[][2] = {
|
static const uint8_t subghz_preset_ook_58khz[][2] = {
|
||||||
{CC1101_MDMCFG4, 0b11110111}, // Rx BW filter is 58.035714kHz
|
{CC1101_MDMCFG4, 0b11110111}, // Rx BW filter is 58.035714kHz
|
||||||
/* End */
|
/* End */
|
||||||
@ -70,7 +72,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
.frequency_coarse = 0, .rssi_coarse = 0, .frequency_fine = 0, .rssi_fine = 0};
|
.frequency_coarse = 0, .rssi_coarse = 0, .frequency_fine = 0, .rssi_fine = 0};
|
||||||
float rssi = 0;
|
float rssi = 0;
|
||||||
uint32_t frequency = 0;
|
uint32_t frequency = 0;
|
||||||
float rssi_temp = -127.0f;
|
float rssi_temp = 0;
|
||||||
uint32_t frequency_temp = 0;
|
uint32_t frequency_temp = 0;
|
||||||
CC1101Status status;
|
CC1101Status status;
|
||||||
|
|
||||||
@ -195,7 +197,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
TAG, "=:%lu:%f", frequency_rssi.frequency_fine, (double)frequency_rssi.rssi_fine);
|
TAG, "=:%lu:%f", frequency_rssi.frequency_fine, (double)frequency_rssi.rssi_fine);
|
||||||
|
|
||||||
instance->sample_hold_counter = 20;
|
instance->sample_hold_counter = 20;
|
||||||
rssi_temp = (rssi_temp + frequency_rssi.rssi_fine) / 2;
|
rssi_temp = frequency_rssi.rssi_fine;
|
||||||
frequency_temp = frequency_rssi.frequency_fine;
|
frequency_temp = frequency_rssi.frequency_fine;
|
||||||
|
|
||||||
if(instance->filVal) {
|
if(instance->filVal) {
|
||||||
@ -206,7 +208,10 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
// Deliver callback
|
// Deliver callback
|
||||||
if(instance->pair_callback) {
|
if(instance->pair_callback) {
|
||||||
instance->pair_callback(
|
instance->pair_callback(
|
||||||
instance->context, frequency_rssi.frequency_fine, rssi_temp, true);
|
instance->context,
|
||||||
|
frequency_rssi.frequency_fine,
|
||||||
|
frequency_rssi.rssi_fine,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
} else if( // Deliver results coarse
|
} else if( // Deliver results coarse
|
||||||
(frequency_rssi.rssi_coarse > instance->trigger_level) &&
|
(frequency_rssi.rssi_coarse > instance->trigger_level) &&
|
||||||
@ -218,7 +223,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
(double)frequency_rssi.rssi_coarse);
|
(double)frequency_rssi.rssi_coarse);
|
||||||
|
|
||||||
instance->sample_hold_counter = 20;
|
instance->sample_hold_counter = 20;
|
||||||
rssi_temp = (rssi_temp + frequency_rssi.rssi_coarse) / 2;
|
rssi_temp = frequency_rssi.rssi_coarse;
|
||||||
frequency_temp = frequency_rssi.frequency_coarse;
|
frequency_temp = frequency_rssi.frequency_coarse;
|
||||||
if(instance->filVal) {
|
if(instance->filVal) {
|
||||||
frequency_rssi.frequency_coarse =
|
frequency_rssi.frequency_coarse =
|
||||||
@ -228,12 +233,15 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
// Deliver callback
|
// Deliver callback
|
||||||
if(instance->pair_callback) {
|
if(instance->pair_callback) {
|
||||||
instance->pair_callback(
|
instance->pair_callback(
|
||||||
instance->context, frequency_rssi.frequency_coarse, rssi_temp, true);
|
instance->context,
|
||||||
|
frequency_rssi.frequency_coarse,
|
||||||
|
frequency_rssi.rssi_coarse,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(instance->sample_hold_counter > 0) {
|
if(instance->sample_hold_counter > 0) {
|
||||||
instance->sample_hold_counter--;
|
instance->sample_hold_counter--;
|
||||||
if(instance->sample_hold_counter == 15) {
|
if(instance->sample_hold_counter == 18) {
|
||||||
if(instance->pair_callback) {
|
if(instance->pair_callback) {
|
||||||
instance->pair_callback(
|
instance->pair_callback(
|
||||||
instance->context, frequency_temp, rssi_temp, false);
|
instance->context, frequency_temp, rssi_temp, false);
|
||||||
@ -241,8 +249,8 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
instance->filVal = 0;
|
instance->filVal = 0;
|
||||||
rssi_temp = -127.0f;
|
if(instance->pair_callback)
|
||||||
instance->pair_callback(instance->context, 0, 0, false);
|
instance->pair_callback(instance->context, 0, 0, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,8 +266,12 @@ SubGhzFrequencyAnalyzerWorker* subghz_frequency_analyzer_worker_alloc(void* cont
|
|||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhzFrequencyAnalyzerWorker* instance = malloc(sizeof(SubGhzFrequencyAnalyzerWorker));
|
SubGhzFrequencyAnalyzerWorker* instance = malloc(sizeof(SubGhzFrequencyAnalyzerWorker));
|
||||||
|
|
||||||
instance->thread = furi_thread_alloc_ex(
|
instance->thread = furi_thread_alloc();
|
||||||
"SubGhzFAWorker", 2048, subghz_frequency_analyzer_worker_thread, instance);
|
furi_thread_set_name(instance->thread, "SubGhzFAWorker");
|
||||||
|
furi_thread_set_stack_size(instance->thread, 2048);
|
||||||
|
furi_thread_set_context(instance->thread, instance);
|
||||||
|
furi_thread_set_callback(instance->thread, subghz_frequency_analyzer_worker_thread);
|
||||||
|
|
||||||
SubGhz* subghz = context;
|
SubGhz* subghz = context;
|
||||||
instance->setting = subghz->setting;
|
instance->setting = subghz->setting;
|
||||||
instance->trigger_level = subghz->last_settings->frequency_analyzer_trigger;
|
instance->trigger_level = subghz->last_settings->frequency_analyzer_trigger;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
#include "../subghz_i.h"
|
#include "../subghz_i.h"
|
||||||
|
|
||||||
#define SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD -97.0f
|
|
||||||
|
|
||||||
typedef struct SubGhzFrequencyAnalyzerWorker SubGhzFrequencyAnalyzerWorker;
|
typedef struct SubGhzFrequencyAnalyzerWorker SubGhzFrequencyAnalyzerWorker;
|
||||||
|
|
||||||
typedef void (*SubGhzFrequencyAnalyzerWorkerPairCallback)(
|
typedef void (*SubGhzFrequencyAnalyzerWorkerPairCallback)(
|
||||||
|
Loading…
Reference in New Issue
Block a user