-
Notifications
You must be signed in to change notification settings - Fork 137
Add serial ports config file #777
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
base: main
Are you sure you want to change the base?
Conversation
Not sure this is the path we want to take to be honest. Had some other ideas I've been meaning to explore, so let's sit on this for awhile please. |
697ae3d
to
a31daef
Compare
a31daef
to
6cc02c4
Compare
I wonder if we can test this somehow in HIL |
It seems to me that we can avoid the code duplication by loading the two things separately then combining them again in code. We just need to be careful when saving the config again to write out the config back to the two separate files. After that, I think this becomes a relatively simple change? Here is a small snippet to explain what I mean: // package both together for code locality reasons, but they are seperate configs which are saved seperately
struct Config {
config: ProjectConfig, // currently this is Config, let's rename it
port_config: PortConfiguration // user port config
} What do you think? |
pub connection: Connection, | ||
/// Preferred USB devices | ||
#[serde(default)] | ||
pub usb_device: Vec<UsbDevice>, | ||
/// Path of the file to save the configuration to | ||
#[serde(skip)] | ||
save_path: PathBuf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only PortConfig requires save_path
, as its the only config file that can be saved, save_with
is only called here: https://github.com/esp-rs/espflash/blob/main/espflash/src/cli/serial.rs#L53
Definitely better, thanks for the suggestion @MabezDev, just updated it! |
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
951f2e2
to
eb5fdac
Compare
Don't really like the way I solved this as it's basically a bunch of duplicated code, but not sure if there's any better way.
Draft until I do some more testing and/or I find a better solution.
Example
espflash_ports.toml
file: