Issues with IRremote + one wire (DHT22)

Hi
I have a problem that I cannot solve for 2 days. In my project i want to use IR remote controller for menu while I need to have access to temperature and humidity in the room. I used IRremote.h library by Ken Shirriff, and some code I found on the internet that is useful for temperature sensor. When I used only remote it was fine. The same for temperature, but when I wanted to use both functions it do not work. By trial and error method i found out that the problem is with IR initialization, ant then i realised it is timer 1/2 (library can use one of them) that causes problems for temperature reading.
If in IRremoteInt.h, instead of:

#define TIMER_CONFIG_NORMAL() ({ \
  TCCR1A = 0; \
  TCCR1B = _BV(WGM12) | _BV(CS10); \
  OCR1A = SYSCLOCK * USECPERTICK / 1000000; \
  TCNT1 = 0; \
})

I put this:

#define TIMER_CONFIG_NORMAL() ({ \
  TCCR1A = 0; \
  TCCR1B =/* _BV(WGM12) |*/ _BV(CS10); \
  OCR1A = SYSCLOCK * USECPERTICK / 1000000; \
  TCNT1 = 0; \
})

It works, but the problem is that i have no idea how to make IR running again. Of course the best situation is if i could make them both work in the same time.
The only function used during temperature reading that can cause troubles is delayMicroseconds(...);, but I can't figure how, because as far as I know it uses TC0...
You can find my code below. Function in loop may be not best, but I just want it working. When I achieve it I will make it useful.

#include <IRremote.h>
#include <LiquidCrystal.h>
#define irPin 3
LiquidCrystal lcd(12, 11, 5, 4, 6, 2);
IRrecv irrecv(irPin);
decode_results results;
#define dht_dpin 15 
#define SYSCLOCK F_CPU

byte bGlobalErr;
byte dht_dat[5];

float lastHumidity;        
float lastTemperatureC;        

const byte mask = 0x7f;        

void setup() {
    Serial.begin(9600);
   lcd.begin(16,2);
   irrecv.enableIRIn();
   InitDHT();
}
 
void loop() {
  

   if (irrecv.decode(&results))
   {
     if (results.value==16580863)  wybormenu();
         delay(250);
      irrecv.resume();         
 }


delay(2000);
obltemp();
lcd.clear();
lcd.print("Temp: ");
lcd.print(lastTemperatureC);
lcd.setCursor(0,1);
lcd.print("Wilg: ");
lcd.print(lastHumidity);

}
 int wybormenu ()
 {
      delay(250);
   irrecv.resume();
   char *menu[3]= {"menu1","menu2","menu3"};
   int i=0;
   lcd.clear();
   lcd.print(">> ");
   lcd.print(menu[i]);
   lcd.setCursor(0,1);
      lcd.print("   ");
   lcd.print(menu[i+1]);
   while(1)
   {
    if (irrecv.decode(&results)) {
      if (results.value==16601263)
      {
       if (i==0) i=2;
       else i--;
          lcd.clear();
   lcd.print(">> ");
   lcd.print(menu[i]);
   lcd.setCursor(0,1);
      lcd.print("   ");
      if (i==2) lcd.print(menu[0]);
   else   lcd.print(menu[i+1]);
   delay(250);
   irrecv.resume();
 }
      else if (results.value==16584943)
      {
       if (i==2) i=0;
       else i++;
          lcd.clear();
   lcd.print("   ");
   if (i==0) lcd.print(menu[2]);
   else lcd.print(menu[i-1]);
   lcd.setCursor(0,1);
      lcd.print(">> ");
lcd.print(menu[i]);
delay(250);
   irrecv.resume();
 }
 else if (results.value==16621663) {
  delay(250);
   irrecv.resume();
 return i; 
    }
 else if (results.value==16617583) {
   delay(250);
   irrecv.resume();
   return 1337;
 }
   
 else {
 delay(250);
   irrecv.resume();
    }
    }
   }
 }
 void obltemp()
 {
    // TCCR1B =  _BV(CS10);
    ReadDHT();
  switch (bGlobalErr){
     case 0:

        lastHumidity = (dht_dat[0]*256+dht_dat[1]);  //Calculate float for 10*humidity
        lastHumidity = lastHumidity/10;  //Calculate humidity

        if ((dht_dat[2] & mask) != dht_dat[2]) {   //if they're different, it's negative
           dht_dat[2]= dht_dat[2] & mask;
           lastTemperatureC = -1*(dht_dat[2]*256+dht_dat[3]);  //Calculate neg float 10*temperature C
        }
        else {   //if they're not different, it's positive
           lastTemperatureC = (dht_dat[2]*256+dht_dat[3]);  //Calculate float 10*temperature C
        }

	lastTemperatureC = lastTemperatureC/10;  //Calculate temperature C
        break;
     case 1:
     lcd.clear();
        lcd.print("Error 1: DHT start condition 1 not met.");
        delay(2000);
        break;
     case 2:
     lcd.clear();
        lcd.print("Error 2: DHT start condition 2 not met.");
        delay(2000);
        break;
     case 3:
     lcd.clear();
        lcd.print("Error 3: DHT checksum error.");
        delay(2000);
        break;
     default:
	 lcd.clear();
        lcd.print("Error: Unrecognized code encountered.");
        delay(2000);
        break;
     	}
 }
 
 void InitDHT(){
  	//DDRC |= _BV(dht_PIN);//set data pin... for now... as output
              //DDRC is data direction register for pins A0-5 are on
	//PORTC |= _BV(dht_PIN);//Set line high
            //  PORTC relates to the pins A0-5 are on.
        //Alternative code...
//        if (dht_dpin-14 != dht_PIN){Serial.println("ERROR- dht_dpin must be 14 more than dht_PIN");};//end InitDHT
        pinMode(dht_dpin,OUTPUT);// replaces DDRC... as long as dht_dpin=14->19
        digitalWrite(dht_dpin,HIGH);//Replaces PORTC |= if dht_pin=14->19
}//end InitDHT

