Skip to content

Commit

Permalink
Fix which fan command is on/off. before loop starts set fan to off
Browse files Browse the repository at this point in the history
  • Loading branch information
jackra1n committed May 18, 2024
1 parent f8b5ba1 commit 372e011
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fan_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ impl FanController {

pub fn fan_on(&mut self) -> Result<(), Box<dyn std::error::Error>> {
let mut parts = self.expander.split();
parts.p0.set_high().unwrap();
parts.p0.set_low().unwrap();
self.is_running = true;
Ok(())
}

pub fn fan_off(&mut self) -> Result<(), Box<dyn std::error::Error>> {
let mut parts = self.expander.split();
parts.p0.set_low().unwrap();
parts.p0.set_high().unwrap();
self.is_running = false;
Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut last_disk_update = Instant::now() - disk_update_interval;
info!("Starting main loop");

fan_controller.fan_off()?;

loop {
sys.refresh_cpu();
sys.refresh_memory();
Expand Down

0 comments on commit 372e011

Please sign in to comment.