private void MoveInDirection(GVector3 direction) { if (m_moveReference == MoveReference.Relative) { SendCommandIfConnection(GCode3018Pro.AsRelative()); } else { SendCommandIfConnection(GCode3018Pro.AsAbsolute()); } if (!m_isMotorTheoriclyOn) { SendCommandIfConnection(GCode3018Pro.FastMove(direction)); } else { SendCommandIfConnection(GCode3018Pro.ControlledMove(direction, m_speedRateInMm)); } }
void Update() { Vector2 bedDirectionPrevious = bedDirection; bedDirection.x = Input.GetAxis("Horizontal"); bedDirection.y = Input.GetAxis("Vertical"); if (bedDirectionPrevious == Vector2.zero && bedDirection != bedDirectionPrevious) { m_sender.SendCommandDirectly( m_moveType == MoveReference.Relative ? GCode3018Pro.AsRelative() : GCode3018Pro.AsAbsolute()); } if (bedDirection != Vector2.zero) { m_sender.OverrideAllToPush( GCode3018Pro.FastMove( new GVector3( bedDirection.x * m_incrementInMM, bedDirection.y * m_incrementInMM, 0))); } }