Temperature conversion bug

pull/30/head
Pawel Jalocha 2021-01-05 10:57:03 +00:00
rodzic aeec572e1e
commit e355b6c8f6
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -469,7 +469,8 @@ class FANET_RxPacket: public FANET_Packet
} else Len+=Format_String(Out+Len, ".../...g...");
Out[Len++]='t';
if(Service&0x40)
{ int16_t Fahr=Temp; Fahr+=4*Temp/5; Fahr+=32;
{ // int16_t Fahr=Temp; Fahr+=4*Temp/5; Fahr/=2; Fahr+=32; //
int16_t Fahr = (((int16_t)Temp*115+64)>>7) + 32; // [0.5degC] => [degF]
if(Fahr>=0) Len+=Format_UnsDec(Out+Len, Fahr, 3);
else Len+=Format_SignDec(Out+Len, Fahr, 2);
} else Len+=Format_String(Out+Len, "...");