SubGhz: bugfix unable to send, new generated secplus_v2 protocol (#2488)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm 2023-03-15 16:16:52 +04:00 committed by GitHub
parent d12f76dacb
commit 3a242e5fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -182,7 +182,9 @@ bool subghz_protocol_keeloq_create_data(
instance->generic.data_count_bit = 64; instance->generic.data_count_bit = 64;
bool res = subghz_protocol_keeloq_gen_data(instance, btn); bool res = subghz_protocol_keeloq_gen_data(instance, btn);
if(res) { if(res) {
res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset); if(subghz_block_generic_serialize(&instance->generic, flipper_format, preset) !=
SubGhzProtocolStatusOk)
res = false;
} }
return res; return res;
} }

View File

@ -599,19 +599,20 @@ bool subghz_protocol_secplus_v2_create_data(
instance->generic.data_count_bit = instance->generic.data_count_bit =
(uint8_t)subghz_protocol_secplus_v2_const.min_count_bit_for_found; (uint8_t)subghz_protocol_secplus_v2_const.min_count_bit_for_found;
subghz_protocol_secplus_v2_encode(instance); subghz_protocol_secplus_v2_encode(instance);
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset); SubGhzProtocolStatus res =
subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
uint8_t key_data[sizeof(uint64_t)] = {0}; uint8_t key_data[sizeof(uint64_t)] = {0};
for(size_t i = 0; i < sizeof(uint64_t); i++) { for(size_t i = 0; i < sizeof(uint64_t); i++) {
key_data[sizeof(uint64_t) - i - 1] = (instance->secplus_packet_1 >> (i * 8)) & 0xFF; key_data[sizeof(uint64_t) - i - 1] = (instance->secplus_packet_1 >> (i * 8)) & 0xFF;
} }
if(res && if((res == SubGhzProtocolStatusOk) &&
!flipper_format_write_hex(flipper_format, "Secplus_packet_1", key_data, sizeof(uint64_t))) { !flipper_format_write_hex(flipper_format, "Secplus_packet_1", key_data, sizeof(uint64_t))) {
FURI_LOG_E(TAG, "Unable to add Secplus_packet_1"); FURI_LOG_E(TAG, "Unable to add Secplus_packet_1");
res = false; res = SubGhzProtocolStatusErrorParserOthers;
} }
return res; return res == SubGhzProtocolStatusOk;
} }
void* subghz_protocol_decoder_secplus_v2_alloc(SubGhzEnvironment* environment) { void* subghz_protocol_decoder_secplus_v2_alloc(SubGhzEnvironment* environment) {