nopnop2002 / Arduino-SI4432

Arduino library for SILICON LABS SI443x
MIT License
15 stars 5 forks source link

values for frequency registers calculated wrongly #2

Closed hp9000 closed 1 year ago

hp9000 commented 1 year ago

second and third value are always 0. This is because si4432.cpp line 29 is an integer division and fractional part gets lost. Result is 0 for freqcarrier in line 33.

quick fix: change "10" to "10.0" in line 29

hp9000 commented 1 year ago

better: force compiler to use type double by a cast:

double fPart = ((double)baseFrequencyMhz / (10 * (highBand + 1))) - 24;

nopnop2002 commented 1 year ago

Thanks for the report. Fixed.

your nickname is very nice