Hey y’all (hope this is the right category, if not, feel free to fix pilgrim)
As you might have seen, the Flipper Zero currently only displays temp readouts for the xBT in Celsius. If you want to change that, or add a temp offset to correct for your body temp, here’s how:
First, make sure you have git installed for your respective platform. NOTE: This only supports macOS and linux. You can use a VM if you’d like, but I won’t cover that in this tutorial. LMK if you’d like me to make one covering that.
Open a terminal, and run (depending on the firmware you’d like to use)
git clone --recursive https://github.com/flipperdevices/flipperzero-firmware
or
git clone --recursive https://github.com/DarkFlippers/unleashed-firmware
This will take a while, they’re big repos.
Once done, you can do
cd flipperzero-firmware/lib/lfrfid/protocols
or
cd unleashed-firmware/lib/lfrfid/protocols
once again depending on which firmware you downloaded.
You’ll want to then open a text editor, and edit file protocol_fdx_b.c.
I use nano, so
nano protocol_fdx_b.c
Then, using your text editor, search for the function
void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result)
Then, if you’d like to change the “Animal: Yes” printout, now’s the time.
Find the line
furi_string_cat_printf(result, "Animal: %s, ", animal_flag ? "Yes" : "No");
NOTE: There will be two results, go to the second one, under function protocol_fdx_b_render_brief_data.
You can change this to whatever you want. An example is:
furi_string_cat_printf(result, "Cyborg: Yes, ");
From that example you can put whatever you’d line in the quotes, or delete that line entirely.
Make sure that if you also delete the line
bool animal_flag = bit_lib_get_bit(protocol->data, 63);
if you aren’t using it in your printout, or you’ll get an error later for unused variable.
Next, temperature. This is a little bit tricky if you aren’t a programmer.
Pay attention to this section:
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);
} else {
furi_string_cat_printf(result, "T: ---");
}
Variable temperature here is already in fahrenheit, and is filled by the protocol_fdx_b_get_temp() function.
If all you want is an offset, and you still want your temperature in celsius, here’s the code block you need. Just replace the entire block above with this one.
Celsius w/ Offset (replace 4.2 with whatever your desired offset is in Celsius)
float temperature;
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
float offset = 4.2;
float temperature_c = (temperature - 32) / 1.8;
temperature_c += offset;
furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
} else {
furi_string_cat_printf(result, "T: ---");
}
If you want to show both fahrenheit and celsius, and you want to give your offset in degrees fahrenheit, here’s an example for you:
Fahrenheit + celsius w/ offset (replace 4.2 with desired offset in Fahrenheit)
float temperature;
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
float offset = 4.2;
temperature += offset;
float temperature_c = (temperature - 32) / 1.8;
furi_string_cat_printf(result, "T: %.1fF %.2fC", (double)temperature, (double)temperature_c);
} else {
furi_string_cat_printf(result, "T: ---");
}
And for those who don’t care about temp offsets:
Fahrenheit + Celsius, no offset
float temperature;
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
float temperature_c = (temperature - 32) / 1.8;
furi_string_cat_printf(result, "T: %.1fF %.2fC", (double)temperature, (double)temperature_c);
} else {
furi_string_cat_printf(result, "T: ---");
}
Lastly…
Just fahrenheit w/ no offset (freedom edition)
float temperature;
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
furi_string_cat_printf(result, "T: %.1fF", (double)temperature);
} else {
furi_string_cat_printf(result, "T: ---");
}
Hopefully from those examples, it’s easy to figure out how to modify it to your needs. LMK if any of them have issues, I just threw those together, but they all should be valid (I’ve used several of the combinations)
Okay, now that that’s done, run
cd ../../..
to get back to the main folder.
You can now run
./fbt
, and it should automagically download the toolchain, and begin compilation. It may error out on your first try or two (missing header images or something IIRC?), just run it again.
When done, your firmware file will be in either
flipperzero-firmware/dist/f7-D
or
unleashed-firmware/dist/f7-D
It’ll be the flipper-z-f7-full-local.dfu file.
Then, open qFlipper, connect your flipper, and do Install from file. Pick your new dfu file.
(You also might be able to do ./fbt flash instead of using qFlipper, but that seems a bit more finicky)
Voila!