Fixing parsing troika number (#2536)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
494002505e
commit
4c488bd970
@ -90,13 +90,14 @@ bool troika_4k_parser_parse(NfcDeviceData* dev_data) {
|
|||||||
|
|
||||||
uint8_t* temp_ptr = &data->block[8 * 4 + 1].value[5];
|
uint8_t* temp_ptr = &data->block[8 * 4 + 1].value[5];
|
||||||
uint16_t balance = ((temp_ptr[0] << 8) | temp_ptr[1]) / 25;
|
uint16_t balance = ((temp_ptr[0] << 8) | temp_ptr[1]) / 25;
|
||||||
temp_ptr = &data->block[8 * 4].value[3];
|
temp_ptr = &data->block[8 * 4].value[2];
|
||||||
uint32_t number = 0;
|
uint32_t number = 0;
|
||||||
for(size_t i = 0; i < 4; i++) {
|
for(size_t i = 1; i < 5; i++) {
|
||||||
number <<= 8;
|
number <<= 8;
|
||||||
number |= temp_ptr[i];
|
number |= temp_ptr[i];
|
||||||
}
|
}
|
||||||
number >>= 4;
|
number >>= 4;
|
||||||
|
number |= (temp_ptr[0] & 0xf) << 28;
|
||||||
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
dev_data->parsed_data, "\e#Troika\nNum: %lu\nBalance: %u rur.", number, balance);
|
dev_data->parsed_data, "\e#Troika\nNum: %lu\nBalance: %u rur.", number, balance);
|
||||||
|
@ -70,13 +70,14 @@ bool troika_parser_parse(NfcDeviceData* dev_data) {
|
|||||||
// Parse data
|
// Parse data
|
||||||
uint8_t* temp_ptr = &data->block[8 * 4 + 1].value[5];
|
uint8_t* temp_ptr = &data->block[8 * 4 + 1].value[5];
|
||||||
uint16_t balance = ((temp_ptr[0] << 8) | temp_ptr[1]) / 25;
|
uint16_t balance = ((temp_ptr[0] << 8) | temp_ptr[1]) / 25;
|
||||||
temp_ptr = &data->block[8 * 4].value[3];
|
temp_ptr = &data->block[8 * 4].value[2];
|
||||||
uint32_t number = 0;
|
uint32_t number = 0;
|
||||||
for(size_t i = 0; i < 4; i++) {
|
for(size_t i = 1; i < 5; i++) {
|
||||||
number <<= 8;
|
number <<= 8;
|
||||||
number |= temp_ptr[i];
|
number |= temp_ptr[i];
|
||||||
}
|
}
|
||||||
number >>= 4;
|
number >>= 4;
|
||||||
|
number |= (temp_ptr[0] & 0xf) << 28;
|
||||||
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
dev_data->parsed_data, "\e#Troika\nNum: %lu\nBalance: %u rur.", number, balance);
|
dev_data->parsed_data, "\e#Troika\nNum: %lu\nBalance: %u rur.", number, balance);
|
||||||
|
Loading…
Reference in New Issue
Block a user