Encoder fix

This commit is contained in:
assasinfil 2023-02-10 15:55:31 +03:00
parent 0e0046c803
commit a551317cc2
No known key found for this signature in database
GPG key ID: E5C793A4B4737A16

View file

@ -176,6 +176,8 @@ static bool subghz_protocol_kinggates_stylo_4k_gen_data(
//Simple Learning
encrypt = subghz_protocol_keeloq_common_encrypt(data, manufacture_code->key);
encrypt = subghz_protocol_blocks_reverse_key(encrypt, 32);
// instance->generic.data =
// subghz_protocol_blocks_reverse_key(instance->generic.data, 64);
instance->generic.data_2 = encrypt << 4;
return true;
}
@ -222,13 +224,14 @@ static bool subghz_protocol_encoder_kinggates_stylo_4k_get_upload(
}
// After header
instance->encoder.upload[index - 1].duration += (uint32_t)2200;
instance->encoder.upload[index - 1].duration =
(uint32_t)subghz_protocol_kinggates_stylo_4k_const.te_long * 2;
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_kinggates_stylo_4k_const.te_short * 2);
// Send key data
for(uint8_t i = instance->generic.data_count_bit; i > 64; i--) {
if(bit_read(instance->generic.data, i - 1 - 64)) {
for(uint8_t i = 53; i > 0; i--) {
if(bit_read(instance->generic.data, i - 1)) {
//send bit 1
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_kinggates_stylo_4k_const.te_short);
@ -243,7 +246,7 @@ static bool subghz_protocol_encoder_kinggates_stylo_4k_get_upload(
}
}
for(uint8_t i = 36; i > 0; i--) {
for(uint8_t i = 36; i > 4; i--) {
if(bit_read(instance->generic.data_2, i - 1)) {
//send bit 1
instance->encoder.upload[index++] = level_duration_make(