#8 - Add decimal values to id & facility.
This commit is contained in:
parent
bd1b14bb01
commit
885c465b44
@ -1,5 +1,5 @@
|
||||
App(
|
||||
appid="Wiegand_Reader",
|
||||
appid="wiegand_reader",
|
||||
name="Wiegand Reader",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="wiegand_app",
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user