diff --git a/lib/subghz/protocols/kinggates_stylo_4k.c b/lib/subghz/protocols/kinggates_stylo_4k.c index d86c5cd29..1249af5b2 100644 --- a/lib/subghz/protocols/kinggates_stylo_4k.c +++ b/lib/subghz/protocols/kinggates_stylo_4k.c @@ -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(