Help with adding a task into my code

I realized that after building my thermostat that I had forgotten one very important feature.. Being able to turn the fan on and off independently of the rest of the thermostat functions. So I added the code below. When I did, it will continue to read the set temp but not the read temp. Also, the code doesn't work to turn on the fan relay. I'm sure that I am missing something very simple.
What I want... I need the fan to be able to be turned on and while it is manually turned on I need the rest of the functions to not be executed. With the exception of reading the temperature.
Thanks

The part I'm having trouble with (I think)

// Turn the fan on or off 

do
{
  //Leaves the loop if Fan is switched on
  if (FanPin == HIGH)
  break;
  digitalWrite(SSRFan, HIGH);
  digitalWrite(SSRHPin, LOW);
  digitalWrite(SSRCPin, LOW);
  sensorValue = analogRead(sensorPin / 10.24);
} while (sensorValue > 50);

All of the code

/* A fair portion of the code here is from Arduinotronics and I would have been lost with out it. This is my first “big” Arduino project. So, there is probably a ton of things that can be improved on and tweeked. I would love to know your thoughts and see your improvements! If you would like to share your thoughts with me on this please email me at modsbyus at modsbyus dot com and make the subject line RE: Arduino Thermostat Thoughts, or write a comment on the tutorial at http://www.modsbyus.com/diy-arduino-thermostat/ */

#include <OneWire.h> //This temperature sensor requires a 4.7k Ohm resistor across its pins 2 and three!!!!
#include <DallasTemperature.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library
#define I2C_ADDR    0x20  // Define I2C Address where the PCF8574A is

#define BACKLIGHT_PIN     7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3

#define  LED_OFF  0
#define  LED_ON  1
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);


int sensorPin = A0;    // select the input pin for the 10K potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
int setTemp = 0; // variable to store value coming from the potentiometer
int SSRCPin = 5; //Turn on A/C unit
int SSRHPin = 6; //Turn on heat (electric or gas)
int hcLED = 4; //indicator for Cooling mode
int SwitchPin = 1; // To switch between Cooling and Heating
int SSRFan = 7; // To turn on and off the air handler fan
int FanPin = 8; //To turn on the fan only
int FanVal = digitalRead(FanPin);
char* heat;
float currentTemp = 0;



//This temperature sensor requires a 4.7k Ohm resistor across its pins 2 and three!!!! Thats the middle pin and the GND pin
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

DeviceAddress insideThermometer = { 0x28, 0xAF, 0x51, 0x6C, 0x04, 0x00, 0x00, 0x22 };
// DeviceAddress outsideThermometer = { 0x28, 0x20, 0x04, 0xA8, 0x02, 0x00, 0x00, 0x4D };

void setup(void)
{
// Start up the library
sensors.begin();
// set the resolution to 9 bit (good enough?)
sensors.setResolution(insideThermometer, 9);
// sensors.setResolution(outsideThermometer, 9);

lcd.begin (16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
pinMode(SSRFan, OUTPUT); //set airhandler fan pin as output
digitalWrite(SSRFan, LOW);
pinMode(SSRHPin, OUTPUT); 
digitalWrite(SSRHPin, LOW);
pinMode(SSRCPin, OUTPUT); 
digitalWrite(SSRCPin, LOW);
pinMode(hcLED, OUTPUT); 
digitalWrite(hcLED, LOW);
pinMode(SwitchPin, INPUT);
pinMode(FanPin, INPUT);
}

void printTemperature(DeviceAddress deviceAddress)
{
  
sensors.requestTemperatures();  // was in loop

float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
lcd.print("Error");
} else {
// lcd.print(tempC);
// lcd.print("/");
currentTemp = (DallasTemperature::toFahrenheit(tempC));
lcd.print(currentTemp);
}

}


void loop(void)
{
 
delay(500);

  sensorValue = analogRead(sensorPin);  
  
  setTemp = sensorValue / 10.24; //Gives us a set temp range between 0 and 99 degrees 

//lcd.clear(); // start with a blank screen
lcd.setCursor(0,0);
lcd.print("Current:");
lcd.setCursor(0,1);
lcd.print("Set:");
//lcd.setCursor(0,3);
//lcd.print("Heat: ");



lcd.setCursor(8,0);
printTemperature(insideThermometer);
lcd.setCursor(6,1);
lcd.print(setTemp);
//lcd.setCursor(7,3);
//lcd.print(heat);

// Turn the fan on or off 

do
{
  //Leaves the loop if Fan is switched on
  if (FanPin == HIGH)
  break;
  digitalWrite(SSRFan, HIGH);
  digitalWrite(SSRHPin, LOW);
  digitalWrite(SSRCPin, LOW);
  sensorValue = analogRead(sensorPin / 10.24);
} while (sensorValue > 50);


//Cooling Mode


int val = digitalRead(SwitchPin) ;// val represents digitalRead(SwitchPin);
// If the value of  is 1 then make hcLED low (off) which sets the relay in a normally closed state. Hence, turning on the blue LED.
  if (val == 1)
  {
  digitalWrite(hcLED, LOW);
  }
  
  /* If the SwitchPin reads 1 and the current temperature is greater than the set temperature (if its hot) turn on the A/C and internal fan */
  if (val == 1 && (currentTemp > setTemp))
 { 
  digitalWrite(SSRFan, HIGH);
  digitalWrite(SSRHPin, LOW);
  digitalWrite(SSRCPin, HIGH);
  }
  
  /* Otherwise, if the SwitchPin reads 1 and the current temperature is less than the set temperature (the set temperature has been reached), turn off the A/C and internal fan */
 else if (val == 1 && (currentTemp < setTemp))
 {
   digitalWrite(SSRCPin, LOW);
   digitalWrite(SSRFan, LOW);
 }
// Heating Mode

// If the value of  is 0 then make hcLED HIGH (on) which sets the relay in a normally open state. Hence, turning on the RED LED
if (val == 0)
  {
  digitalWrite(hcLED, HIGH);
  }
  
  /* If the SwitchPin reads 0 and the current temperature is less than the set temperature (if its cold) turn on the HEAT and internal fan */
  if (val == 0 && (currentTemp < setTemp))
  {
  digitalWrite(SSRFan, HIGH);
  digitalWrite(SSRCPin, LOW);  
  digitalWrite(SSRHPin, HIGH);
  }
  
  /* If the SwitchPin reads 0 and the current temperature is greater than the set temperature (the set temperature has been reached) turn off the HEAT and internal fan */
  else if (val == 0 && (currentTemp > setTemp))
  {
    digitalWrite(SSRHPin, LOW);
    digitalWrite(SSRFan, LOW);
}


 }

modsbyus:
Being able to turn the fan on and off independently of the rest of the thermostat functions.

The details of the behaviour you're after aren't clear.

I get the idea that you're comparing the actual temperature against a threshold and turning some devices on and off. And I get the idea that you want to have some sort of manual override controlled by a switch input.

Do you want the manual override to be able to turn the fans on regardless of temperature, or turn them off regardless of temperature, or something else? Making it do both is going to be rather hard with a single input - you would really need a tristate input (on, off, auto); you could achieve that with a three position switch using an analog input, if you are actually after that.

I want the manual override to be able to turn the fans on regardless of temperature. Nothing more.

modsbyus:
I want the manual override to be able to turn the fans on regardless of temperature. Nothing more.

In that case, in each place where you compared the temperature in the original sketch, add a check for the state of the manual override switch.

if(temperature > limit)
{
  // fans on etc
}

becomes

if((temperature > limit) || (digitalRead(ManualOverridePin) == HIGH))
{
  // fans on etc
}