Exemple #1
0
 public static string [] ControlledMove(MoveReference reference, GVector3 value)
 {
     return(new string[] {
         reference == MoveReference.Absolute? AsAbsolute(): AsRelative(),
         GCode3018Pro.ControlledMove(value)
     });
 }
    public string[] GetCommands()
    {
        List <string> cmds    = new List <string>();
        int           centerX = (int)(m_width * m_mmPerPixels / 2f);
        int           centerY = (int)(m_height * m_mmPerPixels / 2f);

        cmds.Add(GCode3018Pro.AsAbsolute());
        for (int i = 0; i < m_pixels.Length; i++)
        {
            float x, y;
            GetCoordonateOf(i, out x, out y);
            x -= centerX;
            y -= centerY;
            x *= m_mmPerPixels;
            y *= m_mmPerPixels;
            if (m_pixels[i] != Color.white)
            {
                cmds.Add("Z0");
                cmds.Add(GCode3018Pro.FastMove(new GVector3(x, y, 0)));
                cmds.Add("Z-1");
                cmds.Add("Z0");
            }
        }
        return(cmds.ToArray());
    }
Exemple #3
0
 public void SetRotationSpeed(float rotationPerMinutes)
 {
     m_rotationSpeed = rotationPerMinutes;
     SendCommandIfConnection(
         GCode3018Pro.RotationSpeed(rotationPerMinutes)
         );
 }
Exemple #4
0
 public static string[] ControlledMove(MoveReference reference, GVector3 value, float feedrate, float extraction)
 {
     return(new string[] {
         reference == MoveReference.Absolute? AsAbsolute(): AsRelative(),
         GCode3018Pro.ControlledMove(value, feedrate, extraction)
     });
 }
Exemple #5
0
    public void SetMotor(bool onOff)
    {
        m_isMotorTheoriclyOn = onOff;

        if (onOff)
        {
            SendCommandIfConnection(
                m_clockwise ? GCode3018Pro.StartMotorClockwise() :
                GCode3018Pro.StartMotorCounterClockwise());
        }
        else
        {
            SendCommandIfConnection(GCode3018Pro.StopMotor());
        }
        SetRotationSpeed(m_rotationSpeed);
    }
Exemple #6
0
    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));
        }
    }
Exemple #7
0
    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)));
        }
    }
 public void SendPauseRequest()
 {
     GRBLConnection.TryToSendCommand(GCode3018Pro.PauseDeviceJobs());
 }
Exemple #9
0
 public void ResumeDevice()
 {
     GRBLConnection.TryToSendCommand(GCode3018Pro.ResumeDeviceJobs());
 }
Exemple #10
0
 public void GoToHome()
 {
     SendCommandIfConnection(GCode3018Pro.GoHome());
 }
Exemple #11
0
 public void SaveAsHome()
 {
     SendCommandIfConnection(GCode3018Pro.SetHomeWithCurrent());
 }
Exemple #12
0
 public void SaveAsWorkspace()
 {
     SendCommandIfConnection(GCode3018Pro.SaveWorkspace());
 }
Exemple #13
0
 public void RequestGeneralInformation()
 {
     m_connection.SendRawCommand(GCode3018Pro.RequestSettingInfo());
 }
Exemple #14
0
 public void RequestStateInformation()
 {
     m_connection.SendRawCommand(GCode3018Pro.RequestStateInfo());
 }