mirror of
https://github.com/D4C1-Labs/Flipper-ARF.git
synced 2026-03-29 17:31:24 +00:00
Compare commits
2 Commits
dev-2571ad
...
dev-e445b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e445b28d73 | ||
|
|
19e2eaa554 |
@@ -186,6 +186,17 @@ static void fiat_marelli_rebuild_raw_data(SubGhzProtocolDecoderFiatMarelli* inst
|
||||
}
|
||||
|
||||
instance->bit_count = instance->generic.data_count_bit;
|
||||
|
||||
// Re-extract protocol fields from raw_data (needed after deserialize)
|
||||
if(instance->bit_count >= 56) {
|
||||
instance->generic.serial =
|
||||
((uint32_t)instance->raw_data[2] << 24) |
|
||||
((uint32_t)instance->raw_data[3] << 16) |
|
||||
((uint32_t)instance->raw_data[4] << 8) |
|
||||
((uint32_t)instance->raw_data[5]);
|
||||
instance->generic.btn = (instance->raw_data[6] >> 4) & 0xF;
|
||||
instance->generic.cnt = (instance->raw_data[7] >> 3) & 0x1F;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper: prepare data collection state for Manchester decoding
|
||||
@@ -242,9 +253,9 @@ void subghz_protocol_decoder_fiat_marelli_feed(void* context, bool level, uint32
|
||||
uint32_t te_short = instance->te_detected ? instance->te_detected
|
||||
: (uint32_t)subghz_protocol_fiat_marelli_const.te_short;
|
||||
uint32_t te_long = te_short * 2;
|
||||
// Delta must be wide enough for asymmetric timing (Type B pos~140us neg~68us)
|
||||
// but < te_short/2 to avoid short/long overlap
|
||||
uint32_t te_delta = te_short * 45 / 100;
|
||||
// Delta = te_short/2: maximum that avoids short/long overlap (boundary at 1.5*TE).
|
||||
// Must be this wide for Type B asymmetric timing (pos~140us, neg~68us, avg~100us).
|
||||
uint32_t te_delta = te_short / 2;
|
||||
if(te_delta < 30) te_delta = 30;
|
||||
uint32_t diff;
|
||||
|
||||
@@ -434,6 +445,7 @@ void subghz_protocol_decoder_fiat_marelli_feed(void* context, bool level, uint32
|
||||
instance->te_last = duration;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,15 +545,14 @@ void subghz_protocol_decoder_fiat_marelli_get_string(void* context, FuriString*
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %dbit Type%s\r\n"
|
||||
"Sn:%08lX Btn:%s(0x%X)\r\n"
|
||||
"Ep:%X Ctr:%d Roll:%02X%02X%02X%02X%02X%02X\r\n"
|
||||
"Data:",
|
||||
"Sn:%08lX Btn:%s\r\n"
|
||||
"Ep:%X Ctr:%02d\r\n"
|
||||
"R:%02X%02X%02X%02X%02X%02X",
|
||||
instance->generic.protocol_name,
|
||||
instance->bit_count,
|
||||
variant,
|
||||
instance->generic.serial,
|
||||
fiat_marelli_button_name(instance->generic.btn),
|
||||
instance->generic.btn,
|
||||
epoch,
|
||||
counter,
|
||||
instance->raw_data[7],
|
||||
@@ -550,9 +561,4 @@ void subghz_protocol_decoder_fiat_marelli_get_string(void* context, FuriString*
|
||||
(total_bytes > 10) ? instance->raw_data[10] : 0,
|
||||
(total_bytes > 11) ? instance->raw_data[11] : 0,
|
||||
(total_bytes > 12) ? instance->raw_data[12] : 0);
|
||||
|
||||
for(uint8_t i = 0; i < total_bytes; i++) {
|
||||
furi_string_cat_printf(output, "%02X", instance->raw_data[i]);
|
||||
}
|
||||
furi_string_cat_printf(output, "\r\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user