G96 CSS 模式主轴停复 #314

推推 grbl 3年前 (2023-01-29) 246次浏览
打开
MZot 打开了这个问题 2017 年 8 月 6 日 · 8条评论
 Open

spindle stop-resume in G96 CSS mode#314

MZot opened this issue on Aug 6, 2017 · 8 comments

注释

G96 CSS 模式主轴停复 #314

如果您在自动模式下点击 halui.spindle.stop 和 halui.spindle.start – 暂停,主轴模式将重置为 G97,并且切削速度的值将应用于主轴速度。

以下是我重现该问题所遵循的步骤:

运行该程序,在 G1 块中点击暂停并停止/重启主轴:

G7 G18 G54 G95 
G96 S170 D2000 M3

G0 X50 Z0
G1 Z-100 F0.1
M30

这是我期望发生的事情:

主轴模式和速度重置为具有适当 S 值的 CSS 模式

这是发生了什么:

主轴以恒定 RPM 模式重新启动,使用 G96 程序段中的 S 值

G96 CSS 模式主轴停复 #314

只需将模态命令放在 .ini 文件中

[RS274NGC]
PARAMETER_FILE = linuxcnc.var
RS274NGC_STARTUP_CODE = G7 G18 G21 G40 G54 G61 G80 G90 G95

G96 CSS 模式主轴停复 #314
作者

I guess I was not clear enough – english is not my first language, sorry. On my machine, I have external buttons to control spindle. They are connected to halui spindle pins. If I pause a program and stop spindle, for example to check on tool or clear chips, after restarting spindle and resuming program, the spindle speed is 170 rpm, instead of 170m/min (G96 S170 M3).
It is the same if I have G95 or G96 in INI startup codes.

G96 CSS 模式主轴停复 #314

The spindle like the power off, the external button what does M5 do?
In my so ‘net spindle-manual-stop halui.spindle.stop
But I did not see how it behaves
Tomorrow I try and let you know.

I’m Italian and you?

G96 CSS 模式主轴停复 #314

I have verified, even to me the problem arises, though putting G97 in .ini
This is very dangerous.
We hope to be settled

G96 CSS 模式主轴停复 #314

i have notcied the same also in tool touch off if you have been in CSS mode.

set spindle in CSS mode from MDI/Auto,
stop spindle M05

now in manual mode set spindle running manuly (fwd or rev)
touch off tool in X
spindle will increase to CSS speed on new length sometimes this leads to a full speed of spindle output.
sometimes i have seen the spindle reverse back to the direction it was in from Auto mode

G96 CSS 模式主轴停复 #314
Contributor

Using Master and Gmoccapy:

Using G96, in any situation that you stop the spindle, G96 no longer works / applies.
Active GCodes still shows G96, however machine behaves like G97 (RPM mode) with S equal to the G96 S value.

E.g.: (using MDI)
M3 (start spindle)
G96 D2500 S120 (CSS works as expected)
Stop the spindle (with GUI button or M5)
Jog machine around or change tool
M3 – now spindle just turns at 120rpm and CSS not active, despite G96 showing as active G code.

Have to reapply G96 D2500 S120 after M3 every time.
It seems that you cannot apply G96 before the spindle is turning – but no error is shown if you try.

Expected behaviour

G96 applies until G97 called, whatever happens to spindle M3/M4/M5

Alternate acceptable behaviour

Machine defaults to G97 whenever M5 invoked, however there should be NO RPM / S value set, and therefore an error will show / active input is required from the operator

G96 CSS 模式主轴停复 #314
Attila1000 commented 2018 年 11 月 20 日  

Hello,

i find this problem too. My HAL file call halui.spindle.stop if pressed the Spindle Stop button during program paused, and restarting spindle with halui.spindle.start, and the same situation happened (spindle starts with lowered speed in G96 mode).
But if i use motion.spindle-inhibit instead of halui.spindle.start/stop the spindle stops, and restarts with desired speed. But the inhibit pin must driven by flipflop component.
Maybe this solve the problem. What the community think?

G96 CSS 模式主轴停复 #314
Author

I found an (ugly?) fix for this. Since I don’t use git, I am posting the solution here (I am using 2.7.14, in master it is somehow different due to multispindle).

emc_nml.hh:

class EMC_SPINDLE_STAT:public EMC_SPINDLE_STAT_MSG {
  public:
    EMC_SPINDLE_STAT();

    // For internal NML/CMS use only.
    void update(CMS * cms);

    double speed;		// spindle speed in RPMs
    double css_maximum; 	//<------------------  added for css bug fix
    int direction;		// 0 stopped, 1 forward, -1 reverse
    int brake;			// 0 released, 1 engaged
    int increasing;		// 1 increasing, -1 decreasing, 0 neither
    int enabled;		// non-zero means enabled
    int orient_state;
    int orient_fault;
};

emccanon.cc:

void SET_SPINDLE_MODE(double css_max) {
    css_maximum = fabs(css_max);
    emcStatus->motion.spindle.css_maximum = css_maximum; //<------------------  added for css bug fix
}

and finally halui.cc:


static int sendSpindleForward()
{
    EMC_SPINDLE_ON emc_spindle_on_msg;
    if (emcStatus->task.activeSettings[2] != 0) {
        if(emcStatus->motion.spindle.css_maximum){
		emc_spindle_on_msg.speed = fabs(emcStatus->motion.spindle.css_maximum); //fabs(emcStatus->task.activeSettings[2]);
		emc_spindle_on_msg.factor = 1000 / (2 * M_PI) * fabs(emcStatus->task.activeSettings[2]);
		emc_spindle_on_msg.xoffset = emcStatus->task.g5x_offset.tran.x + emcStatus->task.g92_offset.tran.x + emcStatus->task.toolOffset.tran.x;
	}
	else{
		emc_spindle_on_msg.speed = fabs(emcStatus->task.activeSettings[2]);
		emc_spindle_on_msg.factor = 0;
	}
    } 
    else {
	emc_spindle_on_msg.speed = +1;
	emc_spindle_on_msg.factor = 0;
    }
    return emcCommandSend(emc_spindle_on_msg);
}

Sign up for free 在 GitHub 上加入此对话。已有帐户? 登录评论
标签
项目

还没有

发展

没有分支机构或拉取请求

6人参加
G96 CSS 模式主轴停复 #314G96 CSS 模式主轴停复 #314G96 CSS 模式主轴停复 #314G96 CSS 模式主轴停复 #314G96 CSS 模式主轴停复 #314G96 CSS 模式主轴停复 #314

喜欢 (0)