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

Bug in SoftwareSerial when using inverse logic #2090

Merged
merged 1 commit into from
May 23, 2014

Conversation

jenscski
Copy link
Contributor

Fix for reported bug #1361

For more further description of the bug, see http://forum.arduino.cc/index.php?topic=159726

@@ -355,7 +355,7 @@ SoftwareSerial::~SoftwareSerial()
void SoftwareSerial::setTX(uint8_t tx)
{
pinMode(tx, OUTPUT);
digitalWrite(tx, HIGH);
digitalWrite(tx, _inverse_logic ? LOW : HIGH);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do not set the start bit when using inverse logic, preventing the receiving end to think the transmission started when was not intentionally started.

@matthijskooijman
Copy link
Collaborator

Hmm, I could have sworn I saw a pulrequest for this change before, but I can't find it right now.

In any case, the change looks good to me. However, I think the commit message needs to be improved before this can be merged - it contains no information whatsover except the bug number. The commit messages should be self-contained and explain what happens and why, and additionally reference the bug report (but that's secondary).

E.g., something like:

Fix idle level when initializing a inverted SoftwareSerial

Previously, when SoftwareSerial was initialized, it would always be set
to an idle level of HIGH, even when inverted logic was enabled. Once a
byte is transmitted, the idle level gets correctly set to LOW instead.
This commit makes sure that the idle level is correct directly after
initialization already.

This fixes #1361.

@matthijskooijman
Copy link
Collaborator

Oh right, the PR I saw before was your other one, of course. Never mind that part of my comment :-)

@jenscski
Copy link
Contributor Author

As far as I can tell, it's not possible to change a commit message, when first pushed.

Any help in the right direction will be helpful...

@matthijskooijman
Copy link
Collaborator

You can! :-)

Locally, you can change the commit message of the most recent commit using git commit --amend (hint: for older commits, you can use an "interactive rebase" - Google it if you ever need that).

To push out the changed commit to github, use git push -f, where -f means force: It "overwrites" the existing commit. github will then automatically update this pullrequest.

Previously, when SoftwareSerial was initialized, it would always be set
to an idle level of HIGH, even when inverted logic was enabled. Once a
byte is transmitted, the idle level gets correctly set to LOW instead.
This commit makes sure that the idle level is correct directly after
initialization already.

This fixes arduino#1361.
@jenscski
Copy link
Contributor Author

Done :)

@matthijskooijman
Copy link
Collaborator

Looking good!

cmaglie added a commit that referenced this pull request May 23, 2014
Bug in SoftwareSerial when using inverse logic
@cmaglie cmaglie merged commit b999ed2 into arduino:master May 23, 2014
@cmaglie
Copy link
Member

cmaglie commented May 23, 2014

Thanks!

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.

3 participants