Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Enum-based TX enable mode #300

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lmartorella
Copy link

Hello,
It is probably better to introduce an enum-based value for the current txEnableDirect, to have a more self-explaining API, not requiring to look at the documentation to understand what really 'direct' mean in logic terms (e.g. from an electronic point of view, usually levels are negated, so 'direct' can be quite confusing here).

What do you think about it?
Thx! L

@milen100
Copy link

milen100 commented Aug 6, 2023

I like it ! It is a useful change.

@emelianov
Copy link
Owner

Could you refactor of Enum declaration to not break API compatibility:

enum ModbusRTUTxEnableMode: bool {
     /**
      * The TX enable pin should be high when transmitting
      */
     TxEnableHigh = true,

     /**
      * The TX enable pin should be low when transmitting
      */
     TxEnableLow = false
 };

@lmartorella
Copy link
Author

Hi,
Rather than trying to not break ABI compatibility (not sure if Arduino libs can be released as pre-compiled binaries), I think that overloading the requests is more portable instead.
What do you think about the proposed change in the last commit?
Thx, L

@emelianov emelianov added this to the 4.1.2 milestone Oct 15, 2023
@rob040
Copy link

rob040 commented Dec 15, 2023

To add my 2ct...
I think that "Direct" is a non-descript name and doesn't say anything about the logic involved. The fact that multiple users ask questions about it and that a full sentence is needed to describe it says enough.

I do like the first solution <0141b93>, but there are always more ways to achieve the same.

@lmartorella notice your ABI note v.s. API compatibility request. These libraries are source level, so ABI compatibility is never needed

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.

4 participants