diff --git a/CHANGELOG.md b/CHANGELOG.md index bfbd4dfda..46f0496e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - UL: Marantec protocol implement CRC verification display and add manually support (by @xMasterX & @li0ard, original code by @Skorpionm) - UL: Keeloq Comunello add manually support (by @xMasterX) - UL: Add variant of 'Add Manually' menu with manual editing for each value (by @MrLego8-9) + - UL: Add ZKTeco 430.5 MHz add manually support (by @xMasterX) - RFID: Support writing Securakey, Jablotron and FDX-B to EM4305 cards (#434 by @jamisonderek) - BT Remote: Add Rename Option, simplify Bad KB BLE profile (#439 by @aaronjamt & @WillyJL) - MNTM Settings: @@ -46,6 +47,7 @@ - Sub-GHz: - UL: Add 868.46 MHz to default subghz freqs list (by @xMasterX) - UL: Reduce less popular freqs in default hopper preset, make it faster (by @xMasterX) + - UL: Tune Linear (add better EZCode support), Dickert MAHS decoders (by @xMasterX) - JS: Expose button event type in `gui/widget` button callback (by @WillyJL) - UL: Docs: Update Sub-GHz DoorHan programming instructions (by @li0ard) diff --git a/applications/main/subghz/helpers/subghz_custom_event.h b/applications/main/subghz/helpers/subghz_custom_event.h index 112cb98b1..fecdef610 100644 --- a/applications/main/subghz/helpers/subghz_custom_event.h +++ b/applications/main/subghz/helpers/subghz_custom_event.h @@ -128,6 +128,7 @@ typedef enum { SetTypeCAMESpace, SetTypePricenton315, SetTypePricenton433, + SetTypeZKTeco430, SetTypeBETT_433, SetTypeGangQi_433, SetTypeHollarm_433, diff --git a/applications/main/subghz/helpers/subghz_gen_info.c b/applications/main/subghz/helpers/subghz_gen_info.c index f6abec0c6..90853cec5 100644 --- a/applications/main/subghz/helpers/subghz_gen_info.c +++ b/applications/main/subghz/helpers/subghz_gen_info.c @@ -38,6 +38,16 @@ void subghz_scene_set_type_fill_generation_infos(GenInfo* infos_dest, SetType ty .data.bits = 24, .data.te = 400}; break; + case SetTypeZKTeco430: + gen_info = (GenInfo){ + .type = GenData, + .mod = "AM650", + .freq = 430500000, + .data.name = SUBGHZ_PROTOCOL_PRINCETON_NAME, + .data.key = (key & 0x00FFFF00) | 0x30, // btn 0x30(UP), 0x03(STOP), 0x0C(DOWN) + .data.bits = 24, + .data.te = 357}; + break; case SetTypeNiceFlo12bit: gen_info = (GenInfo){ .type = GenData, diff --git a/applications/main/subghz/scenes/subghz_scene_set_type.c b/applications/main/subghz/scenes/subghz_scene_set_type.c index f493954bc..93419a974 100644 --- a/applications/main/subghz/scenes/subghz_scene_set_type.c +++ b/applications/main/subghz/scenes/subghz_scene_set_type.c @@ -68,6 +68,7 @@ static const char* submenu_names[SetTypeMAX] = { [SetTypeCAMESpace] = "KL: CAME Space 433MHz", [SetTypePricenton315] = "Princeton 315MHz", [SetTypePricenton433] = "Princeton 433MHz", + [SetTypeZKTeco430] = "ZKTeco 430MHz", [SetTypeGangQi_433] = "GangQi 433MHz", [SetTypeHollarm_433] = "Hollarm 433MHz", [SetTypeReversRB2_433] = "Revers RB2 433MHz", diff --git a/lib/subghz/protocols/dickert_mahs.c b/lib/subghz/protocols/dickert_mahs.c index d3c5146f0..dc6c78842 100644 --- a/lib/subghz/protocols/dickert_mahs.c +++ b/lib/subghz/protocols/dickert_mahs.c @@ -290,8 +290,9 @@ void subghz_protocol_decoder_dickert_mahs_feed(void* context, bool level, uint32 instance->decoder.decode_count_bit = 0; } - if((!level) && (duration > 10 * subghz_protocol_dickert_mahs_const.te_short)) { - //Found header DICKERT_MAHS + if((!level) && (DURATION_DIFF(duration, subghz_protocol_dickert_mahs_const.te_long * 50) < + subghz_protocol_dickert_mahs_const.te_delta * 70)) { + //Found header DICKERT_MAHS 44k us instance->decoder.parser_step = DickertMAHSDecoderStepInitial; } break; diff --git a/lib/subghz/protocols/linear.c b/lib/subghz/protocols/linear.c index a7d53cee3..d089bd2b9 100644 --- a/lib/subghz/protocols/linear.c +++ b/lib/subghz/protocols/linear.c @@ -18,7 +18,7 @@ static const SubGhzBlockConst subghz_protocol_linear_const = { .te_short = 500, .te_long = 1500, - .te_delta = 150, + .te_delta = 350, .min_count_bit_for_found = 10, }; @@ -118,32 +118,32 @@ static bool subghz_protocol_encoder_linear_get_upload(SubGhzProtocolEncoderLinea if(bit_read(instance->generic.data, i - 1)) { //send bit 1 instance->encoder.upload[index++] = - level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short * 3); + level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short); instance->encoder.upload[index++] = - level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short); + level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_long); } else { //send bit 0 instance->encoder.upload[index++] = - level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short); + level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_long); instance->encoder.upload[index++] = - level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short * 3); + level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short); } } //Send end bit if(bit_read(instance->generic.data, 0)) { //send bit 1 instance->encoder.upload[index++] = - level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short * 3); - //Send PT_GUARD + level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short); + //Send gap instance->encoder.upload[index++] = - level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short * 42); + level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short * 44); } else { //send bit 0 instance->encoder.upload[index++] = - level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_short); - //Send PT_GUARD + level_duration_make(true, (uint32_t)subghz_protocol_linear_const.te_long); + //Send gap instance->encoder.upload[index++] = - level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short * 44); + level_duration_make(false, (uint32_t)subghz_protocol_linear_const.te_short * 42); } return true; @@ -225,7 +225,7 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur switch(instance->decoder.parser_step) { case LinearDecoderStepReset: if((!level) && (DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) < - subghz_protocol_linear_const.te_delta * 20)) { + subghz_protocol_linear_const.te_delta * 15)) { //Found header Linear instance->decoder.decode_data = 0; instance->decoder.decode_count_bit = 0; @@ -246,16 +246,16 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur instance->decoder.parser_step = LinearDecoderStepReset; //checking that the duration matches the guardtime if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) > - subghz_protocol_linear_const.te_delta * 20) { + subghz_protocol_linear_const.te_delta * 15) { break; } if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) < subghz_protocol_linear_const.te_delta) { - subghz_protocol_blocks_add_bit(&instance->decoder, 0); + subghz_protocol_blocks_add_bit(&instance->decoder, 1); } else if( DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_long) < subghz_protocol_linear_const.te_delta) { - subghz_protocol_blocks_add_bit(&instance->decoder, 1); + subghz_protocol_blocks_add_bit(&instance->decoder, 0); } if(instance->decoder.decode_count_bit == subghz_protocol_linear_const.min_count_bit_for_found) { @@ -275,14 +275,14 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur subghz_protocol_linear_const.te_delta) && (DURATION_DIFF(duration, subghz_protocol_linear_const.te_long) < subghz_protocol_linear_const.te_delta)) { - subghz_protocol_blocks_add_bit(&instance->decoder, 0); + subghz_protocol_blocks_add_bit(&instance->decoder, 1); instance->decoder.parser_step = LinearDecoderStepSaveDuration; } else if( (DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_long) < subghz_protocol_linear_const.te_delta) && (DURATION_DIFF(duration, subghz_protocol_linear_const.te_short) < subghz_protocol_linear_const.te_delta)) { - subghz_protocol_blocks_add_bit(&instance->decoder, 1); + subghz_protocol_blocks_add_bit(&instance->decoder, 0); instance->decoder.parser_step = LinearDecoderStepSaveDuration; } else { instance->decoder.parser_step = LinearDecoderStepReset; @@ -333,8 +333,8 @@ void subghz_protocol_decoder_linear_get_string(void* context, FuriString* output furi_string_cat_printf( output, "%s %dbit\r\n" - "Key:0x%08lX\r\n" - "Yek:0x%08lX\r\n" + "Key:0x%03lX\r\n" + "Yek:0x%03lX\r\n" "DIP:" DIP_PATTERN "\r\n", instance->generic.protocol_name, instance->generic.data_count_bit,