mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-15 16:52:38 +03:00
Update subghz_scene_set_seed.c
This commit is contained in:
parent
77a1a58d67
commit
7218f6023b
@ -32,6 +32,7 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
bool generated_protocol = false;
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventByteInputDone) {
|
||||
|
||||
uint32_t fix_part = subghz->txrx->secure_data->fix[0] << 24 | subghz->txrx->secure_data->fix[1] << 16 |
|
||||
subghz->txrx->secure_data->fix[2] << 8 | subghz->txrx->secure_data->fix[3];
|
||||
FURI_LOG_I(TAG, "fix: %8X", fix_part);
|
||||
@ -40,6 +41,7 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
uint32_t seed = subghz->txrx->secure_data->seed[0] << 24 | subghz->txrx->secure_data->seed[1] << 16 |
|
||||
subghz->txrx->secure_data->seed[2] << 8 | subghz->txrx->secure_data->seed[3];
|
||||
FURI_LOG_I(TAG, "seed: %8X", seed);
|
||||
|
||||
subghz->txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(subghz->txrx->environment, "Faac SLH");
|
||||
if(subghz->txrx->transmitter) {
|
||||
@ -53,20 +55,28 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
"FAAC_SLH",
|
||||
868350000,
|
||||
FuriHalSubGhzPresetOok650Async);
|
||||
|
||||
|
||||
subghz->txrx->decoder_result =
|
||||
subghz_protocol_decoder_faac_slh_alloc(subghz->txrx->environment);
|
||||
if(subghz->txrx->decoder_result) {
|
||||
subghz_protocol_faac_slh_set_seed_to_decoder(subghz->txrx->transmitter->protocol_instance, seed);
|
||||
|
||||
}
|
||||
|
||||
uint8_t seed_data[sizeof(uint32_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint32_t); i++) {
|
||||
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
|
||||
}
|
||||
|
||||
flipper_format_write_hex(subghz->txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
|
||||
FURI_LOG_I(TAG, "SEED: %8X\n", seed);
|
||||
|
||||
generated_protocol = true;
|
||||
} else {
|
||||
generated_protocol = false;
|
||||
}
|
||||
|
||||
subghz_transmitter_free(subghz->txrx->transmitter);
|
||||
|
||||
if(!generated_protocol) {
|
||||
string_set(
|
||||
subghz->error_str, "Function requires\nan SD card with\nfresh databases.");
|
||||
@ -74,6 +84,7 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
if(generated_protocol) {
|
||||
subghz_file_name_clear(subghz);
|
||||
DOLPHIN_DEED(DolphinDeedSubGhzAddManually);
|
||||
|
Loading…
Reference in New Issue
Block a user