mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-18 10:51:54 +03:00
SubGhz App: remove kostily and velosipedy
This commit is contained in:
parent
7b44221d9a
commit
417dedd317
@ -92,35 +92,41 @@ static void subghz_scene_add_to_history_callback(
|
|||||||
void* context) {
|
void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubGhz* subghz = context;
|
SubGhz* subghz = context;
|
||||||
SubGhzHistory* history = subghz->history;
|
|
||||||
FuriString* item_name = furi_string_alloc();
|
|
||||||
FuriString* item_time = furi_string_alloc();
|
|
||||||
uint16_t idx = subghz_history_get_item(history);
|
|
||||||
|
|
||||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
// The check can be moved to /lib/subghz/receiver.c, but may result in false positives
|
||||||
if(subghz_history_add_to_history(history, decoder_base, &preset)) {
|
if((decoder_base->protocol->flag & subghz->ignore_filter) == 0) {
|
||||||
furi_string_reset(item_name);
|
SubGhzHistory* history = subghz->history;
|
||||||
furi_string_reset(item_time);
|
FuriString* item_name = furi_string_alloc();
|
||||||
|
FuriString* item_time = furi_string_alloc();
|
||||||
|
uint16_t idx = subghz_history_get_item(history);
|
||||||
|
|
||||||
subghz->state_notifications = SubGhzNotificationStateRxDone;
|
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||||
|
if(subghz_history_add_to_history(history, decoder_base, &preset)) {
|
||||||
|
furi_string_reset(item_name);
|
||||||
|
furi_string_reset(item_time);
|
||||||
|
|
||||||
subghz_history_get_text_item_menu(history, item_name, idx);
|
subghz->state_notifications = SubGhzNotificationStateRxDone;
|
||||||
subghz_history_get_time_item_menu(history, item_time, idx);
|
|
||||||
subghz_view_receiver_add_item_to_menu(
|
|
||||||
subghz->subghz_receiver,
|
|
||||||
furi_string_get_cstr(item_name),
|
|
||||||
furi_string_get_cstr(item_time),
|
|
||||||
subghz_history_get_type_protocol(history, idx));
|
|
||||||
|
|
||||||
subghz_scene_receiver_update_statusbar(subghz);
|
subghz_history_get_text_item_menu(history, item_name, idx);
|
||||||
if(subghz_history_get_text_space_left(subghz->history, NULL)) {
|
subghz_history_get_time_item_menu(history, item_time, idx);
|
||||||
notification_message(subghz->notifications, &sequence_error);
|
subghz_view_receiver_add_item_to_menu(
|
||||||
|
subghz->subghz_receiver,
|
||||||
|
furi_string_get_cstr(item_name),
|
||||||
|
furi_string_get_cstr(item_time),
|
||||||
|
subghz_history_get_type_protocol(history, idx));
|
||||||
|
|
||||||
|
subghz_scene_receiver_update_statusbar(subghz);
|
||||||
|
if(subghz_history_get_text_space_left(subghz->history, NULL)) {
|
||||||
|
notification_message(subghz->notifications, &sequence_error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
subghz_receiver_reset(receiver);
|
||||||
|
furi_string_free(item_name);
|
||||||
|
furi_string_free(item_time);
|
||||||
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
||||||
|
} else {
|
||||||
|
FURI_LOG_I(TAG, "%s protocol ignored", decoder_base->protocol->name);
|
||||||
}
|
}
|
||||||
subghz_receiver_reset(receiver);
|
|
||||||
furi_string_free(item_name);
|
|
||||||
furi_string_free(item_time);
|
|
||||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void subghz_scene_receiver_on_enter(void* context) {
|
void subghz_scene_receiver_on_enter(void* context) {
|
||||||
@ -161,32 +167,6 @@ void subghz_scene_receiver_on_enter(void* context) {
|
|||||||
subghz->subghz_receiver, subghz_scene_receiver_callback, subghz);
|
subghz->subghz_receiver, subghz_scene_receiver_callback, subghz);
|
||||||
subghz_txrx_set_rx_calback(subghz->txrx, subghz_scene_add_to_history_callback, subghz);
|
subghz_txrx_set_rx_calback(subghz->txrx, subghz_scene_add_to_history_callback, subghz);
|
||||||
|
|
||||||
// TODO: Replace with proper solution based on protocol flags, remove kostily and velosipedy from here
|
|
||||||
// Needs to be done after subghz refactoring merge!!!
|
|
||||||
if(subghz->ignore_starline == true) {
|
|
||||||
if(subghz_txrx_load_decoder_by_name_protocol(subghz->txrx, "Star Line")) {
|
|
||||||
subghz_protocol_decoder_base_set_decoder_callback(
|
|
||||||
subghz_txrx_get_decoder(subghz->txrx), NULL, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(subghz->ignore_auto_alarms == true) {
|
|
||||||
if(subghz_txrx_load_decoder_by_name_protocol(subghz->txrx, "KIA Seed")) {
|
|
||||||
subghz_protocol_decoder_base_set_decoder_callback(
|
|
||||||
subghz_txrx_get_decoder(subghz->txrx), NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(subghz_txrx_load_decoder_by_name_protocol(subghz->txrx, "Scher-Khan")) {
|
|
||||||
subghz_protocol_decoder_base_set_decoder_callback(
|
|
||||||
subghz_txrx_get_decoder(subghz->txrx), NULL, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(subghz->ignore_magellan == true) {
|
|
||||||
if(subghz_txrx_load_decoder_by_name_protocol(subghz->txrx, "Magellan")) {
|
|
||||||
subghz_protocol_decoder_base_set_decoder_callback(
|
|
||||||
subghz_txrx_get_decoder(subghz->txrx), NULL, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
|
if(!subghz_history_get_text_space_left(subghz->history, NULL)) {
|
||||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||||
}
|
}
|
||||||
|
@ -71,20 +71,8 @@ const uint32_t bin_raw_value[BIN_RAW_COUNT] = {
|
|||||||
SubGhzProtocolFlag_Decodable,
|
SubGhzProtocolFlag_Decodable,
|
||||||
SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_BinRAW,
|
SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_BinRAW,
|
||||||
};
|
};
|
||||||
#define STARLINE_COUNT 2
|
#define PROTOCOL_IGNORE_COUNT 2
|
||||||
const char* const starline_text[STARLINE_COUNT] = {
|
const char* const protocol_ignore_text[PROTOCOL_IGNORE_COUNT] = {
|
||||||
"OFF",
|
|
||||||
"ON",
|
|
||||||
};
|
|
||||||
|
|
||||||
#define AUTO_ALARMS_COUNT 2
|
|
||||||
const char* const auto_alarms_text[AUTO_ALARMS_COUNT] = {
|
|
||||||
"OFF",
|
|
||||||
"ON",
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MAGELLAN_COUNT 2
|
|
||||||
const char* const magellan_text[MAGELLAN_COUNT] = {
|
|
||||||
"OFF",
|
"OFF",
|
||||||
"ON",
|
"ON",
|
||||||
};
|
};
|
||||||
@ -257,28 +245,35 @@ static void subghz_scene_receiver_config_set_raw_threshold_rssi(VariableItem* it
|
|||||||
subghz_threshold_rssi_set(subghz->threshold_rssi, raw_threshold_rssi_value[index]);
|
subghz_threshold_rssi_set(subghz->threshold_rssi, raw_threshold_rssi_value[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_scene_receiver_config_set_starline(VariableItem* item) {
|
static inline void
|
||||||
|
subghz_scene_receiver_config_set_ignore_filter(VariableItem* item, SubGhzProtocolFlag filter) {
|
||||||
SubGhz* subghz = variable_item_get_context(item);
|
SubGhz* subghz = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, starline_text[index]);
|
variable_item_set_current_value_text(item, protocol_ignore_text[index]);
|
||||||
subghz->ignore_starline = (index == 1);
|
|
||||||
|
if(index == 0) {
|
||||||
|
CLEAR_BIT(subghz->ignore_filter, filter);
|
||||||
|
} else {
|
||||||
|
SET_BIT(subghz->ignore_filter, filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static inline bool subghz_scene_receiver_config_ignore_filter_get_index(
|
||||||
|
SubGhzProtocolFlag filter,
|
||||||
|
SubGhzProtocolFlag flag) {
|
||||||
|
return READ_BIT(filter, flag) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void subghz_scene_receiver_config_set_starline(VariableItem* item) {
|
||||||
|
subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_StarLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_scene_receiver_config_set_auto_alarms(VariableItem* item) {
|
static void subghz_scene_receiver_config_set_auto_alarms(VariableItem* item) {
|
||||||
SubGhz* subghz = variable_item_get_context(item);
|
subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_AutoAlarms);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, auto_alarms_text[index]);
|
|
||||||
subghz->ignore_auto_alarms = (index == 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_scene_receiver_config_set_magellan(VariableItem* item) {
|
static void subghz_scene_receiver_config_set_magellan(VariableItem* item) {
|
||||||
SubGhz* subghz = variable_item_get_context(item);
|
subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_Magelan);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, magellan_text[index]);
|
|
||||||
subghz->ignore_magellan = (index == 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subghz_scene_receiver_config_var_list_enter_callback(void* context, uint32_t index) {
|
static void subghz_scene_receiver_config_var_list_enter_callback(void* context, uint32_t index) {
|
||||||
@ -362,35 +357,38 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
subghz->variable_item_list,
|
subghz->variable_item_list,
|
||||||
"Ignore Starline:",
|
"Ignore Starline:",
|
||||||
STARLINE_COUNT,
|
PROTOCOL_IGNORE_COUNT,
|
||||||
subghz_scene_receiver_config_set_starline,
|
subghz_scene_receiver_config_set_starline,
|
||||||
subghz);
|
subghz);
|
||||||
|
|
||||||
value_index = subghz->ignore_starline;
|
value_index = subghz_scene_receiver_config_ignore_filter_get_index(
|
||||||
|
subghz->ignore_filter, SubGhzProtocolFlag_StarLine);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, starline_text[value_index]);
|
variable_item_set_current_value_text(item, protocol_ignore_text[value_index]);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
subghz->variable_item_list,
|
subghz->variable_item_list,
|
||||||
"Ignore Cars:",
|
"Ignore Cars:",
|
||||||
AUTO_ALARMS_COUNT,
|
PROTOCOL_IGNORE_COUNT,
|
||||||
subghz_scene_receiver_config_set_auto_alarms,
|
subghz_scene_receiver_config_set_auto_alarms,
|
||||||
subghz);
|
subghz);
|
||||||
|
|
||||||
value_index = subghz->ignore_auto_alarms;
|
value_index = subghz_scene_receiver_config_ignore_filter_get_index(
|
||||||
|
subghz->ignore_filter, SubGhzProtocolFlag_AutoAlarms);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, auto_alarms_text[value_index]);
|
variable_item_set_current_value_text(item, protocol_ignore_text[value_index]);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
subghz->variable_item_list,
|
subghz->variable_item_list,
|
||||||
"Ignore Magellan:",
|
"Ignore Magellan:",
|
||||||
MAGELLAN_COUNT,
|
PROTOCOL_IGNORE_COUNT,
|
||||||
subghz_scene_receiver_config_set_magellan,
|
subghz_scene_receiver_config_set_magellan,
|
||||||
subghz);
|
subghz);
|
||||||
|
|
||||||
value_index = subghz->ignore_magellan;
|
value_index = subghz_scene_receiver_config_ignore_filter_get_index(
|
||||||
|
subghz->ignore_filter, SubGhzProtocolFlag_Magelan);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, magellan_text[value_index]);
|
variable_item_set_current_value_text(item, protocol_ignore_text[value_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable speaker, will send all incoming noises and signals to speaker so you can listen how your remote sounds like :)
|
// Enable speaker, will send all incoming noises and signals to speaker so you can listen how your remote sounds like :)
|
||||||
|
@ -242,6 +242,7 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
|||||||
subghz->secure_data = malloc(sizeof(SecureData));
|
subghz->secure_data = malloc(sizeof(SecureData));
|
||||||
|
|
||||||
subghz->filter = SubGhzProtocolFlag_Decodable;
|
subghz->filter = SubGhzProtocolFlag_Decodable;
|
||||||
|
subghz->ignore_filter = 0x0;
|
||||||
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
|
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
|
||||||
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);
|
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);
|
||||||
|
|
||||||
|
@ -89,13 +89,10 @@ struct SubGhz {
|
|||||||
SubGhzLastSettings* last_settings;
|
SubGhzLastSettings* last_settings;
|
||||||
|
|
||||||
SubGhzProtocolFlag filter;
|
SubGhzProtocolFlag filter;
|
||||||
|
SubGhzProtocolFlag ignore_filter;
|
||||||
FuriString* error_str;
|
FuriString* error_str;
|
||||||
SubGhzLock lock;
|
SubGhzLock lock;
|
||||||
|
|
||||||
bool ignore_starline;
|
|
||||||
bool ignore_auto_alarms;
|
|
||||||
bool ignore_magellan;
|
|
||||||
|
|
||||||
SecureData* secure_data;
|
SecureData* secure_data;
|
||||||
|
|
||||||
SubGhzFileEncoderWorker* decode_raw_file_worker_encoder;
|
SubGhzFileEncoderWorker* decode_raw_file_worker_encoder;
|
||||||
|
@ -63,7 +63,8 @@ const SubGhzProtocolEncoder subghz_protocol_kia_encoder = {
|
|||||||
const SubGhzProtocol subghz_protocol_kia = {
|
const SubGhzProtocol subghz_protocol_kia = {
|
||||||
.name = SUBGHZ_PROTOCOL_KIA_NAME,
|
.name = SUBGHZ_PROTOCOL_KIA_NAME,
|
||||||
.type = SubGhzProtocolTypeDynamic,
|
.type = SubGhzProtocolTypeDynamic,
|
||||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable,
|
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable |
|
||||||
|
SubGhzProtocolFlag_AutoAlarms,
|
||||||
|
|
||||||
.decoder = &subghz_protocol_kia_decoder,
|
.decoder = &subghz_protocol_kia_decoder,
|
||||||
.encoder = &subghz_protocol_kia_encoder,
|
.encoder = &subghz_protocol_kia_encoder,
|
||||||
|
@ -64,7 +64,8 @@ const SubGhzProtocol subghz_protocol_magellan = {
|
|||||||
.name = SUBGHZ_PROTOCOL_MAGELLAN_NAME,
|
.name = SUBGHZ_PROTOCOL_MAGELLAN_NAME,
|
||||||
.type = SubGhzProtocolTypeStatic,
|
.type = SubGhzProtocolTypeStatic,
|
||||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
|
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
|
||||||
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
|
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send |
|
||||||
|
SubGhzProtocolFlag_Magelan,
|
||||||
|
|
||||||
.decoder = &subghz_protocol_magellan_decoder,
|
.decoder = &subghz_protocol_magellan_decoder,
|
||||||
.encoder = &subghz_protocol_magellan_encoder,
|
.encoder = &subghz_protocol_magellan_encoder,
|
||||||
|
@ -70,7 +70,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = {
|
|||||||
.name = SUBGHZ_PROTOCOL_SCHER_KHAN_NAME,
|
.name = SUBGHZ_PROTOCOL_SCHER_KHAN_NAME,
|
||||||
.type = SubGhzProtocolTypeDynamic,
|
.type = SubGhzProtocolTypeDynamic,
|
||||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable |
|
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable |
|
||||||
SubGhzProtocolFlag_Save,
|
SubGhzProtocolFlag_Save | SubGhzProtocolFlag_AutoAlarms,
|
||||||
|
|
||||||
.decoder = &subghz_protocol_scher_khan_decoder,
|
.decoder = &subghz_protocol_scher_khan_decoder,
|
||||||
.encoder = &subghz_protocol_scher_khan_encoder,
|
.encoder = &subghz_protocol_scher_khan_encoder,
|
||||||
|
@ -79,7 +79,8 @@ const SubGhzProtocol subghz_protocol_star_line = {
|
|||||||
.name = SUBGHZ_PROTOCOL_STAR_LINE_NAME,
|
.name = SUBGHZ_PROTOCOL_STAR_LINE_NAME,
|
||||||
.type = SubGhzProtocolTypeDynamic,
|
.type = SubGhzProtocolTypeDynamic,
|
||||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
|
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
|
||||||
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
|
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send |
|
||||||
|
SubGhzProtocolFlag_StarLine,
|
||||||
|
|
||||||
.decoder = &subghz_protocol_star_line_decoder,
|
.decoder = &subghz_protocol_star_line_decoder,
|
||||||
.encoder = &subghz_protocol_star_line_encoder,
|
.encoder = &subghz_protocol_star_line_encoder,
|
||||||
|
@ -117,6 +117,9 @@ typedef enum {
|
|||||||
SubGhzProtocolFlag_Load = (1 << 8),
|
SubGhzProtocolFlag_Load = (1 << 8),
|
||||||
SubGhzProtocolFlag_Send = (1 << 9),
|
SubGhzProtocolFlag_Send = (1 << 9),
|
||||||
SubGhzProtocolFlag_BinRAW = (1 << 10),
|
SubGhzProtocolFlag_BinRAW = (1 << 10),
|
||||||
|
SubGhzProtocolFlag_StarLine = (1 << 11),
|
||||||
|
SubGhzProtocolFlag_AutoAlarms = (1 << 12),
|
||||||
|
SubGhzProtocolFlag_Magelan = (1 << 13),
|
||||||
} SubGhzProtocolFlag;
|
} SubGhzProtocolFlag;
|
||||||
|
|
||||||
struct SubGhzProtocol {
|
struct SubGhzProtocol {
|
||||||
|
Loading…
Reference in New Issue
Block a user