         break;
       case 0x20DF10EF: // tv remore on/off
         tvPowerStatus = ! tvPowerStatus ;
+        if ( tvPowerStatus == 1 ){
+          timerOnOff = 0 ;
+        }
+        t = !t;
         r = !r;
         break;
     }

void turn_onoff_tv(int a)
{
  if ( o_wrkMode == 1 && o_startMode == 1 ) {
    if ( o_pwrSrc == 0 ) {
        if ( a == 1 && tvPowerStatus == 1) {
          irSendTv(0);
          tv_off_Mills = millis();
          tv_on_Mills = millis();
          timerOnOff = 1;
          r = !r;
        }

        if ( a == 0 && tvPowerStatus == 0) {
          irSendTv(1);
          tv_off_Mills = millis();
          tv_on_Mills = millis();
          timerOnOff = 0;
          r = !r;
        }
    } else {
        if ( a == 1 ) {
          irSendTv(0);
          tv_off_Mills = millis();
          tv_on_Mills = millis();
          timerOnOff = 1;
          r = !r;
        }

        if ( a == 0 ) {
          irSendTv(1);
          tv_off_Mills = millis();
          tv_on_Mills = millis();
          timerOnOff = 0;
          r = !r;
        }      
    }

  }
}


  startMills = millis();
  tempMills = millis();
  o_tempMills = millis();
  tv_onoff_Mills = millis();

  // lcd
  lcd.init();
