diff --git a/cargo-espflash/src/main.rs b/cargo-espflash/src/main.rs index 0710b9d0..a87e8e87 100644 --- a/cargo-espflash/src/main.rs +++ b/cargo-espflash/src/main.rs @@ -9,10 +9,10 @@ use clap::{Args, CommandFactory, Parser, Subcommand}; use espflash::{ cli::{ self, board_info, completions, config::Config, connect, erase_flash, erase_partitions, - erase_region, flash_elf_image, monitor::monitor_with, parse_partition_table, - partition_table, print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs, - ConnectArgs, EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs, - MonitorArgs, PartitionTableArgs, + erase_region, flash_elf_image, monitor::monitor, parse_partition_table, partition_table, + print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs, ConnectArgs, + EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs, MonitorArgs, + PartitionTableArgs, }, error::Error as EspflashError, image_format::ImageFormatKind, @@ -342,7 +342,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> { 115_200 }; - monitor_with( + monitor( flasher.into_interface(), Some(&elf_data), pid, diff --git a/espflash/src/bin/espflash.rs b/espflash/src/bin/espflash.rs index 488d347e..e0d44a40 100644 --- a/espflash/src/bin/espflash.rs +++ b/espflash/src/bin/espflash.rs @@ -8,7 +8,7 @@ use clap::{Args, CommandFactory, Parser, Subcommand}; use espflash::{ cli::{ self, board_info, completions, config::Config, connect, erase_flash, erase_partitions, - erase_region, flash_elf_image, monitor::monitor_with, parse_partition_table, parse_uint32, + erase_region, flash_elf_image, monitor::monitor, parse_partition_table, parse_uint32, partition_table, print_board_info, save_elf_as_image, serial_monitor, CompletionsArgs, ConnectArgs, EraseFlashArgs, EraseRegionArgs, EspflashProgress, FlashConfigArgs, MonitorArgs, PartitionTableArgs, @@ -264,7 +264,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> { 115_200 }; - monitor_with( + monitor( flasher.into_interface(), Some(&elf_data), pid, diff --git a/espflash/src/cli/mod.rs b/espflash/src/cli/mod.rs index c3912c16..4ff95357 100644 --- a/espflash/src/cli/mod.rs +++ b/espflash/src/cli/mod.rs @@ -26,7 +26,7 @@ use serialport::{SerialPortType, UsbPortInfo}; use self::{ config::Config, - monitor::{monitor_with, LogFormat}, + monitor::{monitor, LogFormat}, serial::get_serial_port_info, }; use crate::{ @@ -142,7 +142,7 @@ pub struct FlashArgs { #[arg(long)] pub ram: bool, /// Logging format. - #[arg(long, short = 'f', default_value = "serial", requires = "monitor")] + #[arg(long, short = 'L', default_value = "serial", requires = "monitor")] pub log_format: LogFormat, } @@ -199,7 +199,7 @@ pub struct MonitorArgs { #[clap(flatten)] connect_args: ConnectArgs, /// Logging format. - #[arg(long, short = 'f', default_value = "serial")] + #[arg(long, short = 'L', default_value = "serial")] pub log_format: LogFormat, } @@ -307,7 +307,7 @@ pub fn serial_monitor(args: MonitorArgs, config: &Config) -> Result<()> { 115_200 }; - monitor_with( + monitor( flasher.into_interface(), elf.as_deref(), pid, diff --git a/espflash/src/cli/monitor/mod.rs b/espflash/src/cli/monitor/mod.rs index b99eb9dc..af483e58 100644 --- a/espflash/src/cli/monitor/mod.rs +++ b/espflash/src/cli/monitor/mod.rs @@ -63,18 +63,8 @@ impl Drop for RawModeGuard { } } -/// Open a serial monitor on the given interface -pub fn monitor( - serial: Interface, - elf: Option<&[u8]>, - pid: u16, - baud: u32, -) -> serialport::Result<()> { - monitor_with(serial, elf, pid, baud, LogFormat::Serial) -} - /// Open a serial monitor on the given interface, using the given input parser. -pub fn monitor_with( +pub fn monitor( mut serial: Interface, elf: Option<&[u8]>, pid: u16,