mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 17:48:35 -07:00
Merge remote-tracking branch 'origin/feat/subghz-save-hopping-state' into feat/subghz-save-hopping-state
This commit is contained in:
@@ -334,7 +334,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) {
|
||||
@@ -634,8 +633,11 @@ bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t
|
||||
}
|
||||
|
||||
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);
|
||||
//furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
UNUSED(frequency);
|
||||
/*
|
||||
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
|
||||
subghz_devices_idle(instance->radio_device);
|
||||
subghz_devices_set_frequency(instance->radio_device, frequency);
|
||||
@@ -644,6 +646,8 @@ bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequ
|
||||
subghz_devices_idle(instance->radio_device);
|
||||
|
||||
return ret;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -27,7 +27,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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -104,8 +104,10 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!subghz_txrx_radio_device_is_tx_allowed(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;
|
||||
}
|
||||
@@ -124,7 +126,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
|
||||
@@ -291,10 +293,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);
|
||||
|
||||
Reference in New Issue
Block a user