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

Implemented YMODEM for embedded target #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ejka-inapril
Copy link

removed std and alloc dependencies from ymodem

removed std and alloc dependencies from ymodem
@shymega
Copy link
Collaborator

shymega commented Jun 6, 2024

Thank you, but there's too many changes in this PR unrelated to the PR title. Also, did you mean to close the PR?

@shymega
Copy link
Collaborator

shymega commented Jun 6, 2024

I would rather have smaller, composable PRs addressing each change, with commits describing the change.

@shymega shymega reopened this Jun 6, 2024
Copy link
Collaborator

@shymega shymega left a comment

Choose a reason for hiding this comment

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

Several changes needed, and if you can open other PRs to address this, that would be great, and we can close this one as the parent PR.

Cargo.toml Outdated
repository = "https://github.com/Cosmo-CoDiOS/txmodems"
repository = "https://github.com/inApril-AS/txmodems"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would rather this wasn't changed. It looks like you want to rebrand my crate as your own, which isn't fair to my work, and the derived code from other crates.

Cargo.toml Outdated
Comment on lines 7 to 13
keywords = ["data-transfer", "MODEM", "file-transfer", "embedded"]
version = "0.1.3"
authors = ["Dom Rodriguez <[email protected]>"]
keywords = ["serial", "xmodem", "ymodem", "data-transfer", "MODEM", "file-transfer", "embedded"]
version = "0.2.0"
authors = [
"Dom Rodriguez <[email protected]>",
"Eliud de León <[email protected]>",
"Eskild Jonatan Krumsvik Aanensen <[email protected]>",
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Version bump is fine, and keywords are fine - but you should be asking before adding yourselves to the authors key. I was going to put 'The Cosmo-CoDiOS Developers' at some point, given this project is under that umbrella.

license = "MIT"
edition = "2021"

[package.metadata.docs.rs]
all-features = true

[features]
default = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch. LGTM.

core2 = { version = "0.4.0", default-features = false }
crc16 = "0.4.0"
defmt = { version = "0.3", optional = true }
heapless = "0.8.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this?

core2 = { version = "0.4.0", default-features = false }
crc16 = "0.4.0"
defmt = { version = "0.3", optional = true }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, good catch for logging on embedded.

Comment on lines 10 to 16
const SOH: u8 = 0x01;
const STX: u8 = 0x02;
const EOT: u8 = 0x04;
const ACK: u8 = 0x06;
const NAK: u8 = 0x15;
const CAN: u8 = 0x18;
const CRC: u8 = 0x43;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not use crate::ymodem::Consts? That was written specifically to avoid single-line consts. Please adjust.

Comment on lines -152 to +190
file_name: String,
file_name: String<32>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo?

extern crate alloc;

mod common;
pub mod common;
pub mod variants;
Copy link
Collaborator

Choose a reason for hiding this comment

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

common should remain private!

Comment on lines 24 to 28
pub max_errors: u32,

/// The number of *initial errors* that can occur before the communication is
/// considered a failure. Errors include unexpected bytes and timeouts waiting for bytes.
pub max_initial_errors: u32,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please refrain from unnecessary newlines.

Comment on lines +45 to +51
if self.errors >= self.max_errors {
#[cfg(defmt)]
error!("Exhausted max retries ({}) while sending start frame in YMODEM transfer", self.max_errors);
return Err(ModemError::ExhaustedRetries { errors: self.max_errors });
} else {
Ok(())
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This branch can be simplified. Remove else and simply end function with Ok(()).

@shymega shymega self-assigned this Jun 6, 2024
@ejka-inapril
Copy link
Author

did you mean to close the PR?

Yes, I didn't mean to open it.

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.

None yet

2 participants