Fixed bug in MD3x0 calibration loader, made the input parameters of 'interpCalParameter' const

replace/7f2acaa81b0dca15e4a8325f783a6279bfee1605
Silvano Seva 2020-12-05 14:23:27 +01:00
rodzic b1412dedb8
commit 6e144a7160
3 zmienionych plików z 11 dodań i 6 usunięć

Wyświetl plik

@ -39,7 +39,7 @@
* and frequencies.
* @return value for the calibration parameter at the given frequency point.
*/
uint8_t interpCalParameter(freq_t freq, freq_t *calPoints, uint8_t *param,
uint8_t elems);
uint8_t interpCalParameter(const freq_t freq, const freq_t *calPoints,
const uint8_t *param, const uint8_t elems);
#endif /* CALIB_UTILS_H */

Wyświetl plik

@ -19,8 +19,8 @@
#include <calibUtils.h>
uint8_t interpCalParameter(freq_t freq, freq_t *calPoints, uint8_t *param,
uint8_t elems)
uint8_t interpCalParameter(const freq_t freq, const freq_t *calPoints,
const uint8_t *param, const uint8_t elems)
{
if(freq <= calPoints[0]) return param[0];

Wyświetl plik

@ -179,10 +179,15 @@ void nvm_readCalibData(void *buf)
(void) extFlash_readSecurityRegister(0x20b0, ((uint8_t *) &freqs), 72);
extFlash_sleep();
/*
* Ugly quirk: frequency stored in calibration data is divided by ten, so,
* after bcd2bin conversion we have something like 40'135'000. To ajdust
* things, frequency has to be multiplied by ten.
*/
for(uint8_t i = 0; i < 9; i++)
{
calib->rxFreq[i] = ((freq_t) _bcd2bin(freqs[2*i]));
calib->txFreq[i] = ((freq_t) _bcd2bin(freqs[2*i+1]));
calib->rxFreq[i] = ((freq_t) _bcd2bin(freqs[2*i])) * 10;
calib->txFreq[i] = ((freq_t) _bcd2bin(freqs[2*i+1])) * 10;
}
}