This repository was archived by the owner on Mar 22, 2024. It is now read-only.
Added SERIALCOMMAND_ECHO macro to enable serial echo#11
Open
b- wants to merge 0 commit intokroimon:masterfrom
Open
Added SERIALCOMMAND_ECHO macro to enable serial echo#11b- wants to merge 0 commit intokroimon:masterfrom
b- wants to merge 0 commit intokroimon:masterfrom
Conversation
kroimon
suggested changes
May 25, 2018
Owner
kroimon
left a comment
There was a problem hiding this comment.
Please see my comments on your code.
In general, I like the idea and will merge if you fix the small issues.
SerialCommand.cpp
Outdated
| } | ||
| } | ||
| else if (inChar == 127 || inChar == 8) { | ||
| bufPos--; |
Owner
There was a problem hiding this comment.
This creates a possible buffer-overflow when deleting more characters than there are in the buffer (i.e. bufPos rolls over from 0 to 255).
SerialCommand.cpp
Outdated
| } | ||
| else if (inChar == 127 || inChar == 8) { | ||
| bufPos--; | ||
| buffer[bufPos] = 0; |
Owner
There was a problem hiding this comment.
Please use '\0' here instead of 0 to make clear we're writing a character.
SerialCommand.cpp
Outdated
| else if (inChar == 127 || inChar == 8) { | ||
| bufPos--; | ||
| buffer[bufPos] = 0; | ||
| Serial.print(" \b"); |
Owner
There was a problem hiding this comment.
What's the space before the \b for?
Also: wrap in #if defined SERIALCOMMAND_DEBUG || defined SERIALCOMMAND_ECHO!
SerialCommand.cpp
Outdated
| * SerialCommand - A Wiring/Arduino library to tokenize and parse commands | ||
| * received over a serial port. | ||
| * | ||
| * |
Owner
There was a problem hiding this comment.
Please remove whitespace-only changes from your PR.
Author
|
Will take a look. Thank you for your comments — I’m sure I’ll wanna fix
that for myself too.
I don’t remember what the `[space]\b` is for right now. I’ll have to look
at it.
How do I remove whitespace-only changes? I’ve never figured that out
…On Fri, May 25, 2018 at 10:29 AM kroimon ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Please see my comments on your code.
In general, I like the idea and will merge if you fix the small issues.
------------------------------
In SerialCommand.cpp
<#11 (comment)>
:
> @@ -124,6 +124,11 @@ void SerialCommand::readSerial() {
#endif
}
}
+ else if (inChar == 127 || inChar == 8) {
+ bufPos--;
This creates a possible buffer-overflow when deleting more characters than
there are in the buffer (i.e. bufPos rolls over from 0 to 255).
------------------------------
In SerialCommand.cpp
<#11 (comment)>
:
> @@ -124,6 +124,11 @@ void SerialCommand::readSerial() {
#endif
}
}
+ else if (inChar == 127 || inChar == 8) {
+ bufPos--;
+ buffer[bufPos] = 0;
Please use '\0' here instead of 0 to make clear we're writing a character.
------------------------------
In SerialCommand.cpp
<#11 (comment)>
:
> @@ -124,6 +124,11 @@ void SerialCommand::readSerial() {
#endif
}
}
+ else if (inChar == 127 || inChar == 8) {
+ bufPos--;
+ buffer[bufPos] = 0;
+ Serial.print(" \b");
What's the space before the \b for?
Also: wrap in #if defined SERIALCOMMAND_DEBUG || defined
SERIALCOMMAND_ECHO!
------------------------------
In SerialCommand.cpp
<#11 (comment)>
:
> @@ -1,23 +1,23 @@
/**
* SerialCommand - A Wiring/Arduino library to tokenize and parse commands
* received over a serial port.
- *
+ *
Please remove whitespace-only changes from your PR.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARYddZ_LESz9weFT7Kd6V-NQyUfHXM-ks5t2BVhgaJpZM4KLPpS>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I didn't want to enable full on debug mode, but I want to be able to see my commands as I type them. So I added an "echo mode."