ms5611: report P and T in ms5611 info

This commit is contained in:
Andrew Tridgell 2013-12-31 10:32:15 +11:00 committed by Lorenz Meier
parent 3be1a5182d
commit d6088efd34
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,8 @@ protected:
int32_t _TEMP;
int64_t _OFF;
int64_t _SENS;
float _P;
float _T;
/* altitude conversion calibration */
unsigned _msl_pressure; /* in kPa */
@ -623,6 +625,8 @@ MS5611::collect()
/* pressure calculation, result in Pa */
int32_t P = (((raw * _SENS) >> 21) - _OFF) >> 15;
_P = P * 0.01f;
_T = _TEMP * 0.01f;
/* generate a new report */
report.temperature = _TEMP / 100.0f;
@ -695,6 +699,8 @@ MS5611::print_info()
printf("TEMP: %d\n", _TEMP);
printf("SENS: %lld\n", _SENS);
printf("OFF: %lld\n", _OFF);
printf("P: %.3f\n", _P);
printf("T: %.3f\n", _T);
printf("MSL pressure: %10.4f\n", (double)(_msl_pressure / 100.f));
printf("factory_setup %u\n", _prom.factory_setup);