It only consists of a reset switch and a potentiometer for setting the feed rate.
I'm able to read both values with the modbus master plugin and a macro loop updates everything else. It works great at this moment.
The problem comes when I disconnect the pendant (usb-serial).
No error happens. My macro is expected to set Reset ON when a modbus function returns error, but it never happens.
Now, if I quit UCCNC and restart it without the pendant attached, it works, it sets the Reset ON due to modbus errors until I connect the pendant again.
I expected that if something happened to the pendant (accidently pulling the cable or something), the modbus would throw errors.
This is the macro loop:
- Code: Select all
ushort Potvalue;
ushort Buttonvalue;
if(exec.GetModbusregister(0, out Potvalue))
{
AS3.Setfield(Potvalue, 232);
AS3.Validatefield(232);
}
else
{
// on error, set feed to 0
AS3.Setfield(0, 232);
AS3.Validatefield(232);
}
if(!exec.GetModbusregister(1, out Buttonvalue) || (Buttonvalue == 0))
{
// on error or button pressed, set reset ON
exec.Callbutton(512);
}