From ef17b42a5ea2982033aad5afe5862c16d71c28bc Mon Sep 17 00:00:00 2001 From: Lucifer Date: Sun, 20 Jul 2025 08:43:45 +0700 Subject: [PATCH] NFC: Fix incorrect Saflok year formula (#433) * Fix incorrect Saflok year formula * Update changelog * Format? --------- Co-authored-by: WillyJL --- CHANGELOG.md | 1 + applications/main/nfc/plugins/supported_cards/saflok.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0d10efa..bc811d87c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ ### Fixed: - Bad KB: Fix modifier keys with HOLD/RELEASE commands (by @WillyJL) - Desktop: Fix lock screen hang (#438 by @aaronjamt) +- NFC: Fix incorrect Saflok year formula (#433 by @Eltrick) ### Removed: - Nothing diff --git a/applications/main/nfc/plugins/supported_cards/saflok.c b/applications/main/nfc/plugins/supported_cards/saflok.c index 9940b7cb1..9cab61ee5 100644 --- a/applications/main/nfc/plugins/supported_cards/saflok.c +++ b/applications/main/nfc/plugins/supported_cards/saflok.c @@ -347,8 +347,8 @@ bool saflok_parse(const NfcDevice* device, FuriString* parsed_data) { uint8_t interval_minute = decodedBA[10] & 0x3F; // Bytes 11-13: Creation date since 1980 Jan 1st - uint16_t creation_year = (((decodedBA[11] & 0xF0) >> 4) + SAFLOK_YEAR_OFFSET) | - creation_year_bits; + uint16_t creation_year = + (creation_year_bits | ((decodedBA[11] & 0xF0) >> 4)) + SAFLOK_YEAR_OFFSET; uint8_t creation_month = decodedBA[11] & 0x0F; uint8_t creation_day = (decodedBA[12] >> 3) & 0x1F; uint8_t creation_hour = ((decodedBA[12] & 0x07) << 2) | (decodedBA[13] >> 6);