mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
FAAC SLH 0x0 seed new "smart logic"
Comeback
This commit is contained in:
@@ -229,6 +229,8 @@ bool subghz_txrx_gen_faac_slh_protocol(
|
|||||||
}
|
}
|
||||||
|
|
||||||
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
|
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
|
||||||
|
flipper_format_write_string_cstr(txrx->fff_data, "Valid", "1\n");
|
||||||
|
FURI_LOG_I(TAG, "Flag write to SD is OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
subghz_transmitter_free(txrx->transmitter);
|
subghz_transmitter_free(txrx->transmitter);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#define TAG "SubGhzProtocolFaacSLH"
|
#define TAG "SubGhzProtocolFaacSLH"
|
||||||
|
|
||||||
|
bool bvalid;
|
||||||
|
|
||||||
static const SubGhzBlockConst subghz_protocol_faac_slh_const = {
|
static const SubGhzBlockConst subghz_protocol_faac_slh_const = {
|
||||||
.te_short = 255,
|
.te_short = 255,
|
||||||
.te_long = 595,
|
.te_long = 595,
|
||||||
@@ -110,7 +112,14 @@ void subghz_protocol_encoder_faac_slh_free(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* instance) {
|
static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* instance) {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
if(bvalid) {
|
||||||
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
|
FURI_LOG_I(TAG, "[gen_data] TRUE : %i", bvalid);
|
||||||
|
} else {
|
||||||
|
// Do not generate new data, send data from buffer
|
||||||
|
FURI_LOG_I(TAG, "[gen_data] FALSE : %i", bvalid);
|
||||||
|
//return true;
|
||||||
|
}
|
||||||
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
|
uint32_t fix = instance->generic.serial << 4 | instance->generic.btn;
|
||||||
uint32_t hop = 0;
|
uint32_t hop = 0;
|
||||||
uint32_t decrypt = 0;
|
uint32_t decrypt = 0;
|
||||||
@@ -237,6 +246,14 @@ SubGhzProtocolStatus
|
|||||||
FURI_LOG_E(TAG, "Missing Seed");
|
FURI_LOG_E(TAG, "Missing Seed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
FuriString* valid = furi_string_alloc();
|
||||||
|
if(flipper_format_read_string(flipper_format, "Valid", valid)) {
|
||||||
|
bvalid = true;
|
||||||
|
FURI_LOG_I(TAG, "[encoder_des] Valid : %i", bvalid);
|
||||||
|
} else {
|
||||||
|
bvalid = false;
|
||||||
|
}
|
||||||
|
furi_string_free(valid);
|
||||||
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
||||||
seed_data[3];
|
seed_data[3];
|
||||||
|
|
||||||
@@ -481,6 +498,14 @@ SubGhzProtocolStatus
|
|||||||
FURI_LOG_E(TAG, "Missing Seed");
|
FURI_LOG_E(TAG, "Missing Seed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
FuriString* valid = furi_string_alloc();
|
||||||
|
if(flipper_format_read_string(flipper_format, "Valid", valid)) {
|
||||||
|
bvalid = true;
|
||||||
|
FURI_LOG_I(TAG, "[decoder_des] Valid : %i", bvalid);
|
||||||
|
} else {
|
||||||
|
bvalid = false;
|
||||||
|
}
|
||||||
|
furi_string_free(valid);
|
||||||
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
instance->generic.seed = seed_data[0] << 24 | seed_data[1] << 16 | seed_data[2] << 8 |
|
||||||
seed_data[3];
|
seed_data[3];
|
||||||
|
|
||||||
@@ -502,21 +527,39 @@ void subghz_protocol_decoder_faac_slh_get_string(void* context, FuriString* outp
|
|||||||
uint32_t code_fix = instance->generic.data >> 32;
|
uint32_t code_fix = instance->generic.data >> 32;
|
||||||
uint32_t code_hop = instance->generic.data & 0xFFFFFFFF;
|
uint32_t code_hop = instance->generic.data & 0xFFFFFFFF;
|
||||||
|
|
||||||
furi_string_cat_printf(
|
if(bvalid == false) {
|
||||||
output,
|
furi_string_cat_printf(
|
||||||
"%s %dbit\r\n"
|
output,
|
||||||
"Key:%lX%08lX\r\n"
|
"%s %dbit\r\n"
|
||||||
"Fix:%08lX Cnt:%05lX\r\n"
|
"Key:%lX%08lX\r\n"
|
||||||
"Hop:%08lX Btn:%X\r\n"
|
"Fix:%08lX\r\n"
|
||||||
"Sn:%07lX Sd:%08lX",
|
"Hop:%08lX Btn:%X\r\n"
|
||||||
instance->generic.protocol_name,
|
"Sn:%07lX Sd:Unknown",
|
||||||
instance->generic.data_count_bit,
|
instance->generic.protocol_name,
|
||||||
(uint32_t)(instance->generic.data >> 32),
|
instance->generic.data_count_bit,
|
||||||
(uint32_t)instance->generic.data,
|
(uint32_t)(instance->generic.data >> 32),
|
||||||
code_fix,
|
(uint32_t)instance->generic.data,
|
||||||
instance->generic.cnt,
|
code_fix,
|
||||||
code_hop,
|
code_hop,
|
||||||
instance->generic.btn,
|
instance->generic.btn,
|
||||||
instance->generic.serial,
|
instance->generic.serial);
|
||||||
instance->generic.seed);
|
} else {
|
||||||
|
furi_string_cat_printf(
|
||||||
|
output,
|
||||||
|
"%s %dbit\r\n"
|
||||||
|
"Key:%lX%08lX\r\n"
|
||||||
|
"Fix:%08lX Cnt:%05lX\r\n"
|
||||||
|
"Hop:%08lX Btn:%X\r\n"
|
||||||
|
"Sn:%07lX Sd:%08lX",
|
||||||
|
instance->generic.protocol_name,
|
||||||
|
instance->generic.data_count_bit,
|
||||||
|
(uint32_t)(instance->generic.data >> 32),
|
||||||
|
(uint32_t)instance->generic.data,
|
||||||
|
code_fix,
|
||||||
|
instance->generic.cnt,
|
||||||
|
code_hop,
|
||||||
|
instance->generic.btn,
|
||||||
|
instance->generic.serial,
|
||||||
|
instance->generic.seed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user