Fix needing to double-tap fan-mode to change mode

This commit is contained in:
Luke
2020-05-22 15:38:17 +12:00
parent 0e6f6f3289
commit 5e781cbd3d
6 changed files with 29 additions and 21 deletions

View File

@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.9.6] - 2020-22-05
### Changed
- Fix needing to double-tap fan-mode to change mode
## [0.9.5] - 2020-22-05
### Changed
- Flip writing order of effect colour blocks every other block write to try

4
Cargo.lock generated
View File

@@ -667,7 +667,7 @@ checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
[[package]]
name = "rog-aura"
version = "0.9.1"
version = "0.9.2"
dependencies = [
"dbus",
"gumdrop",
@@ -678,7 +678,7 @@ dependencies = [
[[package]]
name = "rog-daemon"
version = "0.9.4"
version = "0.9.6"
dependencies = [
"dbus",
"dbus-tokio",

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
rog-core (0.9.6) focal; urgency=medium
* Fix needing to double-tap fan-mode to change mode
-- Luke Jones <luke@ljones.dev> Fri, 22 May 2020 15:39:08 +1200
rog-core (0.9.5) focal; urgency=medium
* Internal fixes to many small issues

View File

@@ -1,6 +1,6 @@
[package]
name = "rog-daemon"
version = "0.9.5"
version = "0.9.6"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -108,24 +108,22 @@ impl RogCore {
let path = RogCore::get_fan_path()?;
let mut fan_ctrl = OpenOptions::new().read(true).write(true).open(path)?;
let mut buf = String::new();
if let Ok(_) = fan_ctrl.read_to_string(&mut buf) {
let mut n = u8::from_str_radix(&buf.trim_end(), 10)?;
info!("Current fan mode: {:#?}", FanLevel::from(n));
// wrap around the step number
if n < 2 {
n += 1;
} else {
n = 0;
}
info!("Fan mode stepped to: {:#?}", FanLevel::from(n));
fan_ctrl
.write_all(format!("{:?}\n", config.fan_mode).as_bytes())
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", path, err));
self.set_pstate_for_fan_mode(FanLevel::from(n), config)?;
config.fan_mode = n;
config.write();
let mut n = config.fan_mode;
info!("Current fan mode: {:?}", FanLevel::from(n));
// wrap around the step number
if n < 2 {
n += 1;
} else {
n = 0;
}
info!("Fan mode stepped to: {:?}", FanLevel::from(n));
fan_ctrl
.write_all(format!("{:?}", config.fan_mode).as_bytes())
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", path, err));
self.set_pstate_for_fan_mode(FanLevel::from(n), config)?;
config.fan_mode = n;
config.write();
Ok(())
}

View File

@@ -7,7 +7,7 @@ use rog_aura::{
AuraDbusWriter, LED_MSG_LEN,
};
static VERSION: &'static str = "0.9.4";
static VERSION: &'static str = "0.9.6";
#[derive(Debug, Options)]
struct CLIStart {