mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
fix detect raw bug, fix came atomo
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "../subghz_i.h"
|
||||
#include "../views/receiver.h"
|
||||
#include <lib/subghz/protocols/raw.h>
|
||||
|
||||
#include <lib/subghz/subghz_file_encoder_worker.h>
|
||||
|
||||
@@ -174,6 +175,12 @@ void subghz_scene_decode_raw_on_enter(void* context) {
|
||||
subghz_receiver_set_rx_callback(
|
||||
subghz->txrx->receiver, subghz_scene_add_to_history_callback, subghz);
|
||||
|
||||
// make sure we're not in auto-detect mode, which is only meant for the Read app
|
||||
subghz_protocol_decoder_raw_set_auto_mode(
|
||||
subghz_receiver_search_decoder_base_by_name(
|
||||
subghz->txrx->receiver, SUBGHZ_PROTOCOL_RAW_NAME),
|
||||
false);
|
||||
|
||||
if(decode_raw_state == SubGhzDecodeRawStateStart) {
|
||||
//Decode RAW to history
|
||||
subghz_history_reset(subghz->txrx->history);
|
||||
|
||||
@@ -187,7 +187,7 @@ static void subghz_scene_receiver_config_set_detect_raw(VariableItem* item) {
|
||||
variable_item_set_current_value_text(item, detect_raw_text[index]);
|
||||
subghz_receiver_set_filter(subghz->txrx->receiver, detect_raw_value[index]);
|
||||
|
||||
subghz->last_setting->detect_raw = detect_raw_value[index];
|
||||
//subghz->last_setting->detect_raw = detect_raw_value[index];
|
||||
|
||||
subghz_protocol_decoder_raw_set_auto_mode(
|
||||
subghz_receiver_search_decoder_base_by_name(
|
||||
|
||||
@@ -41,7 +41,7 @@ void subghz_last_setting_load(SubGhzLastSetting* instance, const char* file_path
|
||||
string_init(temp_preset);
|
||||
uint32_t temp_frequency = 0; // Default 433920000
|
||||
uint32_t temp_hopping = 0; // Default 0
|
||||
uint32_t temp_detect_raw = 0; // Default 2
|
||||
//uint32_t temp_detect_raw = 0; Default 2
|
||||
int32_t temp_rssi_threshold = 0; // Default -72
|
||||
|
||||
if(FSE_OK == storage_sd_status(storage) && file_path &&
|
||||
@@ -49,31 +49,31 @@ void subghz_last_setting_load(SubGhzLastSetting* instance, const char* file_path
|
||||
flipper_format_read_string(fff_data_file, "Preset", temp_preset);
|
||||
flipper_format_read_uint32(fff_data_file, "Frequency", (uint32_t*)&temp_frequency, 1);
|
||||
flipper_format_read_uint32(fff_data_file, "Hopping", (uint32_t*)&temp_hopping, 1);
|
||||
flipper_format_read_uint32(fff_data_file, "DetectRaw", (uint32_t*)&temp_detect_raw, 1);
|
||||
//flipper_format_read_uint32(fff_data_file, "DetectRaw", (uint32_t*)&temp_detect_raw, 1);
|
||||
flipper_format_read_int32(fff_data_file, "Rssi", (int32_t*)&temp_rssi_threshold, 1);
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Error open file %s", file_path);
|
||||
}
|
||||
|
||||
if(string_empty_p(temp_preset)) {
|
||||
FURI_LOG_I(TAG, "Last used preset not found");
|
||||
//FURI_LOG_I(TAG, "Last used preset not found");
|
||||
string_set(instance->preset_name, SUBGHZ_LAST_SETTING_DEFAULT_PRESET);
|
||||
} else {
|
||||
string_set(instance->preset_name, temp_preset);
|
||||
}
|
||||
|
||||
if(temp_frequency == 0 || !furi_hal_subghz_is_tx_allowed(temp_frequency)) {
|
||||
FURI_LOG_I(TAG, "Last used frequency not found or can't be used!");
|
||||
//FURI_LOG_I(TAG, "Last used frequency not found or can't be used!");
|
||||
instance->frequency = SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY;
|
||||
} else {
|
||||
instance->frequency = temp_frequency;
|
||||
}
|
||||
|
||||
if(temp_detect_raw == 0) {
|
||||
/*if(temp_detect_raw == 0) {
|
||||
instance->detect_raw = SubGhzProtocolFlag_Decodable;
|
||||
} else {
|
||||
instance->detect_raw = temp_detect_raw;
|
||||
}
|
||||
}*/
|
||||
|
||||
if(temp_rssi_threshold == 0) {
|
||||
instance->rssi_threshold = -72;
|
||||
@@ -105,15 +105,15 @@ bool subghz_last_setting_save(SubGhzLastSetting* instance, const char* file_path
|
||||
file, SUBGHZ_LAST_SETTING_FILE_TYPE, SUBGHZ_LAST_SETTING_FILE_VERSION))
|
||||
break;
|
||||
|
||||
FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name));
|
||||
//FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name));
|
||||
if(!flipper_format_insert_or_update_string_cstr(
|
||||
file, "Preset", string_get_cstr(instance->preset_name)))
|
||||
break;
|
||||
if(!flipper_format_insert_or_update_uint32(file, "Frequency", &instance->frequency, 1))
|
||||
break;
|
||||
if(!flipper_format_insert_or_update_uint32(file, "Hopping", &instance->hopping, 1)) break;
|
||||
if(!flipper_format_insert_or_update_uint32(file, "DetectRaw", &instance->detect_raw, 1))
|
||||
break;
|
||||
//if(!flipper_format_insert_or_update_uint32(file, "DetectRaw", &instance->detect_raw, 1))
|
||||
// break;
|
||||
if(!flipper_format_insert_or_update_int32(file, "Rssi", &instance->rssi_threshold, 1))
|
||||
break;
|
||||
|
||||
@@ -131,11 +131,11 @@ bool subghz_last_setting_save(SubGhzLastSetting* instance, const char* file_path
|
||||
}
|
||||
|
||||
void subghz_last_setting_set_receiver_values(SubGhzLastSetting* instance, SubGhzReceiver* receiver) {
|
||||
subghz_receiver_set_filter(receiver, instance->detect_raw);
|
||||
/*subghz_receiver_set_filter(receiver, instance->detect_raw);
|
||||
|
||||
subghz_protocol_decoder_raw_set_auto_mode(
|
||||
subghz_receiver_search_decoder_base_by_name(receiver, SUBGHZ_PROTOCOL_RAW_NAME),
|
||||
(instance->detect_raw != SubGhzProtocolFlag_Decodable));
|
||||
(instance->detect_raw != SubGhzProtocolFlag_Decodable));*/
|
||||
|
||||
subghz_protocol_decoder_raw_set_rssi_threshold(
|
||||
subghz_receiver_search_decoder_base_by_name(receiver, SUBGHZ_PROTOCOL_RAW_NAME),
|
||||
|
||||
@@ -9,7 +9,7 @@ typedef struct {
|
||||
string_t preset_name;
|
||||
uint32_t frequency;
|
||||
uint32_t hopping;
|
||||
uint32_t detect_raw;
|
||||
//uint32_t detect_raw;
|
||||
int32_t rssi_threshold;
|
||||
} SubGhzLastSetting;
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ void* subghz_protocol_encoder_came_atomo_alloc(SubGhzEnvironment* environment) {
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = 4096; //approx max buffer size
|
||||
instance->encoder.size_upload = 1024; //approx max buffer size
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define SUBGHZ_DOWNLOAD_MAX_SIZE 512
|
||||
#define SUBGHZ_AUTO_DETECT_DOWNLOAD_MAX_SIZE 2048
|
||||
#define SUBGHZ_AUTO_DETECT_RAW_THRESHOLD -72.0f
|
||||
#define SUBGHZ_AUTO_DETECT_RAW_POSTROLL_FRAMES 30
|
||||
#define SUBGHZ_AUTO_DETECT_RAW_POSTROLL_FRAMES 40
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_raw_const = {
|
||||
.te_short = 50,
|
||||
|
||||
Reference in New Issue
Block a user