Using PIR sensor to open and close drawer

Me and my group are having trouble with the code not doing what we want. The main goal of this project is to open and close a drawer with one PIR sensor (HC-SR501) as well as a second sensor opening the drawer halfway and closing all the way. We are using a Nema 23 Stepper motor with a DM542 Microstep Driver on an Arduino uno board.

I want the drawer to be opened all the way with the "fullsensor" then I want the drawer to stay open until the same sensor is tripped to then close the drawer. Same with with the "halfsensor" only open halfway. The code right now runs as if there is no nested if statement and goes back and forth when the sensor is tripped

I was trying to use a nested if statement but I just read that using those is not an ideal way. The code right now runs as if there is no nested if statement and goes back and forth when the sensor is tripped.There is probably a better way to code it but I am unsure (maybe a switch case?)

Thank you,

Cole

CODE:

#include <Stepper.h>

// Define a stepper and the pins it will use
Stepper mystepper(200, 4, 3);

const int fullsensor = 2;
const int halfsensor = 8;

void setup()
{

pinMode(halfsensor, INPUT);
pinMode(fullsensor, INPUT);
digitalWrite(halfsensor, LOW);
digitalWrite(fullsensor, LOW);
Serial.begin(9600);
mystepper.setSpeed(600);

//give the sensor some time to calibrate
Serial.print("calibrating sensor ");
for (int i = 0; i < 30; i++) {
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
}

void loop() {
if (digitalRead(fullsensor) == HIGH) {

mystepper.step(1000);

digitalWrite(fullsensor, LOW);
delay(1000);
if (digitalRead(fullsensor) == HIGH) {

mystepper.step(-1000);
digitalWrite(fullsensor, LOW);
delay(1000);
}
else {

}
}
if (digitalRead(halfsensor) == HIGH) {

mystepper.step(500);

digitalWrite(halfsensor, LOW);
delay(2000);
if (digitalRead(halfsensor) == HIGH) {

mystepper.step(-500);
digitalWrite(halfsensor, LOW);
delay(2000);
}
else {

}
}

}

pinMode(halfsensor, INPUT);
pinMode(fullsensor, INPUT);
digitalWrite(halfsensor, LOW);
digitalWrite(fullsensor, LOW);

Why did you use digitalWrite(halfsensor, LOW) after pinMode(halfsensor, INPUT) ?