This commit is contained in:
Willy-JL
2023-08-27 22:14:33 +02:00
229 changed files with 1352 additions and 894 deletions

View File

@@ -336,7 +336,6 @@ static void subghz_txrx_tx_stop(SubGhzTxRx* instance) {
}
subghz_txrx_idle(instance);
subghz_txrx_speaker_off(instance);
//Todo: Show message
}
FlipperFormat* subghz_txrx_get_fff_data(SubGhzTxRx* instance) {
@@ -629,13 +628,16 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance) {
return subghz_devices_get_name(instance->radio_device);
}
bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency) {
bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t frequency) {
furi_assert(instance);
return subghz_devices_is_frequency_valid(instance->radio_device, frequency);
}
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency) {
bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequency) {
// TODO: Remake this function to check if the frequency is allowed on specific module - for modules not based on CC1101
furi_assert(instance);
UNUSED(frequency);
/*
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
subghz_devices_idle(instance->radio_device);
@@ -645,6 +647,8 @@ bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t freque
subghz_devices_idle(instance->radio_device);
return ret;
*/
return true;
}
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) {

View File

@@ -334,9 +334,9 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance);
* @param instance Pointer to a SubGhzTxRx
* @return bool True if the frequency is valid
*/
bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency);
bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t frequency);
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency);
bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequency);
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);

View File

