Skip to content

Non Volatile Storage (NVS) support for sensors calibrations.

Jean Alinei requested to merge NVS_ADC_calibration_factors into main

An official MR in order to port this old feature that never made it to the Core. This feature is really important in order to have board specific ADC calibration factors. This way we do not forget (once again) to merge this at some point !

This MR starting point will help define what is missing in order to have something generic with the new Shield/Spin separation.

Main testing procedure :

#include <DataAcquisition.h>

void main(void)
{
float32_t gains_ADC[6] = {0.2, 0.3, 0.43, 0.12, 0.30, 0.65};
float32_t offsets_ADC[6] = {0.42, 0.33, 0.243, 0.412, 0.350, 0.654};
size_t gains_size = sizeof(gains_ADC);
size_t offsets_size = sizeof(offsets_ADC);
dataAcquisition.saveCalibrationFactors(gains_ADC, offsets_ADC, gains_size, offsets_size);
float32_t gains_retrieved[gains_size];
float32_t offsets_retrieved[offsets_size];

dataAcquisition.getCalibrationFactors(gains_retrieved, offsets_retrieved, gains_size, offsets_size);
printk("gain 1 = %f \n", gains_retrieved[0]);
printk("gain 2 = %f \n", gains_retrieved[1]);
printk("gain 3 = %f \n", gains_retrieved[2]);
printk("gain 4 = %f \n", gains_retrieved[3]);
printk("gain 5 = %f \n", gains_retrieved[4]);
printk("gain 6 = %f \n", gains_retrieved[5]);
printk("offset 1 = %f \n", offsets_retrieved[0]);
printk("offset 2 = %f \n", offsets_retrieved[1]);
printk("offset 3 = %f \n", offsets_retrieved[2]);
printk("offset 4 = %f \n", offsets_retrieved[3]);
printk("offset 5 = %f \n", offsets_retrieved[4]);
printk("offset 6 = %f \n", offsets_retrieved[5]);
}

Signed-off-by: Jean Alinei jean.alinei@laas.fr

Merge request reports

Loading