diff --git a/fw/Core/Src/scd4x.c b/fw/Core/Src/scd4x.c index b146763..b39fcdf 100644 --- a/fw/Core/Src/scd4x.c +++ b/fw/Core/Src/scd4x.c @@ -88,7 +88,7 @@ int8_t scd4x_read_measurement(int * co2, int *temperature, int *relative_humidit uint32_t co2_ticks = (buffer[0] << 8) + buffer[1]; uint32_t t_ticks = (buffer[3] << 8) + buffer[4]; uint32_t rh_ticks = (buffer[6] << 8) + buffer[7]; - int t_degC = -45 + 175 * t_ticks / 65535; + int t_degC = 10*(-45 + 175 * t_ticks / 65535); int rh_pRH = 100 * rh_ticks / 65535; if (rh_pRH > 100) { rh_pRH = 100; diff --git a/fw/Core/Src/sht4x.c b/fw/Core/Src/sht4x.c index 305083a..f07d94c 100644 --- a/fw/Core/Src/sht4x.c +++ b/fw/Core/Src/sht4x.c @@ -25,9 +25,11 @@ int8_t sht4x_measure(int *temperature, int *relative_humidity) // start measurement buffer[0] = START_MEAS_HIGH_PRECISION; result = i2c_transmit(SHT4X_I2C_ADDRESS<<1, buffer, 1); + // TODO: Proc to vraci NACK? Vyresit. + /* if (result != I2C_OK) { return SHT4X_ERROR; - } + }*/ LL_mDelay(100); // 10 ms should be enough // read out result = i2c_receive(SHT4X_I2C_ADDRESS<<1, buffer, 6); @@ -38,7 +40,7 @@ int8_t sht4x_measure(int *temperature, int *relative_humidity) // Convert to T and RH; taken directly from pseudocode in SHT4x datasheet, page 3 uint32_t t_ticks = (buffer[0] << 8) + buffer[1]; uint32_t rh_ticks = (buffer[3] << 8) + buffer[4]; - int t_degC = -45 + 175 * t_ticks / 65535; + int t_degC = 10*(-45 + 175 * t_ticks / 65535); int rh_pRH = -6 + 125 * rh_ticks / 65535; if (rh_pRH > 100) { rh_pRH = 100;