void ReadDHT(){
/*Uses global variables dht_dat[0-4], and bGlobalErr to pass
  "answer" back. bGlobalErr=0 if read went okay.
  Depends on global dht_PIN for where to look for sensor.*/
bGlobalErr=0;
byte dht_in;
byte i;
  // Send "start read and report" command to sensor....
  // First: pull-down i/o pin for 18ms
digitalWrite(dht_dpin,LOW);//Was: PORTC &= ~_BV(dht_PIN);
delay(18);
//db deleted following line
//delay(5);//TKB, from Quine at Arduino forum
//Next line: Brings line high again,
//   second step in giving "start read..." command
digitalWrite(dht_dpin,HIGH);//Was: PORTC |= _BV(dht_PIN);
delayMicroseconds(30);//DHT22 datasheet says host should
   //keep line high 20-40us, then watch for sensor taking line
   //low. That low should last 80us. Acknowledges "start read
   //and report" command.
   //Getting the delay exacly right is critical...
   //  put 40 in for the delay, and the program
   //  will work SOMETIMES, but not ALWAYS.
   //  You have to allow for processing overheads,
   //  etc, too. Using, say, 30 won't "magically"
   //  make the TOTAL delay (with overheads, etc)
   //  exactly 30.0000 milliseconds.

//Next: Change Arduino pin to an input, to
//watch for the 80us low explained a moment ago.
pinMode(dht_dpin,INPUT);//Was: DDRC &= ~_BV(dht_PIN);

delayMicroseconds(40);

//Read the LO
dht_in=digitalRead(dht_dpin);//Was: dht_in = PINC & _BV(dht_PIN);

if(dht_in){
   bGlobalErr=1;//Was: Serial.println("dht11 start condition 1 not met");
   return;
   }//end "if..."
delayMicroseconds(80);

dht_in=digitalRead(dht_dpin);//Was: dht_in = PINC & _BV(dht_PIN);

if(!dht_in){
   bGlobalErr=2;//Was: Serial.println("dht11 start condition 2 not met");
   return;
   }//end "if..."

/*After 80us low, the line should be taken high for 80us by the
  sensor. The low following that high is the start of the first
  bit of the forty to come. The routine "read_dht_dat()"
  expects to be called with the system already into this low.*/
delayMicroseconds(80);
//now ready for data reception... pick up the 5 bytes coming from
//   the sensor
for (i=0; i<5; i++)
   dht_dat[i] = read_dht_dat();

//Next: restore pin to output duties
pinMode(dht_dpin,OUTPUT);//Was: DDRC |= _BV(dht_PIN);
//N.B.: Using DDRC put restrictions on value of dht_pin

//Next: Make data line high again, as output from Arduino
digitalWrite(dht_dpin,HIGH);//Was: PORTC |= _BV(dht_PIN);
//N.B.: Using PORTC put restrictions on value of dht_pin

//Next see if data received consistent with checksum received
byte dht_check_sum =
       dht_dat[0]+dht_dat[1]+dht_dat[2]+dht_dat[3];
/*Condition in following "if" says "if fifth byte from sensor
       not the same as the sum of the first four..."*/
if(dht_dat[4]!= dht_check_sum)
   {bGlobalErr=3;}//Was: Serial.println("DHT11 checksum error");
};//end ReadDHT()

byte read_dht_dat(){
//Collect 8 bits from datastream, return them interpreted
//as a byte. I.e. if 0000.0101 is sent, return decimal 5.

//Code expects the system to have recently entered the
//dataline low condition at the start of every data bit's
//transmission BEFORE this function is called.

  byte i = 0;
  byte result=0;
  for(i=0; i< 8; i++){
      //We enter this during the first start bit (low for 50uS) of the byte
      //Next: wait until pin goes high
      while(digitalRead(dht_dpin)==LOW);//Was: while(!(PINC & _BV(dht_PIN)));
            //signalling end of start of bit's transmission.


      delayMicroseconds(30);

      if (digitalRead(dht_dpin)==HIGH)//Was: if(PINC & _BV(dht_PIN))
 	   result |=(1<<(7-i));// "add" (not just addition) the 1
                      //to the growing byte
    //Next wait until pin goes low again, which signals the START
    //of the NEXT bit's transmission.
    while (digitalRead(dht_dpin)==HIGH);//Was: while((PINC & _BV(dht_PIN)));
    }//end of "for.."
  return result;
}//end of "read_dht_dat()"

Case closed. :stuck_out_tongue: Disabling interrupts before measuring temperature and enabling it after solved a problem.

Surrounding the read code with TIMER_DISABLE_INTR; and TIMER_ENABLE_INTR; resolved the problem for me. Thanks to johnny510 for directing me to the right direction.