Right values on HTS221 after pressing the reset bottom

Hey there,

I have this problem that, only after i press the reset bottom, the values of the HTS221 sensor goes to "normal values"

Any thing that i can do to solve it?

#include <SPI.h>
#include <SD.h>
#include "bar_temp_sensor.h"
//#include "gyro_mag_acc_sensor.h"
#include "hum_temp_sensor.h"

const int CS_PIN = 10;

void setup() {
  
  
  BARO.begin();
  HTS.begin();

  Serial.begin(9600);
  while (!Serial) {
  ; 
  }
  Serial.print("Initializing SD card...");
  if (!SD.begin(CS_PIN))
  {
  Serial.println("initialization failed!");

  while (1);

  }

  Serial.println("initialization done.");

  
  }


void loop() {

    readbar();

   //read_gyro_mag_acc();
 
   
    read_hum_temp();

 
   delay(1000);
} 
#ifndef hum_temp_h
#define hum_temp_h
#include <SPI.h>
#include <SD.h>
#include <Arduino_HTS221.h>// Humadity and Temp Sensor


File temphum;

void read_hum_temp() {
  
  temphum = SD.open("temphum.txt", FILE_WRITE);

  Serial.print("Writing to temphum.txt...");
  
  if(temphum){

  float temperature = HTS.readTemperature();
  float humidity    = HTS.readHumidity();
    
  temphum.print("Temperature = ");
  temphum.print(temperature);
  temphum.println(" °C");

  Serial.print("Temperature = ");
  Serial.print(temperature);
  Serial.println(" C");

  temphum.print("Humidity    = ");
  temphum.print(humidity);
  temphum.println(" %");
  temphum.println();

  Serial.print("Humidity    = ");
  Serial.print(humidity);
  Serial.println(" %");
  Serial.println();
    
  }
  Serial.print ("Writing done temphum!");
  temphum.close();
}



#endif

Thanks

Where is readbar() defined?

Does it work if you comment out all code lines relating to the SD card?

Is define in the file below

#ifndef bar_temp_sensor_h
#define bar_temp_sensor_h
#include <SPI.h>
#include <SD.h>
#include <Arduino_LPS22HB.h> 

File baro;

void readbar() {
    
  baro = SD.open("baro.txt", FILE_WRITE);

   Serial.print("Writing to baro.txt...");
   
     if (baro){
     float pressure = BARO.readPressure();
     float temperature = BARO.readTemperature();
     baro.print("Pressure = ");
     baro.print(pressure);
     baro.println(" kPa");

     baro.print("Temperature = ");
     baro.print(temperature);
     baro.println(" C");
     
     Serial.print("Temperature = ");
     Serial.print(temperature);
     Serial.println(" C");
  
     Serial.println();
     }
     
   Serial.print ("Writing done baro!");
   baro.close();
  }

#endif

And yes they work all fine, without the SD card code lines