void step_servoZ() {       		    // synchroniczne
	volatile ServoChannel &ser = servos[INNER_SERVOZ];

	if( pcb_type == 2 ){			// servos + magicled
	}else if(pcb_type == 3 ){		// actuators + magicled
		if( ser.moving != DRIVER_DIR_STOP ){
			ser.last_pos = analogRead(PIN_B3_IN_Z);
		//	Serial.println(ser.last_pos);
			if( ser.last_pos == z_last_val || (ser.last_pos - z_last_val) == 1){
				z_repeat++;
				if( z_repeat == 500 ){
					Serial.print("RRZSTOPS,");
					Serial.println(ser.last_pos);
					Serial.flush();
				}
			}else{
				z_repeat	=0;
				z_last_val	= ser.last_pos;
			}

			if( ser.moving == DRIVER_DIR_FORWARD ){
				if( ser.last_pos >= Z_MAX_VAL ){			// stop
					stopZ( false );
					sendZpos();
		//			Serial.println("-step, STOP Z max");
				}else if( ser.last_pos >= ser.target_pos ){
					stopZ( false );
					sendZpos();
				}
			}else if( ser.moving == DRIVER_DIR_BACKWARD ){
				if(  ser.last_pos <= Z_MIN_VAL ){			// stop
		//			Serial.println("-step, STOP Z min");
					stopZ( false );
					sendZpos();
				}else if( ser.last_pos <= ser.target_pos ){
					stopZ( false );
					sendZpos();
				}
			}
		}
	}
}
void arduinoThread::digitalPinChanged(const int & pinNum) {
    // note: this will throw tons of false positives on a bare mega, needs resistors
    if (curState == HOMING) {
        if (pinNum == X_LIMIT_PIN && ard.getDigital(X_LIMIT_PIN)) {
            stopX();
            homeY();
        }
        if (pinNum == Y_LIMIT_PIN && ard.getDigital(Y_LIMIT_PIN)) {
            stopY();
            homeZ();
        }
        if (pinNum == Z_LIMIT_PIN && ard.getDigital(Z_LIMIT_PIN)) {
            stopZ();
            curState = HOME;
        }
    }
    // if not homing or reseting and the switch is down, it's an error
    else if (curState != PREPRINT && curState != RESET && curState != HOME && curState != SHOOT_FACE) {
        if (ard.getDigital(pinNum) == ARD_HIGH){
            curState = ERROR;
        }
    }
}
void disableServosNow(){
	stopY( false );
	stopZ( false );
}