rotary encoder switching variables between functions

Hey guys,
I have been at this one all day. Any help would be really appreciated at this point.

I am trying to change the value of a global variable, “leg_set_1”, after an encoder has reached a certain number to “leg_set_1=1”, and then back to, “leg_set_1=0”, when the second encoder reaches a certain number. Here is my code so far. I think I am missing a very small step. Any help would be very appreciated, thanks.

The problem I am having, is that when this condition is met, “old_state_2A >= enc_angle_max”, the variable “leg_set_1” does not go back to 0, but seems to stay at 1, or jump between 0 an 1.

void loop() {              
  joystick_read ();          
  if (js_state_1 == LOW){
    read_encoders ();              
    if (leg_set_1 == 0){    
      servo_1 (0,1);
    }       
    if (leg_set_1 == 1){    
      servo_2 (0,1);   
    }     
    if (leg_set_1 == 2){    
      servo_1 (1,0);
    }                
  }
  if (js_state_1 == HIGH ){
    for (int mb_pin = 0; mb_pin < motor_bridge_pins; mb_pin++) {
      analogWrite (motor_bridge[mb_pin], 0);           
    }         
    leg_set_1 = 0;
    move_all = 0;    
  }    
  if (js_state_2 == LOW){
  }    
}

void joystick_read (){
  js_state_1 = digitalRead(js_switch[0]); //direction, pin 43
  js_state_2 = digitalRead(js_switch[1]); //direction, pin 44
  js_state_3 = digitalRead(js_switch[2]); //direction, pin 45
  js_state_4 = digitalRead(js_switch[3]); //direction, pin 47
}

void read_encoders() {
  long new_enc_1A;     
  new_enc_1A = enc_1A.read();
  if (new_enc_1A != old_state_1A) {
    old_state_1A = new_enc_1A;
    Serial.println(old_state_1A);
  }  
  long new_enc_2A;   
  new_enc_2A = enc_2A.read();
  if (new_enc_2A != old_state_2A) {
    old_state_2A = new_enc_2A;
    Serial.println(old_state_2A);
  }  
}

void servo_1 (int set_m0, int set_m1){ 
  if (old_state_1A >= enc_angle_min && old_state_1A <= enc_angle_max){ 
    analogWrite (motor_bridge[set_m0], set_speed);
    analogWrite (motor_bridge[set_m1], 0);    
    Serial.println("turtle foot up!");        
  }
  if (old_state_1A >= enc_angle_max) {
    analogWrite (motor_bridge[set_m0], 0);
    analogWrite (motor_bridge[set_m1], 0); 
    leg_set_1 = 1;
  }  
}

void servo_2 (int set_m0, int set_m1){    
  if (old_state_2A >= enc_angle_min && old_state_2A <= enc_angle_max){ 
    analogWrite (motor_bridge[set_m0], set_speed);
    analogWrite (motor_bridge[set_m1], 0);    
    Serial.println("turtle hip forward!");        
  }
  if (old_state_2A >= enc_angle_max) {
    analogWrite (motor_bridge[set_m0], 0);
    analogWrite (motor_bridge[set_m1], 0);
    leg_set_1 = 0;           
  }     
}