mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
SubGhz: fix syntax & minor fixes
This commit is contained in:
@@ -49,7 +49,7 @@ bool subghz_scene_need_saving_on_event(void* context, SceneManagerEvent event) {
|
||||
SubGhzRxKeyState state = subghz_rx_key_state_get(subghz);
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
||||
|
||||
if(state) {
|
||||
if(state == SubGhzRxKeyStateExit) {
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx, "AM650", subghz->last_settings->frequency, NULL, 0);
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
|
||||
@@ -125,6 +125,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SubGhzCustomEventViewReadRAWBack:
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
//Stop save file
|
||||
subghz_protocol_raw_save_to_file_stop(decoder_raw);
|
||||
@@ -204,8 +205,6 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
if(subghz_file_available(subghz) && subghz_scene_read_raw_update_filename(subghz)) {
|
||||
//start send
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
if(!subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateBack);
|
||||
subghz_read_raw_set_status(
|
||||
@@ -273,7 +272,6 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
if(subghz_protocol_raw_save_to_file_init(decoder_raw, RAW_FILE_NAME, &preset)) {
|
||||
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
||||
} else {
|
||||
@@ -316,7 +314,6 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
subghz_read_raw_add_data_rssi(
|
||||
subghz->subghz_read_raw, ret_rssi.rssi, ret_rssi.is_above);
|
||||
subghz_protocol_raw_save_to_file_pause(decoder_raw, !ret_rssi.is_above);
|
||||
|
||||
break;
|
||||
case SubGhzNotificationStateTx:
|
||||
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
||||
|
||||
@@ -184,7 +184,6 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
}
|
||||
|
||||
subghz->state_notifications = SubGhzNotificationStateRx;
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->idx_menu_chosen);
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ const char* const magellan_text[MAGELLAN_COUNT] = {
|
||||
uint8_t subghz_scene_receiver_config_next_frequency(const uint32_t value, void* context) {
|
||||
furi_assert(context);
|
||||
SubGhz* subghz = context;
|
||||
uint8_t index = 0;
|
||||
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
|
||||
|
||||
uint8_t index = 0;
|
||||
for(uint8_t i = 0; i < subghz_setting_get_frequency_count(setting); i++) {
|
||||
if(value == subghz_setting_get_frequency(setting, i)) {
|
||||
index = i;
|
||||
@@ -186,7 +186,6 @@ static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
|
||||
variable_item_set_current_value_text(item, preset_name);
|
||||
//subghz->last_settings->preset = index;
|
||||
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
|
||||
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
preset_name,
|
||||
@@ -309,12 +308,13 @@ void subghz_scene_receiver_config_on_enter(void* context) {
|
||||
subghz->scene_manager, SubGhzSceneReceiverConfig, (uint32_t)item);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
char text_buf[10] = {0};
|
||||
uint32_t frequency = subghz_setting_get_frequency(setting, value_index);
|
||||
snprintf(
|
||||
text_buf,
|
||||
sizeof(text_buf),
|
||||
"%lu.%02lu",
|
||||
subghz_setting_get_frequency(setting, value_index) / 1000000,
|
||||
(subghz_setting_get_frequency(setting, value_index) % 1000000) / 10000);
|
||||
frequency / 1000000,
|
||||
(frequency % 1000000) / 10000);
|
||||
variable_item_set_current_value_text(item, text_buf);
|
||||
|
||||
item = variable_item_list_add(
|
||||
|
||||
@@ -52,7 +52,8 @@ void subghz_scene_receiver_info_draw_widget(SubGhz* subghz) {
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
FuriString* text = furi_string_alloc();
|
||||
|
||||
subghz_txrx_get_frequency_and_modulation(subghz->txrx, frequency_str, modulation_str, false);
|
||||
subghz_txrx_get_frequency_and_modulation(
|
||||
subghz->txrx, frequency_str, modulation_str, false);
|
||||
widget_add_string_element(
|
||||
subghz->widget,
|
||||
78,
|
||||
@@ -120,7 +121,6 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
if(!subghz_scene_receiver_info_update_parser(subghz)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//CC1101 Stop RX -> Start TX
|
||||
subghz_txrx_hopper_pause(subghz->txrx);
|
||||
if(!subghz_tx_start(
|
||||
@@ -140,7 +140,7 @@ bool subghz_scene_receiver_info_on_event(void* context, SceneManagerEvent event)
|
||||
widget_reset(subghz->widget);
|
||||
subghz_scene_receiver_info_draw_widget(subghz);
|
||||
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_txrx_stop(subghz->txrx); //TODO this is probably a redundant call
|
||||
if(!subghz->in_decoder_scene) {
|
||||
subghz_txrx_rx_start(subghz->txrx);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ void subghz_scene_saved_on_enter(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
if(subghz_load_protocol_from_file(subghz)) {
|
||||
if((subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw)) {
|
||||
if(subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw) {
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
|
||||
} else {
|
||||
|
||||
@@ -81,7 +81,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
||||
uint8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
// Calling restore!
|
||||
subghz_txrx_stop(subghz->txrx);
|
||||
subghz_txrx_stop(subghz->txrx); //TODO this is probably a redundant call
|
||||
|
||||
if(!subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx))) {
|
||||
scene_manager_next_scene(
|
||||
|
||||
@@ -428,7 +428,7 @@ int32_t subghz_app(void* p) {
|
||||
if(subghz_key_load(subghz, p, true)) {
|
||||
furi_string_set(subghz->file_path, (const char*)p);
|
||||
|
||||
if((subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw)) {
|
||||
if(subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw) {
|
||||
//Load Raw TX
|
||||
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
|
||||
|
||||
@@ -133,30 +133,27 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
if(!strcmp(furi_string_get_cstr(temp_str), "")) {
|
||||
break;
|
||||
}
|
||||
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
|
||||
|
||||
if(!strcmp(furi_string_get_cstr(temp_str), "CUSTOM")) {
|
||||
//Todo add Custom_preset_module
|
||||
//delete preset if it already exists
|
||||
subghz_setting_delete_custom_preset(
|
||||
subghz_txrx_get_setting(subghz->txrx), furi_string_get_cstr(temp_str));
|
||||
subghz_setting_delete_custom_preset(setting, furi_string_get_cstr(temp_str));
|
||||
//load custom preset from file
|
||||
if(!subghz_setting_load_custom_preset(
|
||||
subghz_txrx_get_setting(subghz->txrx),
|
||||
furi_string_get_cstr(temp_str),
|
||||
fff_data_file)) {
|
||||
setting, furi_string_get_cstr(temp_str), fff_data_file)) {
|
||||
FURI_LOG_E(TAG, "Missing Custom preset");
|
||||
break;
|
||||
}
|
||||
}
|
||||
size_t preset_index = subghz_setting_get_inx_preset_by_name(
|
||||
subghz_txrx_get_setting(subghz->txrx), furi_string_get_cstr(temp_str));
|
||||
size_t preset_index =
|
||||
subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str));
|
||||
subghz_txrx_set_preset(
|
||||
subghz->txrx,
|
||||
furi_string_get_cstr(temp_str),
|
||||
temp_data32,
|
||||
subghz_setting_get_preset_data(subghz_txrx_get_setting(subghz->txrx), preset_index),
|
||||
subghz_setting_get_preset_data_size(
|
||||
subghz_txrx_get_setting(subghz->txrx), preset_index));
|
||||
subghz_setting_get_preset_data(setting, preset_index),
|
||||
subghz_setting_get_preset_data_size(setting, preset_index));
|
||||
|
||||
//Load protocol
|
||||
if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) {
|
||||
|
||||
Reference in New Issue
Block a user