开源改变世界!!

更改 grbl 配置? #211

推推 grbl 2年前 (2023-01-26) 124次浏览
关闭
Evil-Nemesis 打开了这个问题 2017 年 12 月 13 日 · 4条评论
关闭

更改 grbl 配置?#211

Evil-Nemesis 打开了这个问题 2017 年 12 月 13 日 · 4条评论

注释

更改 grbl 配置? #211

您好,
我如何通过编码更改 4 个配置(例如 $20~$23)?
例如在一个按钮中!
我用这种方式,但效果不佳!

        private void Btn_Disable_Coolant_Click(object sender, EventArgs e)
        {
            Core.ExecuteCustombutton("M9");
            Core.ExecuteCustombutton("$20=1");
            Core.ExecuteCustombutton("$21=1");
            Core.ExecuteCustombutton("$22=1");
            Core.ExecuteCustombutton("$23=1");
        }
更改 grbl 配置? #211
所有者

确切地说,“这效果不佳”是什么意思?

更改 grbl 配置? #211
所有者

我建议使用Core.EnqueueCommand(new GrblCommand("gcode"))而不是,Core.ExecuteCustombutton("gcode");但 ExecuteCustombutton 也可以。

请注意,设置配置需要写入 eeprom,grbl 对此有一些问题:
https ://github.com/gnea/grbl/wiki/Grbl-v1.1-Interface#eeprom-issues

我建议您System.Threading.Thread.Sleep(50);在每次配置写入之间添加一些睡眠使用。

更改 grbl 配置? #211

谢谢你的回答我亲爱的朋友!❤️ 😍
我真的为你祈祷!🙏
是的,但我找到了另一种方法,它也很好用!

        private void Btn_Disable_Coolant_Click(object sender, EventArgs e)
        {
            List<GrblConf.GrblConfParam> write_conf;
            write_conf = Core.Configuration.ToList();
            foreach (GrblConf.GrblConfParam p in write_conf)
            {
                if (p.DollarNumber == "$20") p.Value = 1;
                if (p.DollarNumber == "$21") p.Value = 1;
                if (p.DollarNumber == "$22") p.Value = 1;
                if (p.DollarNumber == "$23") p.Value = 1;
            }
            Core.ExecuteCustombutton("M9");
            Core.WriteConfig(write_conf);
        }
更改 grbl 配置? #211

确切地说,“这效果不佳”是什么意思?

发生了一些事情,好像应用程序被锁定了!
无法发送 G 代码!
无论如何,非常非常感谢!💟 💕