   Serial.println();
 
   init_lcd();
-  lcd.print("Init v8");
-
+  lcdStatus("Initialisaing");
   init_wifi();
-
   connectWithBroker();
 
   // Start the DHT22
   publishDebug("WiFi On");
-
-
   publishDebug("Initialising Sensors");
   dht.begin();
   Serial.println("sensor is starting..");
   Serial.print("Reading Analog...");
   Serial.println(analogRead(0));
-  initMotor();
+
   initSwitches();
-  initTimers();
+  calibrateMotor();
+
+  // Start the timers
+  initMotorTimer();
+  startMotorTimer();
+  initEnvironmentTimer();
+  startEnvironmentTimer();
+
+  publishDebug("Setup complete");
+  lcdStatus("Setup complete");
 //----------------- wifi_set_sleep_type(LIGHT_SLEEP_T);
 //----------------- gpio_pin_wakeup_enable(GPIO_ID_PIN(2),GPIO_PIN_INTR_HILEVEL);
 }

#include "SensitiveConfig_incubatorcontroller.h"
#include <Time.h>

// void init_lcd();
// void configureOTA();
// void init_wifi();
// void initTimers();
// void environmentTimerFinished(void *pArg);
// void trayTiltTimerFinished(void *pArg);
// void readDHTSensor();
// void connectWithBroker();
// void publishPayload();
// void displayLCD();
// void debugDisplayPayload();
void callback(char* topic, byte* payload, unsigned int length);

// Configure 2 line LCD display with I2C interface

  lcdStatus("Motor off");
}

// Sensors

void motorSwitchLeftActivated() {
  state = MOTOR_SWITCH_DETECTED;
  motorSwitchDetected = MOTOR_SWITCH_LEFT;
}

void motorSwitchRightActivated() {
  state = MOTOR_SWITCH_DETECTED;
  motorSwitchDetected = MOTOR_SWITCH_RIGHT;
}

void motorSwitchAction() {
  state = PUBLISHING_ENVIRONMENT_EVENT;
