Fixed the floating point precision problem with Lorawan stack

Fixed the floating point precision problem with Lorawan stack.
pull/73/head
Gustavo F Nobrega 2019-04-11 14:51:14 -07:00 zatwierdzone przez GitHub
rodzic 0e0717c51a
commit aebd5852ed
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -488,7 +488,9 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
}
#endif
buff_index += j;
ftoa((double)freq/1000000,cfreq,6); // XXX This can be done better
double iifreq;
iifreq = freq/1000000;
ftoa(iifreq,cfreq,6); // Fixed the floating point precision problem with Lorawan stack
j = snprintf((char *)(buff_up + buff_index), TX_BUFF_SIZE-buff_index, ",\"chan\":%1u,\"rfch\":%1u,\"freq\":%s", 0, 0, cfreq);
buff_index += j;
memcpy((void *)(buff_up + buff_index), (void *)",\"stat\":1", 9);