From 885c465b44b325f8f486cb44d21c739b933f9559 Mon Sep 17 00:00:00 2001 From: Derek Jamison Date: Sun, 11 Jun 2023 15:50:30 -0500 Subject: [PATCH] #8 - Add decimal values to id & facility. --- gpio/wiegand/application.fam | 2 +- gpio/wiegand/scenes/wiegand_data.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gpio/wiegand/application.fam b/gpio/wiegand/application.fam index 42767792d46..d7694218f84 100644 --- a/gpio/wiegand/application.fam +++ b/gpio/wiegand/application.fam @@ -1,5 +1,5 @@ App( - appid="Wiegand_Reader", + appid="wiegand_reader", name="Wiegand Reader", apptype=FlipperAppType.EXTERNAL, entry_point="wiegand_app", diff --git a/gpio/wiegand/scenes/wiegand_data.c b/gpio/wiegand/scenes/wiegand_data.c index 27c3036d765..0e820862b42 100644 --- a/gpio/wiegand/scenes/wiegand_data.c +++ b/gpio/wiegand/scenes/wiegand_data.c @@ -53,18 +53,27 @@ void wiegand_add_info_26bit(FuriString* buffer) { furi_string_cat_printf(buffer, "\nFacility: 0x"); int code = 0; int count = 0; + uint32_t dec = 0; for(int i = 1; i < 25; i++) { code = code << 1; + dec = dec << 1; code |= data[i] ? 1 : 0; + dec |= data[i] ? 1 : 0; if(++count % 4 == 0) { furi_string_cat_printf(buffer, "%X", code); code = 0; } + + if(i == 8) { + furi_string_cat_printf(buffer, " (%ld)", dec); + dec = 0; + } // Parity, then 8 bit facility code, then id. if(i == 9) { furi_string_cat_printf(buffer, "\nId: 0x"); } } + furi_string_cat_printf(buffer, " (%ld)", dec); if(data[13]) { parity = 1; @@ -91,18 +100,24 @@ void wiegand_add_info_24bit(FuriString* buffer) { furi_string_cat_printf(buffer, "\nFacility: 0x"); int code = 0; int count = 0; + uint32_t dec = 0; for(int i = 0; i < 24; i++) { code = code << 1; + dec = dec << 1; code |= data[i] ? 1 : 0; + dec |= data[i] ? 1 : 0; if(++count % 4 == 0) { furi_string_cat_printf(buffer, "%X", code); code = 0; } // The first 8 bits are facility code, then comes id. if(i == 8) { + furi_string_cat_printf(buffer, " (%ld)", dec); + dec = 0; furi_string_cat_printf(buffer, "\nId: 0x"); } } + furi_string_cat_printf(buffer, " (%ld)", dec); } void wiegand_add_info(FuriString* buffer) {