mirror of
https://protopirate.net/ProtoPirate/ProtoPirate.git
synced 2026-08-26 15:50:16 +00:00
Merge pull request 'FORD: Fix PANIC Button ENCODE and Counter Overflow in DECODE' (#28) from RalphWiggum/ProtoPirate:ford_panic into main
FAP Build / ufbt: Build for Momentum dev (push) Successful in 1m9s
FAP Build / ufbt: Build for Unleashed dev (push) Successful in 1m7s
FAP Build / ufbt: Build for Unleashed release (push) Successful in 49s
FAP Build / ufbt: Build for OFW release channel (push) Failing after 13m47s
FAP Build / ufbt: Build for OFW dev channel (push) Failing after 13m52s
FAP Build / ufbt: Build for Momentum release (push) Failing after 13m58s
FAP Build / ufbt: Build for Momentum dev (push) Successful in 1m9s
FAP Build / ufbt: Build for Unleashed dev (push) Successful in 1m7s
FAP Build / ufbt: Build for Unleashed release (push) Successful in 49s
FAP Build / ufbt: Build for OFW release channel (push) Failing after 13m47s
FAP Build / ufbt: Build for OFW dev channel (push) Failing after 13m52s
FAP Build / ufbt: Build for Momentum release (push) Failing after 13m58s
Reviewed-on: http://protopirate.net/ProtoPirate/ProtoPirate/pulls/28 Reviewed-by: MMX <mmx@no-reply.protopirate.net>
This commit is contained in:
+7
-4
@@ -149,7 +149,8 @@ const SubGhzProtocol ford_protocol_v0 = {
|
||||
static uint8_t ford_v0_calculate_checksum(uint32_t serial, uint32_t count, uint8_t button) {
|
||||
return (uint8_t)((((count >> 24) & 0xFF) + ((count >> 16) & 0xFF) + ((count >> 8) & 0xFF) +
|
||||
(count & 0xFF) + ((serial >> 24) & 0xFF) + ((serial >> 16) & 0xFF) +
|
||||
((serial >> 8) & 0xFF) + (serial & 0xFF) + (button << 4)) &
|
||||
((serial >> 8) & 0xFF) + (serial & 0xFF) +
|
||||
((button == 0) ? 8 : button << 4)) &
|
||||
0xFF);
|
||||
}
|
||||
#endif
|
||||
@@ -271,7 +272,7 @@ static void decode_ford_v0(
|
||||
|
||||
*button = (buf[5] >> 4) & 0x0F;
|
||||
|
||||
*count = ((buf[5] & 0x0F) << 16) | (buf[6] << 8) | buf[7];
|
||||
*count = (((buf[5] & 0x0F) << 16) | (buf[6] << 8) | buf[7]) & 0xFFFF;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
@@ -299,7 +300,7 @@ static void encode_ford_v0(
|
||||
buf[3] = (serial >> 8) & 0xFF;
|
||||
buf[4] = serial & 0xFF;
|
||||
|
||||
buf[5] = ((button & 0x0F) << 4) | ((count >> 16) & 0x0F);
|
||||
buf[5] = ((button == 0) ? 8 : ((button & 0x0F) << 4)) | ((count >> 16) & 0x0F);
|
||||
|
||||
uint8_t count_mid = (count >> 8) & 0xFF;
|
||||
uint8_t count_low = count & 0xFF;
|
||||
@@ -930,7 +931,9 @@ void subghz_protocol_decoder_ford_v0_get_string(void* context, FuriString* outpu
|
||||
bool crc_ok = ford_v0_verify_crc(instance->key1, instance->key2);
|
||||
|
||||
const char* button_name = "??";
|
||||
if(instance->button == 0x01)
|
||||
if(!instance->button)
|
||||
button_name = "Panic";
|
||||
else if(instance->button == 0x01)
|
||||
button_name = "Lock";
|
||||
else if(instance->button == 0x02)
|
||||
button_name = "Unlock";
|
||||
|
||||
@@ -175,7 +175,7 @@ static uint8_t
|
||||
case InputKeyDown:
|
||||
return 0x4; // Boot?
|
||||
case InputKeyLeft:
|
||||
return 0x8; // Panic?
|
||||
return 0x0; // Panic?
|
||||
case InputKeyRight:
|
||||
return 0x3; // ?
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user