Skip to content

hal: split 'toggle2nist.comp' for toggle and momentary inputs#4223

Open
Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:split_toggle2nist_component
Open

hal: split 'toggle2nist.comp' for toggle and momentary inputs#4223
Sigma1912 wants to merge 1 commit into
LinuxCNC:masterfrom
Sigma1912:split_toggle2nist_component

Conversation

@Sigma1912

@Sigma1912 Sigma1912 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Creates different components for handling toggle buttons and momentary buttons with component names that actually reflect the functionality.

  • Restores the legacy functionality (as in 2.9) of 'toggle2nist' with added input debounce.
  • Fixes the toggle2nist documentation so it matches actual (legacy) behavior.
  • Adds a new 'momentary2nist' component that does what the old 'toggle2nist' docs described.

Background

Before #3193 'toggle2nist' component docs described the functionality as converting
momentary inputs to nist outputs but the actual functionality was converting toggled
inputs to nist outputs. This required using a preceding 'toggle' component to match
documented behavior.

The fix in #3193 changed the behavior to match the documentation (and added debouncing
to the inputs). While this fixed the issues reported on the forum it breaks functionality
for hal files that use the preceeding 'toggle' component. Also the name 'toggle2nist' does
no longer reflect the actual function.

@hansu

hansu commented Jul 2, 2026

Copy link
Copy Markdown
Member

What about a pin to change the mode from momentary to toggle button behaviour?

And what exactly is the definition of "nist outputs" or "nist logic"? I haven't found anything about that.

@Sigma1912

Copy link
Copy Markdown
Contributor Author

What about a pin to change the mode from momentary to toggle button behaviour?

The thing that made me lean towards a separate component is that toggle2nist is a very specific name, which we cannot really change to anything more generic.

And what exactly is the definition of "nist outputs" or "nist logic"? I haven't found anything about that.

All I can tell you is what is in the man page:

a device that has separate on and off inputs and an is-on output.

Comment thread src/hal/components/momentary2nist.comp Outdated
@hansu

hansu commented Jul 2, 2026

Copy link
Copy Markdown
Member

And what exactly is the definition of "nist outputs" or "nist logic"? I haven't found anything about that.

All I can tell you is what is in the man page:

a device that has separate on and off inputs and an is-on output.

So if you don't know what the name of your component means, maybe it's a chance to name it different? (Even though the name is the not so close to toggl2nist)

What about something like momentary_toggle or momentary2onoff ?

@Sigma1912

Copy link
Copy Markdown
Contributor Author

I get your point but I don't think we should start calling the same things differently. Given that the two components both provide a logic conversion that only differs in the input logic it seems reasonable to retain 'nist' since that is what the output logic has been called for years.

Creates different components for handling toggle buttons and momentary buttons with
component names that actually reflect the functionality.

- Restores the legacy functionality (as in 2.9) of 'toggle2nist' with added input debounce.
- Fixes the toggle2nist documentation so it matches actual (legacy) behavior.
- Adds a new 'momentary2nist' component that does what the old 'toggle2nist' docs described.
@Sigma1912 Sigma1912 force-pushed the split_toggle2nist_component branch from 4992bb1 to 79232fa Compare July 3, 2026 05:53
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