mirror of
https://github.com/utkumaden/esp-idf-bmx280
synced 2025-01-23 13:36:33 +01:00
Fix implementation.
This commit is contained in:
parent
2d174950f1
commit
3a5f280bfe
6
bmx280.c
6
bmx280.c
@ -417,10 +417,12 @@ esp_err_t bmx280_getMode(bmx280_t* bmx280, bmx280_mode_t* mode)
|
|||||||
switch (ctrl_mes)
|
switch (ctrl_mes)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return ctrl_mes;
|
*mode = ctrl_mes; break;
|
||||||
case (BMX280_MODE_FORCE + 1):
|
case (BMX280_MODE_FORCE + 1):
|
||||||
return BMX280_MODE_FORCE;
|
*mode = BMX280_MODE_FORCE; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bmx280_isSampling(bmx280_t* bmx280)
|
bool bmx280_isSampling(bmx280_t* bmx280)
|
||||||
|
@ -85,8 +85,11 @@ esp_err_t bmx280_readout(bmx280_t *bmx280, int32_t *temperature, uint32_t *press
|
|||||||
*/
|
*/
|
||||||
static inline void bmx280_readout2float(int32_t* tin, uint32_t *pin, uint32_t *hin, float *tout, float *pout, float *hout)
|
static inline void bmx280_readout2float(int32_t* tin, uint32_t *pin, uint32_t *hin, float *tout, float *pout, float *hout)
|
||||||
{
|
{
|
||||||
|
if (tin && tout)
|
||||||
*tout = (float)*tin * 0.01f;
|
*tout = (float)*tin * 0.01f;
|
||||||
|
if (pin && pout)
|
||||||
*pout = (float)*pin * (1.0f/256.0f);
|
*pout = (float)*pin * (1.0f/256.0f);
|
||||||
|
if (hin && hout)
|
||||||
*hout = (*hin == UINT32_MAX) ? -1.0f : (float)*hin * (1.0f/1024.0f);
|
*hout = (*hin == UINT32_MAX) ? -1.0f : (float)*hin * (1.0f/1024.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user