FDX-B temperature in system units (#2941)

* FDX-B temperature now uses system units
* LF-RFID: wrap floats in fdx-b temperature conversion

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Astra 2023-08-07 19:28:47 +09:00 committed by GitHub
parent 4c771b66dc
commit 1e4af1d550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))
@ -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: ---");
}