1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 20:59:50 +04:00

SubGhz: added support for 42-bit Prastel variation (#4178)

Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
Pablo Mazzini
2025-04-07 17:13:45 +01:00
committed by GitHub
parent 4dd123fd8a
commit 5f66425671

View File

@@ -16,7 +16,8 @@
#define CAME_12_COUNT_BIT 12
#define CAME_24_COUNT_BIT 24
#define PRASTEL_COUNT_BIT 25
#define PRASTEL_25_COUNT_BIT 25
#define PRASTEL_42_COUNT_BIT 42
#define PRASTEL_NAME "Prastel"
#define AIRFORCE_COUNT_BIT 18
#define AIRFORCE_NAME "Airforce"
@@ -123,6 +124,7 @@ static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* i
switch(instance->generic.data_count_bit) {
case CAME_24_COUNT_BIT:
case PRASTEL_42_COUNT_BIT:
// CAME 24 Bit = 24320 us
header_te = 76;
break;
@@ -131,7 +133,7 @@ static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* i
// CAME 12 Bit Original only! and Airforce protocol = 15040 us
header_te = 47;
break;
case PRASTEL_COUNT_BIT:
case PRASTEL_25_COUNT_BIT:
// PRASTEL = 11520 us
header_te = 36;
break;
@@ -174,7 +176,7 @@ SubGhzProtocolStatus
if(ret != SubGhzProtocolStatusOk) {
break;
}
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
if(instance->generic.data_count_bit > PRASTEL_42_COUNT_BIT) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
ret = SubGhzProtocolStatusErrorValueBitCount;
break;
@@ -268,7 +270,8 @@ void subghz_protocol_decoder_came_feed(void* context, bool level, uint32_t durat
if((instance->decoder.decode_count_bit ==
subghz_protocol_came_const.min_count_bit_for_found) ||
(instance->decoder.decode_count_bit == AIRFORCE_COUNT_BIT) ||
(instance->decoder.decode_count_bit == PRASTEL_COUNT_BIT) ||
(instance->decoder.decode_count_bit == PRASTEL_25_COUNT_BIT) ||
(instance->decoder.decode_count_bit == PRASTEL_42_COUNT_BIT) ||
(instance->decoder.decode_count_bit == CAME_24_COUNT_BIT)) {
instance->generic.serial = 0x0;
instance->generic.btn = 0x0;
@@ -337,7 +340,7 @@ SubGhzProtocolStatus
if(ret != SubGhzProtocolStatusOk) {
break;
}
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
if(instance->generic.data_count_bit > PRASTEL_42_COUNT_BIT) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
ret = SubGhzProtocolStatusErrorValueBitCount;
break;
@@ -350,23 +353,30 @@ void subghz_protocol_decoder_came_get_string(void* context, FuriString* output)
furi_assert(context);
SubGhzProtocolDecoderCame* instance = context;
uint32_t code_found_lo = instance->generic.data & 0x00000000ffffffff;
uint32_t code_found_lo = instance->generic.data & 0x000003ffffffffff;
uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key(
instance->generic.data, instance->generic.data_count_bit);
uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000ffffffff;
uint32_t code_found_reverse_lo = code_found_reverse & 0x000003ffffffffff;
const char* name = instance->generic.protocol_name;
switch(instance->generic.data_count_bit) {
case PRASTEL_25_COUNT_BIT:
case PRASTEL_42_COUNT_BIT:
name = PRASTEL_NAME;
break;
case AIRFORCE_COUNT_BIT:
name = AIRFORCE_NAME;
break;
}
furi_string_cat_printf(
output,
"%s %dbit\r\n"
"Key:0x%08lX\r\n"
"Yek:0x%08lX\r\n",
(instance->generic.data_count_bit == PRASTEL_COUNT_BIT ?
PRASTEL_NAME :
(instance->generic.data_count_bit == AIRFORCE_COUNT_BIT ?
AIRFORCE_NAME :
instance->generic.protocol_name)),
name,
instance->generic.data_count_bit,
code_found_lo,
code_found_reverse_lo);