Function which should obviously run doesn't

I’m working on some functions for my lift. I have a function that runs the lift all the way down and uses a potentiometer. However, when I call it, it doesn’t run. Things you need to know: the potentiometer value decreases as I go up, positive speeds run the lift up, negative down, and I have a ‘break-out’ just in case the lift gets stuck or if the driver wants to just stop the process. Code below:

void driveMainLift(int speed) {

	motor[leftMainLift] = speed;
	motor[rightMainLift] = speed;

}

void driveLiftToSpecificPotentValue(int setPoint, int speed) { 

	if(setPoint < SensorValue[mainLiftPotent]) { //if true that means lift must run up, giving a postive value

		while(SensorValue[mainLiftPotent] > setPoint) { //keep lifting up until reach setPoint

			driveMainLift(fabs(speed));
                        wait1Msec(cycleTime); //buffer time

		}

	}

	else if (setPoint > SensorValue[mainLiftPotent]) { //if true that means lift must run dowm, giving a negative value

		while(SensorValue[mainLiftPotent] < setPoint) { //keep lifting up until reach setPoint

			driveMainLift(-fabs(speed));
                        wait1Msec(cycleTime); //buffer time

		}

	}

	else { //if there is a special case or something went wrong then set to 0 (its a safety check really)

		driveMainLift(0);

	}

	driveMainLift(0); //another safety check after the process of moving is down because I have ocd

}

void moveLiftAllTheWayDown() { //used during driving period

	if(vexRT[Btn6UXmtr2]) { //if button six up is pressed

		bool quitLiftFunction = false; //quit function bool

		while((SensorValue[mainLiftPotent] > 3400) && !quitLiftFunction) { //keep looping (3400 is a good 'low' point I chose)

			driveLiftToSpecificPotentValue(3400, 120);

			if(vexRT[Btn6DXmtr2]) { //if you want to quit function press button 6 down

				quitLiftFunction = true;

			}
			
			chassisDriverControl(); //other driver functions so that they aren't cut off while lift doing its thing

			mainLiftDriverControl();

			intakeMoverDriverControl();

			wait1Msec(cycleTime); //buffer time

		}

		driveMainLift(0); //ocd

		quitLiftFunction = false; //ocd

	}

}

Are you using a partner joystick for this?

vexRT[Btn6UXmtr2]

yes

Maybe I’m confused, but you wrote “the potentiometer value decreases as I go up” and have in the code go down “while((SensorValue[mainLiftPotent] > 3400) && !quitLiftFunction).” If the potentiometer value is lower higher up, and your goal is to lower the thing (so it should be higher than the bottom), and assuming 3400 is the bottom value, shouldn’t you be checking for <3400 instead of >3400 to be lowering it?