Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-11-11 15:49:19 +0300
committerGitHub <noreply@github.com>2021-11-11 15:49:19 +0300
commitac8b1457f27412ddd0aac065a7babc7818d5bb78 (patch)
tree96fbd8da8b0aed4690257b57c3c462afa0a3a619 /applications/subghz/scenes
parent5209701add1fd6b9aaea387beb5b99fcb3b8afe5 (diff)
[FL-1931, FL-2005] SubGhz: migration in flipper file format (#807)
* SubGhz: add save key in flipper file format * [FL-2005] SubGhz: fix stored signals cannot be deleted * SubGhz: add load key in flipper file format * SubGhz: fix syntax * SubGhz: fix bad file upload * Storage: add function to get the next free filename * SubGhz: add save RAW in flipper file format * SubGhz: add load RAW in flipper file format * SubGhz: refactoring protocol * SubGhz: refactoring scene * SubGhz: fix SubGhzNotificationState define * Makefile: proper comapre for FORCE Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/subghz/scenes')
-rw-r--r--applications/subghz/scenes/subghz_scene_delete.c44
-rw-r--r--applications/subghz/scenes/subghz_scene_read_raw.c53
-rw-r--r--applications/subghz/scenes/subghz_scene_receiver.c44
-rw-r--r--applications/subghz/scenes/subghz_scene_receiver_info.c65
-rw-r--r--applications/subghz/scenes/subghz_scene_save_name.c2
-rw-r--r--applications/subghz/scenes/subghz_scene_start.c4
-rw-r--r--applications/subghz/scenes/subghz_scene_transmitter.c45
7 files changed, 122 insertions, 135 deletions
diff --git a/applications/subghz/scenes/subghz_scene_delete.c b/applications/subghz/scenes/subghz_scene_delete.c
index e79e3a6d..eb8a2217 100644
--- a/applications/subghz/scenes/subghz_scene_delete.c
+++ b/applications/subghz/scenes/subghz_scene_delete.c
@@ -11,33 +11,33 @@ void subghz_scene_delete_callback(GuiButtonType result, InputType type, void* co
void subghz_scene_delete_on_enter(void* context) {
SubGhz* subghz = context;
+ string_t frequency_str;
+ string_t modulation_str;
+ string_t text;
+
+ string_init(frequency_str);
+ string_init(modulation_str);
+ string_init(text);
- char buffer_str[16];
- snprintf(
- buffer_str,
- sizeof(buffer_str),
- "%03ld.%02ld",
- subghz->txrx->frequency / 1000000 % 1000,
- subghz->txrx->frequency / 10000 % 100);
+ subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
widget_add_string_element(
- subghz->widget, 78, 0, AlignLeft, AlignTop, FontSecondary, buffer_str);
- if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
- subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
- snprintf(buffer_str, sizeof(buffer_str), "AM");
- } else if(
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
- snprintf(buffer_str, sizeof(buffer_str), "FM");
- } else {
- furi_crash(NULL);
- }
+ subghz->widget, 78, 0, AlignLeft, AlignTop, FontSecondary, string_get_cstr(frequency_str));
+
widget_add_string_element(
- subghz->widget, 113, 0, AlignLeft, AlignTop, FontSecondary, buffer_str);
- string_t text;
- string_init(text);
+ subghz->widget,
+ 113,
+ 0,
+ AlignLeft,
+ AlignTop,
+ FontSecondary,
+ string_get_cstr(modulation_str));
+
subghz->txrx->protocol_result->to_string(subghz->txrx->protocol_result, text);
widget_add_string_multiline_element(
subghz->widget, 0, 0, AlignLeft, AlignTop, FontSecondary, string_get_cstr(text));
+
+ string_clear(frequency_str);
+ string_clear(modulation_str);
string_clear(text);
widget_add_button_element(
@@ -50,7 +50,7 @@ bool subghz_scene_delete_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubghzCustomEventSceneDelete) {
- memcpy(subghz->file_name_tmp, subghz->file_name, strlen(subghz->file_name));
+ memcpy(subghz->file_name_tmp, subghz->file_name, strlen(subghz->file_name) + 1);
if(subghz_delete_file(subghz)) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneDeleteSuccess);
} else {
diff --git a/applications/subghz/scenes/subghz_scene_read_raw.c b/applications/subghz/scenes/subghz_scene_read_raw.c
index 6d4a72d1..7bf5576e 100644
--- a/applications/subghz/scenes/subghz_scene_read_raw.c
+++ b/applications/subghz/scenes/subghz_scene_read_raw.c
@@ -6,27 +6,19 @@
static void subghz_scene_read_raw_update_statusbar(void* context) {
furi_assert(context);
SubGhz* subghz = context;
- char frequency_str[20];
- char preset_str[10];
-
- snprintf(
- frequency_str,
- sizeof(frequency_str),
- "%03ld.%02ld",
- subghz->txrx->frequency / 1000000 % 1000,
- subghz->txrx->frequency / 10000 % 100);
- if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
- subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
- snprintf(preset_str, sizeof(preset_str), "AM");
- } else if(
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
- snprintf(preset_str, sizeof(preset_str), "FM");
- } else {
- furi_crash(NULL);
- }
- subghz_read_raw_add_data_statusbar(subghz->subghz_read_raw, frequency_str, preset_str);
+ string_t frequency_str;
+ string_t modulation_str;
+
+ string_init(frequency_str);
+ string_init(modulation_str);
+
+ subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
+ subghz_read_raw_add_data_statusbar(
+ subghz->subghz_read_raw, string_get_cstr(frequency_str), string_get_cstr(modulation_str));
+
+ string_clear(frequency_str);
+ string_clear(modulation_str);
}
void subghz_scene_read_raw_callback(SubghzCustomEvent event, void* context) {
@@ -70,7 +62,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result);
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateAddKey) {
subghz->txrx->rx_key_state = SubGhzRxKeyStateExit;
@@ -95,7 +87,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
};
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result);
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
@@ -106,17 +98,18 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
if(subghz->txrx->rx_key_state != SubGhzRxKeyStateIDLE) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
} else {
+ subghz_get_preset_name(subghz, subghz->error_str);
if(subghz_protocol_raw_save_to_file_init(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result,
"Raw_temp",
subghz->txrx->frequency,
- subghz->txrx->preset)) {
+ string_get_cstr(subghz->error_str))) {
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
subghz_begin(subghz, subghz->txrx->preset);
subghz_rx(subghz, subghz->txrx->frequency);
}
- subghz->state_notifications = NOTIFICATION_RX_STATE;
+ subghz->state_notifications = SubGhzNotificationStateRX;
} else {
string_set(subghz->error_str, "No SD card");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
@@ -127,14 +120,14 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
break;
case SubghzCustomEventViewReadRAWMore:
if(strcmp(
- subghz_protocol_get_last_file_name(
+ subghz_protocol_raw_get_last_file_name(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result),
"")) {
strlcpy(
subghz->file_name,
- subghz_protocol_get_last_file_name(
+ subghz_protocol_raw_get_last_file_name(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result),
- strlen(subghz_protocol_get_last_file_name(
+ strlen(subghz_protocol_raw_get_last_file_name(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result)) +
1);
//set the path to read the file
@@ -145,7 +138,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
SUBGHZ_APP_PATH_FOLDER,
subghz->file_name,
SUBGHZ_APP_EXTENSION);
- subghz_protocol_set_last_file_name(
+ subghz_protocol_raw_set_last_file_name(
(SubGhzProtocolRAW*)subghz->txrx->protocol_result, string_get_cstr(temp_str));
string_clear(temp_str);
@@ -159,7 +152,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
}
} else if(event.type == SceneManagerEventTypeTick) {
switch(subghz->state_notifications) {
- case NOTIFICATION_RX_STATE:
+ case SubGhzNotificationStateRX:
notification_message(subghz->notifications, &sequence_blink_blue_10);
subghz_read_raw_update_sample_write(
subghz->subghz_read_raw,
@@ -182,7 +175,7 @@ void subghz_scene_read_raw_on_exit(void* context) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
};
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
//Сallback restoration
subghz_worker_set_pair_callback(
diff --git a/applications/subghz/scenes/subghz_scene_receiver.c b/applications/subghz/scenes/subghz_scene_receiver.c
index 107381c2..4e8a953f 100644
--- a/applications/subghz/scenes/subghz_scene_receiver.c
+++ b/applications/subghz/scenes/subghz_scene_receiver.c
@@ -3,33 +3,29 @@
static void subghz_scene_receiver_update_statusbar(void* context) {
SubGhz* subghz = context;
- char frequency_str[20];
- char preset_str[10];
string_t history_stat_str;
string_init(history_stat_str);
if(!subghz_history_get_text_space_left(subghz->txrx->history, history_stat_str)) {
- snprintf(
- frequency_str,
- sizeof(frequency_str),
- "%03ld.%02ld",
- subghz->txrx->frequency / 1000000 % 1000,
- subghz->txrx->frequency / 10000 % 100);
- if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
- subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
- snprintf(preset_str, sizeof(preset_str), "AM");
- } else if(
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
- snprintf(preset_str, sizeof(preset_str), "FM");
- } else {
- furi_crash(NULL);
- }
+ string_t frequency_str;
+ string_t modulation_str;
+
+ string_init(frequency_str);
+ string_init(modulation_str);
+
+ subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
+
subghz_receiver_add_data_statusbar(
- subghz->subghz_receiver, frequency_str, preset_str, string_get_cstr(history_stat_str));
+ subghz->subghz_receiver,
+ string_get_cstr(frequency_str),
+ string_get_cstr(modulation_str),
+ string_get_cstr(history_stat_str));
+
+ string_clear(frequency_str);
+ string_clear(modulation_str);
} else {
subghz_receiver_add_data_statusbar(
subghz->subghz_receiver, string_get_cstr(history_stat_str), "", "");
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
}
string_clear(history_stat_str);
}
@@ -83,7 +79,7 @@ void subghz_scene_receiver_on_enter(void* context) {
subghz_receiver_set_callback(subghz->subghz_receiver, subghz_scene_receiver_callback, subghz);
subghz_parser_enable_dump(subghz->txrx->parser, subghz_scene_add_to_history_callback, subghz);
- subghz->state_notifications = NOTIFICATION_RX_STATE;
+ subghz->state_notifications = SubGhzNotificationStateRX;
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
};
@@ -104,7 +100,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
switch(event.event) {
case SubghzCustomEventViewReceverBack:
// Stop CC1101 Rx
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
@@ -125,7 +121,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
return true;
break;
case SubghzCustomEventViewReceverConfig:
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
subghz->txrx->idx_menu_chosen = subghz_receiver_get_idx_menu(subghz->subghz_receiver);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig);
return true;
@@ -140,7 +136,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
}
switch(subghz->state_notifications) {
- case NOTIFICATION_RX_STATE:
+ case SubGhzNotificationStateRX:
notification_message(subghz->notifications, &sequence_blink_blue_10);
break;
default:
diff --git a/applications/subghz/scenes/subghz_scene_receiver_info.c b/applications/subghz/scenes/subghz_scene_receiver_info.c
index 1e9f100a..a8935a1c 100644
--- a/applications/subghz/scenes/subghz_scene_receiver_info.c
+++ b/applications/subghz/scenes/subghz_scene_receiver_info.c
@@ -40,35 +40,42 @@ void subghz_scene_receiver_info_on_enter(void* context) {
SubGhz* subghz = context;
if(subghz_scene_receiver_info_update_parser(subghz)) {
- char buffer_str[16];
- snprintf(
- buffer_str,
- sizeof(buffer_str),
- "%03ld.%02ld",
- subghz->txrx->frequency / 1000000 % 1000,
- subghz->txrx->frequency / 10000 % 100);
- widget_add_string_element(
- subghz->widget, 78, 0, AlignLeft, AlignTop, FontSecondary, buffer_str);
- if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
- subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
- snprintf(buffer_str, sizeof(buffer_str), "AM");
- } else if(
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
- snprintf(buffer_str, sizeof(buffer_str), "FM");
- } else {
- furi_crash(NULL);
- }
- widget_add_string_element(
- subghz->widget, 113, 0, AlignLeft, AlignTop, FontSecondary, buffer_str);
+ string_t frequency_str;
+ string_t modulation_str;
string_t text;
+
+ string_init(frequency_str);
+ string_init(modulation_str);
string_init(text);
+
+ subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
+ widget_add_string_element(
+ subghz->widget,
+ 78,
+ 0,
+ AlignLeft,
+ AlignTop,
+ FontSecondary,
+ string_get_cstr(frequency_str));
+
+ widget_add_string_element(
+ subghz->widget,
+ 113,
+ 0,
+ AlignLeft,
+ AlignTop,
+ FontSecondary,
+ string_get_cstr(modulation_str));
+
subghz->txrx->protocol_result->to_string(subghz->txrx->protocol_result, text);
widget_add_string_multiline_element(
subghz->widget, 0, 0, AlignLeft, AlignTop, FontSecondary, string_get_cstr(text));
+
+ string_clear(frequency_str);
+ string_clear(modulation_str);
string_clear(text);
- if(subghz->txrx->protocol_result && subghz->txrx->protocol_result->to_save_string &&
+ if(subghz->txrx->protocol_result && subghz->txrx->protocol_result->to_save_file &&
strcmp(subghz->txrx->protocol_result->name, "KeeLoq")) {
widget_add_button_element(
subghz->widget,
@@ -112,13 +119,13 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
if(!subghz_tx_start(subghz)) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowOnlyRx);
} else {
- subghz->state_notifications = NOTIFICATION_TX_STATE;
+ subghz->state_notifications = SubGhzNotificationStateTX;
}
}
return true;
} else if(event.event == SubghzCustomEventSceneReceiverInfoTxStop) {
//CC1101 Stop Tx -> Start RX
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
subghz_tx_stop(subghz);
}
@@ -129,11 +136,11 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
if(subghz->txrx->hopper_state == SubGhzHopperStatePause) {
subghz->txrx->hopper_state = SubGhzHopperStateRunnig;
}
- subghz->state_notifications = NOTIFICATION_RX_STATE;
+ subghz->state_notifications = SubGhzNotificationStateRX;
return true;
} else if(event.event == SubghzCustomEventSceneReceiverInfoSave) {
//CC1101 Stop RX -> Save
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->hopper_state != SubGhzHopperStateOFF) {
subghz->txrx->hopper_state = SubGhzHopperStateOFF;
}
@@ -144,7 +151,7 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
if(!subghz_scene_receiver_info_update_parser(subghz)) {
return false;
}
- if(subghz->txrx->protocol_result && subghz->txrx->protocol_result->to_save_string &&
+ if(subghz->txrx->protocol_result && subghz->txrx->protocol_result->to_save_file &&
strcmp(subghz->txrx->protocol_result->name, "KeeLoq")) {
subghz_file_name_clear(subghz);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
@@ -156,10 +163,10 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
subghz_hopper_update(subghz);
}
switch(subghz->state_notifications) {
- case NOTIFICATION_TX_STATE:
+ case SubGhzNotificationStateTX:
notification_message(subghz->notifications, &sequence_blink_red_10);
break;
- case NOTIFICATION_RX_STATE:
+ case SubGhzNotificationStateRX:
notification_message(subghz->notifications, &sequence_blink_blue_10);
break;
default:
diff --git a/applications/subghz/scenes/subghz_scene_save_name.c b/applications/subghz/scenes/subghz_scene_save_name.c
index 6cba3240..d448119c 100644
--- a/applications/subghz/scenes/subghz_scene_save_name.c
+++ b/applications/subghz/scenes/subghz_scene_save_name.c
@@ -19,7 +19,7 @@ void subghz_scene_save_name_on_enter(void* context) {
set_random_name(subghz->file_name, sizeof(subghz->file_name));
dev_name_empty = true;
} else {
- memcpy(subghz->file_name_tmp, subghz->file_name, strlen(subghz->file_name));
+ memcpy(subghz->file_name_tmp, subghz->file_name, strlen(subghz->file_name) + 1);
if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAWMenu) ==
SubghzCustomEventManagerSet) {
subghz_get_next_name_file(subghz);
diff --git a/applications/subghz/scenes/subghz_scene_start.c b/applications/subghz/scenes/subghz_scene_start.c
index fe37d7ae..3b5b5cd1 100644
--- a/applications/subghz/scenes/subghz_scene_start.c
+++ b/applications/subghz/scenes/subghz_scene_start.c
@@ -16,8 +16,8 @@ void subghz_scene_start_submenu_callback(void* context, uint32_t index) {
void subghz_scene_start_on_enter(void* context) {
SubGhz* subghz = context;
- if(subghz->state_notifications == NOTIFICATION_STARTING_STATE) {
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ if(subghz->state_notifications == SubGhzNotificationStateStarting) {
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
}
submenu_add_item(
subghz->submenu, "Read", SubmenuIndexRead, subghz_scene_start_submenu_callback, subghz);
diff --git a/applications/subghz/scenes/subghz_scene_transmitter.c b/applications/subghz/scenes/subghz_scene_transmitter.c
index 28d49397..16617589 100644
--- a/applications/subghz/scenes/subghz_scene_transmitter.c
+++ b/applications/subghz/scenes/subghz_scene_transmitter.c
@@ -13,9 +13,12 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
if(subghz->txrx->protocol_result && subghz->txrx->protocol_result->get_upload_protocol) {
string_t key_str;
+ string_t frequency_str;
+ string_t modulation_str;
+
string_init(key_str);
- char frequency_str[10];
- char preset_str[6];
+ string_init(frequency_str);
+ string_init(modulation_str);
uint8_t show_button = 0;
subghz->txrx->protocol_result->to_string(subghz->txrx->protocol_result, key_str);
@@ -27,29 +30,17 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
} else {
show_button = 1;
}
- snprintf(
- frequency_str,
- sizeof(frequency_str),
- "%03ld.%02ld",
- subghz->txrx->frequency / 1000000 % 1000,
- subghz->txrx->frequency / 10000 % 100);
- if(subghz->txrx->preset == FuriHalSubGhzPresetOok650Async ||
- subghz->txrx->preset == FuriHalSubGhzPresetOok270Async) {
- snprintf(preset_str, sizeof(preset_str), "AM");
- } else if(
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev238Async ||
- subghz->txrx->preset == FuriHalSubGhzPreset2FSKDev476Async) {
- snprintf(preset_str, sizeof(preset_str), "FM");
- } else {
- furi_crash(NULL);
- }
+ subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
subghz_transmitter_add_data_to_show(
subghz->subghz_transmitter,
string_get_cstr(key_str),
- frequency_str,
- preset_str,
+ string_get_cstr(frequency_str),
+ string_get_cstr(modulation_str),
show_button);
+
+ string_clear(frequency_str);
+ string_clear(modulation_str);
string_clear(key_str);
return true;
@@ -67,7 +58,7 @@ void subghz_scene_transmitter_on_enter(void* context) {
subghz_transmitter_set_callback(
subghz->subghz_transmitter, subghz_scene_transmitter_callback, subghz);
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewTransmitter);
}
@@ -75,7 +66,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
SubGhz* subghz = context;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubghzCustomEventViewTransmitterSendStart) {
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
}
@@ -84,20 +75,20 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
if(!subghz_tx_start(subghz)) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowOnlyRx);
} else {
- subghz->state_notifications = NOTIFICATION_TX_STATE;
+ subghz->state_notifications = SubGhzNotificationStateTX;
subghz_scene_transmitter_update_data_show(subghz);
}
}
return true;
} else if(event.event == SubghzCustomEventViewTransmitterSendStop) {
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
subghz_tx_stop(subghz);
subghz_sleep(subghz);
}
return true;
} else if(event.event == SubghzCustomEventViewTransmitterBack) {
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
scene_manager_search_and_switch_to_previous_scene(
subghz->scene_manager, SubGhzSceneStart);
return true;
@@ -106,7 +97,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
}
} else if(event.type == SceneManagerEventTypeTick) {
- if(subghz->state_notifications == NOTIFICATION_TX_STATE) {
+ if(subghz->state_notifications == SubGhzNotificationStateTX) {
notification_message(subghz->notifications, &sequence_blink_red_10);
}
return true;
@@ -117,5 +108,5 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
void subghz_scene_transmitter_on_exit(void* context) {
SubGhz* subghz = context;
- subghz->state_notifications = NOTIFICATION_IDLE_STATE;
+ subghz->state_notifications = SubGhzNotificationStateIDLE;
}