Beispiel #1
0
 internal static void CreateAndShowDialog(GrblCore core)
 {
     using (SettingsForm sf = new SettingsForm(core))
         sf.ShowDialog();
 }
Beispiel #2
0
        public SettingsForm(GrblCore core)
        {
            InitializeComponent();

            this.Core = core;

            BackColor = ColorScheme.FormBackColor;
            ForeColor = ColorScheme.FormForeColor;
            TpRasterImport.BackColor = TpHardware.BackColor = TpJogControl.BackColor = TpAutoCooling.BackColor = TpGCodeSettings.BackColor = BtnCancel.BackColor = BtnSave.BackColor = TpSoundSettings.BackColor = changeConBtn.BackColor = changeDconBtn.BackColor = changeFatBtn.BackColor = changeSucBtn.BackColor = changeWarBtn.BackColor = ColorScheme.FormBackColor;

            InitCoreCB();
            InitProtocolCB();
            InitStreamingCB();
            InitThreadingCB();

            CBCore.SelectedItem          = Settings.GetObject("Firmware Type", Firmware.Grbl);
            CBSupportPWM.Checked         = Settings.GetObject("Support Hardware PWM", true);
            CBProtocol.SelectedItem      = Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial);
            CBStreamingMode.SelectedItem = Settings.GetObject("Streaming Mode", GrblCore.StreamingMode.Buffered);
            CbUnidirectional.Checked     = Settings.GetObject("Unidirectional Engraving", false);
            CbDisableSkip.Checked        = Settings.GetObject("Disable G0 fast skip", false);
            CbThreadingMode.SelectedItem = Settings.GetObject("Threading Mode", GrblCore.ThreadingMode.UltraFast);
            CbIssueDetector.Checked      = !Settings.GetObject("Do not show Issue Detector", false);
            CbSoftReset.Checked          = Settings.GetObject("Reset Grbl On Connect", true);
            CbHardReset.Checked          = Settings.GetObject("HardReset Grbl On Connect", false);

            CbContinuosJog.Checked = Settings.GetObject("Enable Continuous Jog", false);
            CbEnableZJog.Checked   = Settings.GetObject("Enale Z Jog Control", false);

            CbHiRes.Checked = Settings.GetObject("Raster Hi-Res", false);

            TBHeader.Text      = Settings.GetObject("GCode.CustomHeader", GrblCore.GCODE_STD_HEADER);
            TBHeader.ForeColor = ColorScheme.FormForeColor;
            TBHeader.BackColor = ColorScheme.FormBackColor;
            TBPasses.Text      = Settings.GetObject("GCode.CustomPasses", GrblCore.GCODE_STD_PASSES);
            TBPasses.ForeColor = ColorScheme.FormForeColor;
            TBPasses.BackColor = ColorScheme.FormBackColor;
            TBFooter.Text      = Settings.GetObject("GCode.CustomFooter", GrblCore.GCODE_STD_FOOTER);
            TBFooter.ForeColor = ColorScheme.FormForeColor;
            TBFooter.BackColor = ColorScheme.FormBackColor;

            CbPlaySuccess.Checked    = Settings.GetObject($"Sound.{SoundEvent.EventId.Success}.Enabled", true);
            CbPlayWarning.Checked    = Settings.GetObject($"Sound.{SoundEvent.EventId.Warning}.Enabled", true);
            CbPlayFatal.Checked      = Settings.GetObject($"Sound.{SoundEvent.EventId.Fatal}.Enabled", true);
            CbPlayConnect.Checked    = Settings.GetObject($"Sound.{SoundEvent.EventId.Connect}.Enabled", true);
            CbPlayDisconnect.Checked = Settings.GetObject($"Sound.{SoundEvent.EventId.Disconnect}.Enabled", true);

            successSoundLabel.Text    = System.IO.Path.GetFileName(Settings.GetObject($"Sound.{SoundEvent.EventId.Success}", $"Sound\\{SoundEvent.EventId.Success}.wav"));
            SuccesFullLabel.Text      = Settings.GetObject($"Sound.{SoundEvent.EventId.Success}", $"Sound\\{SoundEvent.EventId.Success}.wav");
            warningSoundLabel.Text    = System.IO.Path.GetFileName(Settings.GetObject($"Sound.{SoundEvent.EventId.Warning}", $"Sound\\{SoundEvent.EventId.Warning}.wav"));
            WarningFullLabel.Text     = Settings.GetObject($"Sound.{SoundEvent.EventId.Warning}", $"Sound\\{SoundEvent.EventId.Warning}.wav");
            fatalSoundLabel.Text      = System.IO.Path.GetFileName(Settings.GetObject($"Sound.{SoundEvent.EventId.Fatal}", $"Sound\\{SoundEvent.EventId.Fatal}.wav"));
            ErrorFullLabel.Text       = Settings.GetObject($"Sound.{SoundEvent.EventId.Fatal}", $"Sound\\{SoundEvent.EventId.Fatal}.wav");
            connectSoundLabel.Text    = System.IO.Path.GetFileName(Settings.GetObject($"Sound.{SoundEvent.EventId.Connect}", $"Sound\\{SoundEvent.EventId.Connect}.wav"));
            ConnectFullLabel.Text     = Settings.GetObject($"Sound.{SoundEvent.EventId.Connect}", $"Sound\\{SoundEvent.EventId.Connect}.wav");
            disconnectSoundLabel.Text = System.IO.Path.GetFileName(Settings.GetObject($"Sound.{SoundEvent.EventId.Disconnect}", $"Sound\\{SoundEvent.EventId.Disconnect}.wav"));
            DisconnectFullLabel.Text  = Settings.GetObject($"Sound.{SoundEvent.EventId.Disconnect}", $"Sound\\{SoundEvent.EventId.Disconnect}.wav");

            groupBox1.ForeColor = groupBox2.ForeColor = groupBox3.ForeColor = ColorScheme.FormForeColor;

            SuccesFullLabel.Visible = WarningFullLabel.Visible = ErrorFullLabel.Visible = ConnectFullLabel.Visible = DisconnectFullLabel.Visible = false;

            InitAutoCoolingTab();
        }
