Tutorial: Change Flipper xBT to fahrenheit, add offset, or change text

Screenshot-20221231-175359

ROGUEMASTER latest 0.74.3

3 Likes

Flipper still reporting xBT output in Celsius after changing Units to Imperial, just FYI. I’ve logged this with the Flipper team to see if they have any insight.

Screenshot-20230115-142210

Screenshot-20230115-142231

1 Like

Update from /u/astrrra on Reddit:


I’m having the same issue.

Uodate: if you save the xBT and then click “Info” it calculates the temperature in both Celsius and farenheit. Looks to either be buggy implementation or implementation of future use. Either way I’m happy!

flpr-2023-01-15-23-08-19

1 Like

Noticed that too.

This worked great. I also submitted a bug for this on unleashed firmware to see if they might add this into the stock firmware.

4 Likes

Nice, glad it helped :slight_smile:

2 Likes

Adding to this…

If you dont care about offset but you want the flipper to adjust farenheit or Celsius based on the system settings.

Open protocol_fdx_b.c in a terminal editor or a gui editor like bbedit or VisualStudio

after line 6 add a new line and add this include doc

#include <furi_hal_rtc.h>

then scroll to line 327. you can delete line 327 and 328 or comment them out.

        float temperature_c = (temperature - 32) / 1.8;
        furi_string_cat_printf(result, "T: %.1fF %.2fC", (double)temperature, (double)temperature_c);

and in their place at line 327 add the following 6 lines

        if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
            float temperature_c = (temperature - 32) / 1.8;
            furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
        } else {
            furi_string_cat_printf(result, "T: %.2fF", (double)temperature);
        }

for reference

This is now commit #2941 and awaiting merge into the official Flipper firmware.

So edit if you want the new new, but it looks like it should go out in the next release. i compiled and flashed it and it works great.

3 Likes

this write up is still relevant

bit different so ill try to keep it updated. I had to Add

float offset = 1.2;
temperature_c += offset;

to

if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {

So my block looks like:

void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result) {
    // 38 bits of national code
    uint64_t national_code = protocol_fdx_b_get_national_code(protocol->data);

    // 10 bit of country code
    uint16_t country_code = protocol_fdx_b_get_country_code(protocol->data);

    bool animal_flag = bit_lib_get_bit(protocol->data, 63);

    furi_string_printf(result, "ID: %03u-%012llu\r\n", country_code, national_code);
    furi_string_cat_printf(result, "Implant: %s, ", animal_flag ? "Yes" : "No");

    float temperature;
    if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
        if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
            float offset = 1.2;
            float temperature_c = (temperature - 32.0f) / 1.8f;
            temperature_c += offset;
            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: ---");
    }
};

this is with my own 1.2* offset.

3 Likes