grblHAL / core

grblHAL core code and master Wiki
Other
326 stars 85 forks source link

Pin state is only reported when true #431

Closed jes closed 8 months ago

jes commented 8 months ago

In https://github.com/grblHAL/core/blob/master/report.c#L1232 - you can see that the Pn: part of the status report does not appear if none of the pins are set.

This means there is no way for a GUI to tell whether the pin has been deactivated. I think ideally there would be a Pn:P report as soon as the probe pin is triggered, and a Pn: (i.e. empty set) report when the pin is un-triggered.

So the fix may be as simple as removing the if(lim_pin_state.value | ctrl_pin_state.value) condition, but I'm not sure if there would be some wider implication that means that is a bad idea.

terjeio commented 8 months ago

This means there is no way for a GUI to tell whether the pin has been deactivated.

If the Pn: element is not in the report no pins are activated. In ioSender I handle it like this.

but I'm not sure if there would be some wider implication that means that is a bad idea.

Since I am not sure either I decided to be compatible with legacy Grbl and not output an empty element.

jes commented 8 months ago

OK, thanks. I think I actually misunderstood the Grbl documentation here. I was under the impression that Pn: would be suppressed on most status reports and only sent periodically or when there is a state change.

If it is the case that every status report includes the pin states (if any) then indeed it can be handled as you did.