mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 15:04:19 +00:00
Merge pull request #516 from gid9798/subghz/code_improvement
SubGhz App
This commit is contained in:
commit
9d09aa4313
13 changed files with 147 additions and 140 deletions
|
@ -92,35 +92,41 @@ static void subghz_scene_add_to_history_callback(
|
|||
void* context) {
|
||||
furi_assert(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);
|
||||
if(subghz_history_add_to_history(history, decoder_base, &preset)) {
|
||||
furi_string_reset(item_name);
|
||||
furi_string_reset(item_time);
|
||||
// The check can be moved to /lib/subghz/receiver.c, but may result in false positives
|
||||
if((decoder_base->protocol->flag & subghz->ignore_filter) == 0) {
|
||||
SubGhzHistory* history = subghz->history;
|
||||
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_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->state_notifications = SubGhzNotificationStateRxDone;
|
||||
|
||||
subghz_scene_receiver_update_statusbar(subghz);
|
||||
if(subghz_history_get_text_space_left(subghz->history, NULL)) {
|
||||
notification_message(subghz->notifications, &sequence_error);
|
||||
subghz_history_get_text_item_menu(history, item_name, idx);
|
||||
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);
|
||||
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) {
|
||||
|
@ -161,32 +167,6 @@ void subghz_scene_receiver_on_enter(void* context) {
|
|||
subghz->subghz_receiver, subghz_scene_receiver_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)) {
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
}
|
||||
|
|
|
@ -71,20 +71,8 @@ const uint32_t bin_raw_value[BIN_RAW_COUNT] = {
|
|||
SubGhzProtocolFlag_Decodable,
|
||||
SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_BinRAW,
|
||||
};
|
||||
#define STARLINE_COUNT 2
|
||||
const char* const starline_text[STARLINE_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] = {
|
||||
#define PROTOCOL_IGNORE_COUNT 2
|
||||
const char* const protocol_ignore_text[PROTOCOL_IGNORE_COUNT] = {
|
||||
"OFF",
|
||||
"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]);
|
||||
}
|
||||
|
||||
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);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
|
||||
variable_item_set_current_value_text(item, starline_text[index]);
|
||||
subghz->ignore_starline = (index == 1);
|
||||
variable_item_set_current_value_text(item, protocol_ignore_text[index]);
|
||||
|
||||
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) {
|
||||
SubGhz* subghz = variable_item_get_context(item);
|
||||
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);
|
||||
subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_AutoAlarms);
|
||||
}
|
||||
|
||||
static void subghz_scene_receiver_config_set_magellan(VariableItem* item) {
|
||||
SubGhz* subghz = variable_item_get_context(item);
|
||||
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);
|
||||
subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_Magelan);
|
||||
}
|
||||
|
||||
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(
|
||||
subghz->variable_item_list,
|
||||
"Ignore Starline:",
|
||||
STARLINE_COUNT,
|
||||
PROTOCOL_IGNORE_COUNT,
|
||||
subghz_scene_receiver_config_set_starline,
|
||||
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_text(item, starline_text[value_index]);
|
||||
variable_item_set_current_value_text(item, protocol_ignore_text[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
subghz->variable_item_list,
|
||||
"Ignore Cars:",
|
||||
AUTO_ALARMS_COUNT,
|
||||
PROTOCOL_IGNORE_COUNT,
|
||||
subghz_scene_receiver_config_set_auto_alarms,
|
||||
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_text(item, auto_alarms_text[value_index]);
|
||||
variable_item_set_current_value_text(item, protocol_ignore_text[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
subghz->variable_item_list,
|
||||
"Ignore Magellan:",
|
||||
MAGELLAN_COUNT,
|
||||
PROTOCOL_IGNORE_COUNT,
|
||||
subghz_scene_receiver_config_set_magellan,
|
||||
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_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 :)
|
||||
|
|
|
@ -51,6 +51,42 @@ static void subghz_rpc_command_callback(RpcAppSystemEvent event, void* context)
|
|||
}
|
||||
}
|
||||
|
||||
static void subghz_load_custom_presets(SubGhzSetting* setting) {
|
||||
furi_assert(setting);
|
||||
|
||||
const char* presets[][2] = {
|
||||
{"FM95",
|
||||
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
||||
|
||||
// #2-FSK 200khz BW / 135kHz Filter/ 15.86Khz Deviation + Ramping
|
||||
{"FM15k",
|
||||
"02 0D 03 47 08 32 0B 06 15 32 14 00 13 00 12 00 11 32 10 A7 18 18 19 1D 1D 92 1C 00 1B 04 20 FB 22 17 21 B6 00 00 00 12 0E 34 60 C5 C1 C0"},
|
||||
|
||||
// Pagers
|
||||
{"Pagers",
|
||||
"02 0D 07 04 08 32 0B 06 10 64 11 93 12 0C 13 02 14 00 15 15 18 18 19 16 1B 07 1C 00 1D 91 20 FB 21 56 22 10 00 00 C0 00 00 00 00 00 00 00"},
|
||||
|
||||
// # HND - FM preset
|
||||
{"HND_1",
|
||||
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 36 10 69 15 32 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
||||
};
|
||||
|
||||
FlipperFormat* fff_temp = flipper_format_string_alloc();
|
||||
|
||||
for(uint8_t i = 0; i < COUNT_OF(presets); i++) {
|
||||
flipper_format_insert_or_update_string_cstr(fff_temp, "Custom_preset_data", presets[i][1]);
|
||||
|
||||
flipper_format_rewind(fff_temp);
|
||||
subghz_setting_load_custom_preset(setting, presets[i][0], fff_temp);
|
||||
}
|
||||
|
||||
flipper_format_free(fff_temp);
|
||||
|
||||
#ifdef FURI_DEBUG
|
||||
subghz_setting_customs_presets_to_log(setting);
|
||||
#endif
|
||||
}
|
||||
|
||||
SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
||||
SubGhz* subghz = malloc(sizeof(SubGhz));
|
||||
|
||||
|
@ -177,52 +213,7 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
|||
|
||||
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
|
||||
|
||||
// Custom Presets load without using config file
|
||||
if(!alloc_for_tx_only) {
|
||||
FlipperFormat* temp_fm_preset = flipper_format_string_alloc();
|
||||
flipper_format_write_string_cstr(
|
||||
temp_fm_preset,
|
||||
(const char*)"Custom_preset_data",
|
||||
(const char*)"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00");
|
||||
flipper_format_rewind(temp_fm_preset);
|
||||
subghz_setting_load_custom_preset(setting, (const char*)"FM95", temp_fm_preset);
|
||||
|
||||
flipper_format_free(temp_fm_preset);
|
||||
|
||||
// #2-FSK 200khz BW / 135kHz Filter/ 15.86Khz Deviation + Ramping
|
||||
FlipperFormat* temp_fm_preset2 = flipper_format_string_alloc();
|
||||
flipper_format_write_string_cstr(
|
||||
temp_fm_preset2,
|
||||
(const char*)"Custom_preset_data",
|
||||
(const char*)"02 0D 03 47 08 32 0B 06 15 32 14 00 13 00 12 00 11 32 10 A7 18 18 19 1D 1D 92 1C 00 1B 04 20 FB 22 17 21 B6 00 00 00 12 0E 34 60 C5 C1 C0");
|
||||
flipper_format_rewind(temp_fm_preset2);
|
||||
subghz_setting_load_custom_preset(setting, (const char*)"FM15k", temp_fm_preset2);
|
||||
|
||||
flipper_format_free(temp_fm_preset2);
|
||||
|
||||
// Pagers
|
||||
FlipperFormat* temp_fm_preset3 = flipper_format_string_alloc();
|
||||
flipper_format_write_string_cstr(
|
||||
temp_fm_preset3,
|
||||
(const char*)"Custom_preset_data",
|
||||
(const char*)"02 0D 07 04 08 32 0B 06 10 64 11 93 12 0C 13 02 14 00 15 15 18 18 19 16 1B 07 1C 00 1D 91 20 FB 21 56 22 10 00 00 C0 00 00 00 00 00 00 00");
|
||||
flipper_format_rewind(temp_fm_preset3);
|
||||
subghz_setting_load_custom_preset(setting, (const char*)"Pagers", temp_fm_preset3);
|
||||
|
||||
flipper_format_free(temp_fm_preset3);
|
||||
|
||||
// # HND - FM preset
|
||||
FlipperFormat* temp_fm_preset4 = flipper_format_string_alloc();
|
||||
flipper_format_write_string_cstr(
|
||||
temp_fm_preset4,
|
||||
(const char*)"Custom_preset_data",
|
||||
(const char*)"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 36 10 69 15 32 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00");
|
||||
flipper_format_rewind(temp_fm_preset4);
|
||||
subghz_setting_load_custom_preset(setting, (const char*)"HND_1", temp_fm_preset4);
|
||||
|
||||
flipper_format_free(temp_fm_preset4);
|
||||
}
|
||||
// custom presets loading - end
|
||||
subghz_load_custom_presets(setting);
|
||||
|
||||
// Load last used values for Read, Read RAW, etc. or default
|
||||
subghz->last_settings = subghz_last_settings_alloc();
|
||||
|
@ -251,6 +242,7 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
|||
subghz->secure_data = malloc(sizeof(SecureData));
|
||||
|
||||
subghz->filter = SubGhzProtocolFlag_Decodable;
|
||||
subghz->ignore_filter = 0x0;
|
||||
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
|
||||
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);
|
||||
|
||||
|
|
|
@ -89,13 +89,10 @@ struct SubGhz {
|
|||
SubGhzLastSettings* last_settings;
|
||||
|
||||
SubGhzProtocolFlag filter;
|
||||
SubGhzProtocolFlag ignore_filter;
|
||||
FuriString* error_str;
|
||||
SubGhzLock lock;
|
||||
|
||||
bool ignore_starline;
|
||||
bool ignore_auto_alarms;
|
||||
bool ignore_magellan;
|
||||
|
||||
SecureData* secure_data;
|
||||
|
||||
SubGhzFileEncoderWorker* decode_raw_file_worker_encoder;
|
||||
|
|
|
@ -119,7 +119,6 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
|||
|
||||
instance->timestamp_file_names = temp_timestamp_file_names;
|
||||
|
||||
// Set globally
|
||||
if(instance->external_module_power_5v_disable) {
|
||||
furi_hal_subghz_set_external_power_disable(true);
|
||||
furi_hal_subghz_disable_ext_power();
|
||||
|
|
|
@ -2804,6 +2804,7 @@ Function,+,subghz_receiver_search_decoder_base_by_name,SubGhzProtocolDecoderBase
|
|||
Function,+,subghz_receiver_set_filter,void,"SubGhzReceiver*, SubGhzProtocolFlag"
|
||||
Function,+,subghz_receiver_set_rx_callback,void,"SubGhzReceiver*, SubGhzReceiverCallback, void*"
|
||||
Function,+,subghz_setting_alloc,SubGhzSetting*,
|
||||
Function,-,subghz_setting_customs_presets_to_log,uint8_t,SubGhzSetting*
|
||||
Function,+,subghz_setting_delete_custom_preset,_Bool,"SubGhzSetting*, const char*"
|
||||
Function,+,subghz_setting_free,void,SubGhzSetting*
|
||||
Function,+,subghz_setting_get_default_frequency,uint32_t,SubGhzSetting*
|
||||
|
|
|
|
@ -63,7 +63,8 @@ const SubGhzProtocolEncoder subghz_protocol_kia_encoder = {
|
|||
const SubGhzProtocol subghz_protocol_kia = {
|
||||
.name = SUBGHZ_PROTOCOL_KIA_NAME,
|
||||
.type = SubGhzProtocolTypeDynamic,
|
||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable,
|
||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable |
|
||||
SubGhzProtocolFlag_AutoAlarms,
|
||||
|
||||
.decoder = &subghz_protocol_kia_decoder,
|
||||
.encoder = &subghz_protocol_kia_encoder,
|
||||
|
|
|
@ -64,7 +64,8 @@ const SubGhzProtocol subghz_protocol_magellan = {
|
|||
.name = SUBGHZ_PROTOCOL_MAGELLAN_NAME,
|
||||
.type = SubGhzProtocolTypeStatic,
|
||||
.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,
|
||||
.encoder = &subghz_protocol_magellan_encoder,
|
||||
|
|
|
@ -70,7 +70,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = {
|
|||
.name = SUBGHZ_PROTOCOL_SCHER_KHAN_NAME,
|
||||
.type = SubGhzProtocolTypeDynamic,
|
||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable |
|
||||
SubGhzProtocolFlag_Save,
|
||||
SubGhzProtocolFlag_Save | SubGhzProtocolFlag_AutoAlarms,
|
||||
|
||||
.decoder = &subghz_protocol_scher_khan_decoder,
|
||||
.encoder = &subghz_protocol_scher_khan_encoder,
|
||||
|
|
|
@ -79,7 +79,8 @@ const SubGhzProtocol subghz_protocol_star_line = {
|
|||
.name = SUBGHZ_PROTOCOL_STAR_LINE_NAME,
|
||||
.type = SubGhzProtocolTypeDynamic,
|
||||
.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,
|
||||
.encoder = &subghz_protocol_star_line_encoder,
|
||||
|
|
|
@ -482,3 +482,35 @@ uint32_t subghz_setting_get_default_frequency(SubGhzSetting* instance) {
|
|||
return subghz_setting_get_frequency(
|
||||
instance, subghz_setting_get_frequency_default_index(instance));
|
||||
}
|
||||
|
||||
uint8_t subghz_setting_customs_presets_to_log(SubGhzSetting* instance) {
|
||||
furi_assert(instance);
|
||||
#ifndef FURI_DEBUG
|
||||
FURI_LOG_I(TAG, "Logging loaded presets allow only Debug build");
|
||||
#else
|
||||
uint8_t count = 0;
|
||||
FuriString* temp = furi_string_alloc();
|
||||
|
||||
FURI_LOG_I(TAG, "Loaded presets");
|
||||
for
|
||||
M_EACH(item, instance->preset->data, SubGhzSettingCustomPresetItemArray_t) {
|
||||
furi_string_reset(temp);
|
||||
|
||||
for(uint8_t i = 0; i < item->custom_preset_data_size; i++) {
|
||||
furi_string_cat_printf(temp, "%02u ", item->custom_preset_data[i]);
|
||||
}
|
||||
|
||||
FURI_LOG_I(
|
||||
TAG, "%u - %s", count + 1, furi_string_get_cstr(item->custom_preset_name));
|
||||
FURI_LOG_I(TAG, " Size: %u", item->custom_preset_data_size);
|
||||
FURI_LOG_I(TAG, " Data: %s", furi_string_get_cstr(temp));
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
furi_string_free(temp);
|
||||
|
||||
return count;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ uint32_t subghz_setting_get_default_frequency(SubGhzSetting* instance);
|
|||
|
||||
void subghz_setting_set_default_frequency(SubGhzSetting* instance, uint32_t frequency_to_setup);
|
||||
|
||||
uint8_t subghz_setting_customs_presets_to_log(SubGhzSetting* instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -117,6 +117,9 @@ typedef enum {
|
|||
SubGhzProtocolFlag_Load = (1 << 8),
|
||||
SubGhzProtocolFlag_Send = (1 << 9),
|
||||
SubGhzProtocolFlag_BinRAW = (1 << 10),
|
||||
SubGhzProtocolFlag_StarLine = (1 << 11),
|
||||
SubGhzProtocolFlag_AutoAlarms = (1 << 12),
|
||||
SubGhzProtocolFlag_Magelan = (1 << 13),
|
||||
} SubGhzProtocolFlag;
|
||||
|
||||
struct SubGhzProtocol {
|
||||
|
|
Loading…
Reference in a new issue