Skip to content

Commit 885c465

Browse files
committed
#8 - Add decimal values to id & facility.
1 parent bd1b14b commit 885c465

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

gpio/wiegand/application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
App(
2-
appid="Wiegand_Reader",
2+
appid="wiegand_reader",
33
name="Wiegand Reader",
44
apptype=FlipperAppType.EXTERNAL,
55
entry_point="wiegand_app",

gpio/wiegand/scenes/wiegand_data.c

+15
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,27 @@ void wiegand_add_info_26bit(FuriString* buffer) {
5353
furi_string_cat_printf(buffer, "\nFacility: 0x");
5454
int code = 0;
5555
int count = 0;
56+
uint32_t dec = 0;
5657
for(int i = 1; i < 25; i++) {
5758
code = code << 1;
59+
dec = dec << 1;
5860
code |= data[i] ? 1 : 0;
61+
dec |= data[i] ? 1 : 0;
5962
if(++count % 4 == 0) {
6063
furi_string_cat_printf(buffer, "%X", code);
6164
code = 0;
6265
}
66+
67+
if(i == 8) {
68+
furi_string_cat_printf(buffer, " (%ld)", dec);
69+
dec = 0;
70+
}
6371
// Parity, then 8 bit facility code, then id.
6472
if(i == 9) {
6573
furi_string_cat_printf(buffer, "\nId: 0x");
6674
}
6775
}
76+
furi_string_cat_printf(buffer, " (%ld)", dec);
6877

6978
if(data[13]) {
7079
parity = 1;
@@ -91,18 +100,24 @@ void wiegand_add_info_24bit(FuriString* buffer) {
91100
furi_string_cat_printf(buffer, "\nFacility: 0x");
92101
int code = 0;
93102
int count = 0;
103+
uint32_t dec = 0;
94104
for(int i = 0; i < 24; i++) {
95105
code = code << 1;
106+
dec = dec << 1;
96107
code |= data[i] ? 1 : 0;
108+
dec |= data[i] ? 1 : 0;
97109
if(++count % 4 == 0) {
98110
furi_string_cat_printf(buffer, "%X", code);
99111
code = 0;
100112
}
101113
// The first 8 bits are facility code, then comes id.
102114
if(i == 8) {
115+
furi_string_cat_printf(buffer, " (%ld)", dec);
116+
dec = 0;
103117
furi_string_cat_printf(buffer, "\nId: 0x");
104118
}
105119
}
120+
furi_string_cat_printf(buffer, " (%ld)", dec);
106121
}
107122

108123
void wiegand_add_info(FuriString* buffer) {

0 commit comments

Comments
 (0)