@@ -30,7 +30,7 @@ bool subghz_txrx_gen_data_protocol(
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_name);
if(instance->decoder_result == NULL) {
//TODO: Error
//TODO FL-3502: Error
// furi_string_set(error_str, "Protocol not\nfound!");
// scene_manager_next_scene(scene_manager, SubGhzSceneShowErrorSub);
FURI_LOG_E(TAG, "Protocol not found!");
@@ -199,7 +199,7 @@ bool subghz_txrx_gen_faac_slh_protocol(
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t cnt,
uint32_t seed,
const char* manufacture_name) {
SubGhzTxRx* txrx = context;

View File

@@ -88,7 +88,7 @@ bool subghz_txrx_gen_faac_slh_protocol(
uint32_t frequency,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t cnt,
uint32_t seed,
const char* manufacture_name);

View File

@@ -25,7 +25,7 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {
if(subghz_txrx_load_decoder_by_name_protocol(
subghz->txrx,
subghz_history_get_protocol_name(subghz->history, subghz->idx_menu_chosen))) {
//todo we are trying to deserialize without checking for errors, since it is assumed that we just received this signal
// we are trying to deserialize without checking for errors, since it is assumed that we just received this chignal
subghz_protocol_decoder_base_deserialize(
subghz_txrx_get_decoder(subghz->txrx),
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen));

View File

@@ -45,6 +45,13 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
seed = subghz->secure_data->seed[0] << 24 | subghz->secure_data->seed[1] << 16 |
subghz->secure_data->seed[2] << 8 | subghz->secure_data->seed[3];
if(seed == 0) {
furi_string_set(subghz->error_str, "Seed value\ncan not be 0.");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
consumed = true;
break;
}
generated_protocol = subghz_txrx_gen_keeloq_bft_protocol(
subghz->txrx,
"AM650",
@@ -73,6 +80,12 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
seed = subghz->secure_data->seed[0] << 24 | subghz->secure_data->seed[1] << 16 |
subghz->secure_data->seed[2] << 8 | subghz->secure_data->seed[3];
if(seed == 0) {
furi_string_set(subghz->error_str, "Seed value\ncan not be 0.");
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
consumed = true;
break;
}
if(state == SubmenuIndexFaacSLH_433) {
generated_protocol = subghz_txrx_gen_faac_slh_protocol(
subghz->txrx,
@@ -108,8 +121,14 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
}
}
// Reset Seed, Fix, Cnt in secure data after successful or unsuccessful generation
memset(subghz->secure_data->seed, 0, sizeof(subghz->secure_data->seed));
memset(subghz->secure_data->cnt, 0, sizeof(subghz->secure_data->cnt));
memset(subghz->secure_data->fix, 0, sizeof(subghz->secure_data->fix));
if(generated_protocol) {
subghz_file_name_clear(subghz);
scene_manager_set_scene_state(
subghz->scene_manager, SubGhzSceneSetType, SubGhzCustomEventManagerSet);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);

View File

@@ -611,7 +611,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
break;
case SubmenuIndexSomfyTelis:
generated_protocol = subghz_txrx_gen_somfy_telis_protocol(
subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003);
subghz->txrx, "AM650", 433420000, key & 0x00FFFFFF, 0x2, 0x0003);
break;
case SubmenuIndexDoorHan_433_92:
generated_protocol = subghz_txrx_gen_keeloq_protocol(

View File

@@ -115,14 +115,15 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
break;
}
if(!subghz_txrx_radio_device_is_frequecy_valid(subghz->txrx, temp_data32)) {
if(!subghz_txrx_radio_device_is_frequency_valid(subghz->txrx, temp_data32)) {
FURI_LOG_E(TAG, "Frequency not supported on chosen radio module");
load_key_state = SubGhzLoadKeyStateUnsuportedFreq;
break;
}
if(!subghz_txrx_radio_device_is_tx_alowed(subghz->txrx, temp_data32)) {
FURI_LOG_E(TAG, "This frequency can only be used for RX on chosen radio module");
// TODO: use different frequency allowed lists for differnet modules (non cc1101)
if(!furi_hal_subghz_is_tx_allowed(temp_data32)) {
FURI_LOG_E(TAG, "This frequency can only be used for RX");
load_key_state = SubGhzLoadKeyStateOnlyRx;
break;
}
@@ -141,7 +142,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
if(!strcmp(furi_string_get_cstr(temp_str), "CUSTOM")) {
//Todo add Custom_preset_module
//TODO FL-3551: add Custom_preset_module
//delete preset if it already exists
subghz_setting_delete_custom_preset(setting, furi_string_get_cstr(temp_str));
//load custom preset from file
@@ -308,10 +309,14 @@ bool subghz_save_protocol_to_file(
if(!storage_simply_remove(storage, dev_file_name)) {
break;
}
//ToDo check Write
stream_seek(flipper_format_stream, 0, StreamOffsetFromStart);
stream_save_to_file(flipper_format_stream, storage, dev_file_name, FSOM_CREATE_ALWAYS);
if(storage_common_stat(storage, dev_file_name, NULL) != FSE_OK) {
break;
}
saved = true;
} while(0);
furi_string_free(file_dir);

View File

@@ -315,7 +315,7 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
uint32_t frequency_candidate = model->history_frequency[model->selected_index];
if(frequency_candidate == 0 ||
// !furi_hal_subghz_is_frequency_valid(frequency_candidate) ||
!subghz_txrx_radio_device_is_frequecy_valid(
!subghz_txrx_radio_device_is_frequency_valid(
instance->txrx, frequency_candidate) ||
prev_freq_to_save == frequency_candidate) {
frequency_candidate = 0;
@@ -339,7 +339,7 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
uint32_t frequency_candidate = subghz_frequency_find_correct(model->frequency);
if(frequency_candidate == 0 ||
// !furi_hal_subghz_is_frequency_valid(frequency_candidate) ||
!subghz_txrx_radio_device_is_frequecy_valid(
!subghz_txrx_radio_device_is_frequency_valid(
instance->txrx, frequency_candidate) ||
prev_freq_to_save == frequency_candidate) {
frequency_candidate = 0;
@@ -356,7 +356,7 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
uint32_t frequency_candidate = subghz_frequency_find_correct(model->frequency);
if(frequency_candidate == 0 ||
// !furi_hal_subghz_is_frequency_valid(frequency_candidate) ||
!subghz_txrx_radio_device_is_frequecy_valid(
!subghz_txrx_radio_device_is_frequency_valid(
instance->txrx, frequency_candidate) ||
prev_freq_to_save == frequency_candidate) {
frequency_candidate = 0;