 // Initialise Timers
 
 void initTimers() {
+  // This timer is for taking temperature and humidity readings
   os_timer_setfn(&environmentTimer, environmentTimerFinished, NULL);
   os_timer_arm(&environmentTimer,10000, true);
 
+  // This timer is for tilting the tray (by activating the motor)
+
   os_timer_setfn(&trayTiltTimer, trayTiltTimerFinished, NULL);
-  os_timer_arm(&trayTiltTimer,15000, true);
+  os_timer_arm(&trayTiltTimer,30000, true);
 }
 
 void initSwitches() {
   // Configure the ports for reading the motor switches
   publishDebug("Configuring switch sensors");
   lcdStatus("Init switch sensors");
+  // pinMode(PORT_MOTOR_SWITCH_LEFT, INPUT_PULLUP);
+  // pinMode(PORT_MOTOR_SWITCH_RIGHT, INPUT_PULLUP);
+
   pinMode(PORT_MOTOR_SWITCH_LEFT, INPUT_PULLUP);
   pinMode(PORT_MOTOR_SWITCH_RIGHT, INPUT_PULLUP);
+
+  // pinMode(PORT_TIMER_SWITCH, INPUT_PULLUP);
   pinMode(BUILTIN_LED, OUTPUT);
-  attachInterrupt(PORT_MOTOR_SWITCH_LEFT, motorSwitchLeftActivated, FALLING);
-  attachInterrupt(PORT_MOTOR_SWITCH_RIGHT, motorSwitchRightActivted, FALLING);
+  attachInterrupt(PORT_MOTOR_SWITCH_LEFT, motorSwitchLeftActivated, HIGH);
+  attachInterrupt(PORT_MOTOR_SWITCH_RIGHT, motorSwitchRightActivated, HIGH);
+  // attachInterrupt(PORT_TIMER_SWITCH, timerSwitchActivated, FALLING);
   delay(1000);
 }
 

    // change the tilt of the tray

    isTrayTiltTimerComplete = false;

    Serial.println("Tray tilt timer completed");
    publishDebug("Tray tilt time completed");
    //lcd.setCursor(0,2);
    lcd.setCursor(0,1);
    lcd.print("Tray tilting");
    publishDebug("Tray tilting");
    delay(500);
    //lcd.setCursor(0,2);
    lcd.setCursor(0,1);
    lcdClearLine();
    publishDebug("Tray tilting completed");

  }
  ArduinoOTA.handle();
  delay(300);

  //publishDebug("Initialising Motor");
  initMotor();
  initSwitches();
  //publishDebug("Initialising Timers");
  //initTimers();
  initTimers();
//----------------- wifi_set_sleep_type(LIGHT_SLEEP_T);
//----------------- gpio_pin_wakeup_enable(GPIO_ID_PIN(2),GPIO_PIN_INTR_HILEVEL);
