Exemplo n.º 1
0
        private void TimerUpdate()
        {
            SuspendLayout();
            TTTStatus.Text = GrblCore.TranslateEnum(Core.MachineStatus);

            if (Core.InProgram)
            {
                TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.ProjectedTime, Tools.Utils.TimePrecision.Minute, Tools.Utils.TimePrecision.Second, " ,", true);
            }
            else
            {
                TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.LoadedFile.EstimatedTime, Tools.Utils.TimePrecision.Minute, Tools.Utils.TimePrecision.Second, " ,", true);
            }

            if (Core.InProgram)
            {
                TTLEstimated.Text = Strings.MainFormProjectedTime;
            }
            else
            {
                TTLEstimated.Text = Strings.MainFormEstimatedTime;
            }

            MnFileOpen.Enabled     = Core.CanLoadNewFile;
            MnSaveProgram.Enabled  = Core.HasProgram;
            MnFileSend.Enabled     = Core.CanSendFile;
            MnExportConfig.Enabled = Core.CanImportExport;
            MnImportConfig.Enabled = Core.CanImportExport;
            MnGrblReset.Enabled    = Core.CanResetGrbl;

            MNEsp8266.Visible = ((ComWrapper.WrapperType)Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial)) == ComWrapper.WrapperType.LaserWebESP8266;

            MnConnect.Visible    = !Core.IsOpen;
            MnDisconnect.Visible = Core.IsOpen;

            MnGoHome.Enabled = Core.CanGoHome;
            MnUnlock.Enabled = Core.CanGoHome;

            TTOvG0.Visible = Core.SupportOverride;
            TTOvG1.Visible = Core.SupportOverride;
            TTOvS.Visible  = Core.SupportOverride;
            spacer.Visible = Core.SupportOverride;


            switch (Core.MachineStatus)
            {
            //Disconnected, Connecting, Idle, *Run, *Hold, *Door, Home, *Alarm, *Check, *Jog

            case GrblCore.MacStatus.Alarm:
                TTTStatus.BackColor = Color.Red;
                TTTStatus.ForeColor = Color.White;
                break;

            case GrblCore.MacStatus.Door:
            case GrblCore.MacStatus.Hold:
                TTTStatus.BackColor = Color.DarkOrange;
                TTTStatus.ForeColor = Color.Black;
                break;

            case GrblCore.MacStatus.Jog:
            case GrblCore.MacStatus.Run:
            case GrblCore.MacStatus.Check:
                TTTStatus.BackColor = Color.LightGreen;
                TTTStatus.ForeColor = Color.Black;
                break;

            default:
                TTTStatus.BackColor = ColorScheme.FormBackColor;
                TTTStatus.ForeColor = ColorScheme.FormForeColor;
                break;
            }

            LblX.Text = string.Format("X: {0:0.000}", Core.LaserPosition.X);
            LblY.Text = string.Format("Y: {0:0.000}", Core.LaserPosition.Y);

            ResumeLayout();
        }
Exemplo n.º 2
0
        private void TimerUpdate()
        {
            SuspendLayout();
            TTTStatus.Text = GrblCore.TranslateEnum(Core.MachineStatus);

            if (Core.InProgram)
            {
                TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.ProjectedTime, Tools.Utils.TimePrecision.Minute, Tools.Utils.TimePrecision.Second, " ,", true);
            }
            else
            {
                TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.LoadedFile.EstimatedTime, Tools.Utils.TimePrecision.Minute, Tools.Utils.TimePrecision.Second, " ,", true);
            }

            if (Core.InProgram)
            {
                TTLEstimated.Text = Strings.MainFormProjectedTime;
            }
            else
            {
                TTLEstimated.Text = Strings.MainFormEstimatedTime;
            }

            MnFileOpen.Enabled          = Core.CanLoadNewFile;
            MnAdvancedSave.Enabled      = MnSaveProgram.Enabled = Core.HasProgram;
            MnFileSend.Enabled          = Core.CanSendFile;
            MnStartFromPosition.Enabled = Core.CanSendFile;
            MnRunMulti.Enabled          = Core.CanSendFile || Core.CanResumeHold || Core.CanFeedHold;
            MnGrblConfig.Enabled        = true;
            //MnExportConfig.Enabled = Core.CanImportExport;
            //MnImportConfig.Enabled = Core.CanImportExport;
            MnGrblReset.Enabled = Core.CanResetGrbl;

            MNEsp8266.Visible = (Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial)) == ComWrapper.WrapperType.LaserWebESP8266;

            MnConnect.Visible    = !Core.IsConnected;
            MnDisconnect.Visible = Core.IsConnected;

            MnGoHome.Visible = Core.Configuration.HomingEnabled;
            MnGoHome.Enabled = Core.CanDoHoming;
            MnUnlock.Enabled = Core.CanUnlock;

            TTOvG0.Visible = Core.SupportOverride;
            TTOvG1.Visible = Core.SupportOverride;
            TTOvS.Visible  = Core.SupportOverride;
            spacer.Visible = Core.SupportOverride;

            ComWrapper.WrapperType wt = Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial);
            MnWiFiDiscovery.Visible = wt == ComWrapper.WrapperType.LaserWebESP8266 || wt == ComWrapper.WrapperType.Telnet;

            switch (Core.MachineStatus)
            {
            //Disconnected, Connecting, Idle, *Run, *Hold, *Door, Home, *Alarm, *Check, *Jog

            case GrblCore.MacStatus.Alarm:
                TTTStatus.BackColor = Color.Red;
                TTTStatus.ForeColor = Color.White;
                break;

            case GrblCore.MacStatus.Door:
            case GrblCore.MacStatus.Hold:
            case GrblCore.MacStatus.Cooling:
                TTTStatus.BackColor = Color.DarkOrange;
                TTTStatus.ForeColor = Color.Black;
                break;

            case GrblCore.MacStatus.Jog:
            case GrblCore.MacStatus.Run:
            case GrblCore.MacStatus.Check:
                TTTStatus.BackColor = Color.LightGreen;
                TTTStatus.ForeColor = Color.Black;
                break;

            default:
                TTTStatus.BackColor = ColorScheme.FormBackColor;
                TTTStatus.ForeColor = ColorScheme.FormForeColor;
                break;
            }

            PbBuffer.Maximum     = Core.BufferSize;
            PbBuffer.Value       = Core.UsedBuffer;
            PbBuffer.ToolTipText = $"Buffer: {Core.UsedBuffer}/{Core.BufferSize} Free:{Core.FreeBuffer}";
            MnOrtur.Visible      = Core.IsOrturBoard;

            ResumeLayout();
        }