Skip to content

dbounce: add instant-read for probing moves#4052

Open
djdelorie wants to merge 1 commit into
LinuxCNC:masterfrom
djdelorie:master
Open

dbounce: add instant-read for probing moves#4052
djdelorie wants to merge 1 commit into
LinuxCNC:masterfrom
djdelorie:master

Conversation

@djdelorie
Copy link
Copy Markdown
Contributor

Add motiontype and probedelay pins

If motiontype is 5, then the logic changes as follows:

  • if state is max or min (i.e. signal stable), the first change forces an output change and sets state to the midpoint

The effective result is that an input change after the delay expires, causes an immediate output change, but any further transitions within the delay are ignored.

If probedelay is set (non-zero) it is used instead of delay during probing moves.

If motiontype is not connected, the behavior is as it was before this patch, for backward compatibility.

Add motiontype and probedelay pins

If motiontype is 5, then the logic changes as follows:

- if state is max or min (i.e. signal stable), the first change forces an
  output change and sets state to the midpoint

The effective result is that an input change after the delay expires, causes an
immediate output change, but any further transitions within the delay are
ignored.

If probedelay is set (non-zero) it is used instead of delay during probing
moves.

If motiontype is not connected, the behavior is as it was before this patch,
for backward compatibility.
function _;
/*variable int state;*/
pin out u32 state;
function _ nofp;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There no longer is a difference between fp and nofp. All threads are now floating point because newer compilers use sophisticated optimizations using special (floating point) registers. The nofp must not be used anymore and you should not change this line.

when equal to 5 it means probing""";

variable unsigned state;
option period no;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason why the option period no is present. The code does not use the period argument in the _ function and it would therefore result in a warning, which are now treated as errors.

out = 1;
/* input true, is state at threshold? */
if (state < delay) {
} else if (state < d) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comparison with different signedness.

variable unsigned state;
option period no;
function _;
/*variable int state;*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep this as a comment?

author "Dewey Garrett";
;;
FUNCTION(_) {
int d = (motiontype == 5 && probedelay > 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an int results in line 33 with a signdness mismatch.

The reason is that the variable d is declared an int, which should have been rtapi_u32 to make it consistent with the underlying types used in delay and probedelay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants