Skip to content

Commit

Permalink
[SC64][SW] Added command to reset SC64 state in deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
Polprzewodnikowy committed Dec 14, 2023
1 parent 3f3f1e3 commit bf13434
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sw/deployer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ enum Commands {
/// Print information about connected SC64 device
Info,

/// Reset SC64 state (same as after power-up)
Reset,

/// Update persistent settings on SC64 device
Set {
#[command(subcommand)]
Expand Down Expand Up @@ -317,6 +320,7 @@ fn handle_command(command: &Commands, port: Option<String>, remote: Option<Strin
Commands::Debug(args) => handle_debug_command(connection, args),
Commands::Dump(args) => handle_dump_command(connection, args),
Commands::Info => handle_info_command(connection),
Commands::Reset => handle_reset_command(connection),
Commands::Set { command } => handle_set_command(connection, command),
Commands::Firmware { command } => handle_firmware_command(connection, command),
Commands::Server(args) => handle_server_command(connection, args),
Expand Down Expand Up @@ -739,6 +743,16 @@ fn handle_info_command(connection: Connection) -> Result<(), sc64::Error> {
Ok(())
}

fn handle_reset_command(connection: Connection) -> Result<(), sc64::Error> {
let mut sc64 = init_sc64(connection, true)?;

sc64.reset_state()?;

println!("SC64 state has been reset");

Ok(())
}

fn handle_set_command(connection: Connection, command: &SetCommands) -> Result<(), sc64::Error> {
let mut sc64 = init_sc64(connection, true)?;

Expand Down

0 comments on commit bf13434

Please sign in to comment.