Beispiel #3
0
 internal static void CreateAndShowDialog(GrblCore core)
 {
     using (GrblConfig sf = new GrblConfig(core))
         sf.ShowDialog();
 }
Beispiel #4
0
 public ToolStripTraceBarItem(GrblCore core, int function)
     : base(new UserControls.LabelTB(core, function))
 {
     Control.Dock = System.Windows.Forms.DockStyle.Fill;
 }
Beispiel #5
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;
            MnStartFromPosition.Enabled = Core.CanSendFile;
            MnGrblConfig.Enabled        = true;
            //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.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;


            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;
            }

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


            ResumeLayout();
        }
Beispiel #6
0
        public MainForm()
        {
            InitializeComponent();

            MnOrtur.Visible = false;
            MMn.Renderer    = new MMnRenderer();

            splitContainer1.FixedPanel       = FixedPanel.Panel1;
            splitContainer1.SplitterDistance = Settings.GetObject("MainForm Splitter Position", 260);
            MnNotifyNewVersion.Checked       = Settings.GetObject("Auto Update", true);
            MnNotifyMinorVersion.Checked     = Settings.GetObject("Auto Update Build", false);
            MnNotifyPreRelease.Checked       = Settings.GetObject("Auto Update Pre", false);

            MnAutoUpdate.DropDown.Closing += MnAutoUpdateDropDown_Closing;

            if (System.Threading.Thread.CurrentThread.Name == null)
            {
                System.Threading.Thread.CurrentThread.Name = "Main Thread";
            }

            using (SplashScreenForm f = new SplashScreenForm())
                f.ShowDialog();

            //build main communication object
            Firmware ftype = Settings.GetObject("Firmware Type", Firmware.Grbl);

            if (ftype == Firmware.Smoothie)
            {
                Core = new SmoothieCore(this, PreviewForm, JogForm);
            }
            else if (ftype == Firmware.Marlin)
            {
                Core = new MarlinCore(this, PreviewForm, JogForm);
            }
            else
            {
                Core = new GrblCore(this, PreviewForm, JogForm);
            }
            ExceptionManager.Core = Core;

            if (true)             //use multi instance trigger
            {
                SincroStart.StartListen(Core);
                MultipleInstanceTimer.Enabled = true;
            }

            MnGrblConfig.Visible = Core.UIShowGrblConfig;
            MnUnlock.Visible     = Core.UIShowUnlockButtons;

            MnGrbl.Text = Core.Type.ToString();

            Core.MachineStatusChanged += OnMachineStatus;
            Core.OnFileLoaded         += OnFileLoaded;
            Core.OnOverrideChange     += RefreshOverride;
            Core.IssueDetected        += OnIssueDetected;

            PreviewForm.SetCore(Core);
            ConnectionForm.SetCore(Core);
            JogForm.SetCore(Core);

            GitHub.NewVersion += GitHub_NewVersion;

            ColorScheme.CurrentScheme = Settings.GetObject("Color Schema", ColorScheme.Scheme.BlueLaser);;
            RefreshColorSchema();             //include RefreshOverride();
            RefreshFormTitle();
        }
 public void Init(GrblCore core)
 {
     mCore = core;
     AddAllFeatures();
     Sort(CompareKey);
 }