I know it isn't the problem, but in each case
tmax = set_temp_max();
tmin = set_temp_min();
...
hmax = set_hum_max();
hmin = set_hum_min();
you're returning a global value - why?
I know it isn't the problem, but in each case
tmax = set_temp_max();
tmin = set_temp_min();
...
hmax = set_hum_max();
hmin = set_hum_min();
you're returning a global value - why?