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

Disable CR-adding when transferring files via XModem #528

Merged
merged 2 commits into from
Jul 16, 2022

Conversation

breiler
Copy link
Contributor

@breiler breiler commented Jul 15, 2022

The UART channel have a feature for adding extra CR on line feeds enabled, which will break the XModem protocol. This fix will disable the extra CR adding and restore the setting after the file is sent.

It would be more sensible to toggle this in xmodem.cpp if this would be used in other places. But that function has multiple returns which makes it really hard and would require a bit of refactoring:
https://github.com/bdring/FluidNC/blob/main/FluidNC/src/xmodem.cpp#L243

The UART channel have the feature for adding extra CR on line feeds enabled which will break the XModem protocol. This fix will disable the extra CR adding and restore the setting after the file is sent.
@@ -644,8 +644,10 @@ static Error xmodem_send(const char* value, WebUI::AuthenticationLevel auth_leve
log_info("Cannot open " << value);
return Error::DownloadFailed;
}
bool prevAddCr = out.setCr(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about changing the name to oldCr so it is the same as the corresponding code in xmodem_receive() ? With that change I will merge the change. Thanks for debugging it.

@MitchBradley MitchBradley merged commit 5db1039 into bdring:main Jul 16, 2022
@breiler breiler deleted the bugfix/XmodemExtraCR branch July 24, 2022 02:36
MitchBradley pushed a commit that referenced this pull request Aug 5, 2022
* Disable CR-adding when transferring files via XModem

The UART channel have the feature for adding extra CR on line feeds enabled which will break the XModem protocol. This fix will disable the extra CR adding and restore the setting after the file is sent.

* Changed variable name to be consistent with other code.
MitchBradley pushed a commit that referenced this pull request Aug 9, 2022
* Disable CR-adding when transferring files via XModem

The UART channel have the feature for adding extra CR on line feeds enabled which will break the XModem protocol. This fix will disable the extra CR adding and restore the setting after the file is sent.

* Changed variable name to be consistent with other code.
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