Fix implementation.

This commit is contained in:
H. Utku Maden 2021-05-02 17:32:12 +03:00
parent 2d174950f1
commit 3a5f280bfe
2 changed files with 10 additions and 5 deletions

@ -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);
} }