Skip to content

Commit

Permalink
FDX-B temperature in system units (flipperdevices#2941)
Browse files Browse the repository at this point in the history
* FDX-B temperature now uses system units
* LF-RFID: wrap floats in fdx-b temperature conversion

Co-authored-by: あく <[email protected]>
  • Loading branch information
2 people authored and agarof committed Aug 30, 2023
1 parent cb5f005 commit 3743019
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/lfrfid/protocols/protocol_fdx_b.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <toolbox/manchester_decoder.h>
#include <lfrfid/tools/bit_lib.h>
#include "lfrfid_protocols.h"
#include <furi_hal_rtc.h>

#define FDX_B_ENCODED_BIT_SIZE (128)
#define FDX_B_ENCODED_BYTE_SIZE (((FDX_B_ENCODED_BIT_SIZE) / 8))
Expand Down Expand Up @@ -323,8 +324,12 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result

float temperature;
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
float temperature_c = (temperature - 32) / 1.8;
furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
float temperature_c = (temperature - 32.0f) / 1.8f;
furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
} else {
furi_string_cat_printf(result, "T: %.2fF", (double)temperature);
}
} else {
furi_string_cat_printf(result, "T: ---");
}
Expand Down

0 comments on commit 3743019

Please sign in to comment.