feat(src): add cooling and thermal management commands
Adds a new Cooling command group with selectable fan profiles (Performance, Balanced, Quiet) and updates the CLI and logging accordingly. - New Features - Introduce Cooling subcommands for setting thermal management modes - Implement runtime logic to apply selected fan profiles - Enhancements - Extend CLI enum `Commands` to include `Cooling` and dispatch handling - Refine env_logger formatting to output only `[LEVEL] message` - Integrate cooling execution into the main command dispatch flow - Bug Fixes - No bug fixes introduced in this change
This commit is contained in:
2 files changed
+21
-2
No files matched your search
+15
@@ -32,6 +32,11 @@ pub enum Commands {
|
|||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: PowerCommands,
|
command: PowerCommands,
|
||||||
},
|
},
|
||||||
|
/// Cooling and thermal management
|
||||||
|
Cooling {
|
||||||
|
#[command(subcommand)]
|
||||||
|
command: CoolingCommands,
|
||||||
|
},
|
||||||
/// Hardware status
|
/// Hardware status
|
||||||
Status,
|
Status,
|
||||||
}
|
}
|
||||||
@@ -91,6 +96,16 @@ pub enum PowerCommands {
|
|||||||
BatterySave,
|
BatterySave,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Subcommand, Debug)]
|
||||||
|
pub enum CoolingCommands {
|
||||||
|
/// Set extreme performance fan/thermal mode
|
||||||
|
Performance,
|
||||||
|
/// Set balanced/intelligent cooling mode
|
||||||
|
Balanced,
|
||||||
|
/// Set quiet/battery saving fan mode
|
||||||
|
Quiet,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum BatteryCommands {
|
pub enum BatteryCommands {
|
||||||
/// Set the battery charging limit (e.g., 80)
|
/// Set the battery charging limit (e.g., 80)
|
||||||
|
|||||||
+6
-2
@@ -16,16 +16,20 @@ fn main() {
|
|||||||
log::LevelFilter::Info
|
log::LevelFilter::Info
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
env_logger::Builder::new()
|
env_logger::Builder::new()
|
||||||
.filter_level(level)
|
.filter_level(level)
|
||||||
.format_timestamp(None)
|
.format(|buf, record| {
|
||||||
.format_module_path(false)
|
// Write only [LEVEL] message
|
||||||
|
writeln!(buf, "[{}] {}", record.level(), record.args())
|
||||||
|
})
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
match &cli.command {
|
match &cli.command {
|
||||||
Commands::Gpu { command } => commands::gpu::execute(command),
|
Commands::Gpu { command } => commands::gpu::execute(command),
|
||||||
Commands::Battery { command } => commands::battery::execute(command),
|
Commands::Battery { command } => commands::battery::execute(command),
|
||||||
Commands::Power { command } => commands::power::execute(command),
|
Commands::Power { command } => commands::power::execute(command),
|
||||||
|
Commands::Cooling { command } => commands::cooling::execute(command),
|
||||||
Commands::Status => commands::status::execute(),
|
Commands::Status => commands::status::execute(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user