Skip to content

Commit

Permalink
Minor update to AK400 PRO, new release
Browse files Browse the repository at this point in the history
  • Loading branch information
Nortank12 committed Dec 20, 2024
1 parent 7e9a5d2 commit f87d931
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deepcool-digital-linux"
version = "0.6.0"
version = "0.6.1"
edition = "2021"

[dependencies]
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
- [Systemd](#systemd-arch-debian-ubuntu-fedora-etc)
- [OpenRC](#openrc-gentoo-artix-linux-etc)
- [Device List](#more-information)
- [Contributions](#contributions)

# About
This program is meant to replicate the functionality of the original `DeepCool Digital`
Expand Down Expand Up @@ -107,7 +106,7 @@ sudo nixos-rebuild switch
</tr>
<tr>
<td>AK400 DIGITAL PRO</td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td>AK500 DIGITAL</td>
Expand Down Expand Up @@ -293,6 +292,3 @@ sudo rc-update add deepcool-digital default

# More Information
[Device List and USB Mapping Tables](device-list)

# Contributions
LD Series: [asdfzdfj](https://github.com/asdfzdfj) / [deepcool-ld-digital-hidapi](https://github.com/asdfzdfj/deepcool-ld-digital-hidapi)
2 changes: 1 addition & 1 deletion device-list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</tr>
<tr>
<td>16</td>
<td>AK400 PRO</td>
<td>AK400 DIGITAL PRO</td>
<td align="center">
<a href="tables/ak400-pro.md">Mapping Table</a>
</td>
Expand Down
8 changes: 4 additions & 4 deletions src/devices/ak400_pro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use std::{process::exit, thread::sleep, time::Duration};
pub const DEFAULT_MODE: Mode = Mode::Auto;
pub const POLLING_RATE: u64 = 750;
// The temperature limits are hard-coded in the device
// pub const TEMP_WARM_C: u8 = 80;
// pub const TEMP_WARM_F: u8 = 176;
pub const TEMP_HOT_C: u8 = 90;
pub const TEMP_HOT_F: u8 = 194;
pub const TEMP_WARNING_C: u8 = 80;
pub const TEMP_WARNING_F: u8 = 176;
pub const TEMP_LIMIT_C: u8 = 90;
pub const TEMP_LIMIT_F: u8 = 194;


pub struct Display {
Expand Down
17 changes: 13 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn main() {
} else {
ak_series::TEMP_LIMIT_C
},
temp_warning: 0,
},
ak_series::POLLING_RATE,
);
Expand All @@ -84,6 +85,7 @@ fn main() {
} else {
ls_series::TEMP_LIMIT_C
},
temp_warning: 0,
},
ls_series::POLLING_RATE,
);
Expand All @@ -102,6 +104,7 @@ fn main() {
Alarm {
state: if args.alarm { AlarmState::On } else { AlarmState::Off },
temp_limit: ag_series::TEMP_LIMIT_C,
temp_warning: 0,
},
ag_series::POLLING_RATE,
);
Expand All @@ -127,6 +130,7 @@ fn main() {
} else {
ld_series::TEMP_LIMIT_C
},
temp_warning: 0,
},
ld_series::POLLING_RATE,
);
Expand All @@ -151,9 +155,14 @@ fn main() {
Alarm {
state: AlarmState::Auto,
temp_limit: if args.fahrenheit {
ak400_pro::TEMP_HOT_F
ak400_pro::TEMP_LIMIT_F
} else {
ak400_pro::TEMP_HOT_C
ak400_pro::TEMP_LIMIT_C
},
temp_warning: if args.fahrenheit {
ak400_pro::TEMP_WARNING_F
} else {
ak400_pro::TEMP_WARNING_C
},
},
ak400_pro::POLLING_RATE,
Expand All @@ -176,7 +185,7 @@ fn main() {
print_device_status(
if args.mode == Mode::Default { ch_series::DEFAULT_MODE } else { args.mode },
if args.fahrenheit { TemperatureUnit::Fahrenheit } else { TemperatureUnit::Celsius },
Alarm { state: AlarmState::NotSupported, temp_limit: 0 },
Alarm { state: AlarmState::NotSupported, temp_limit: 0, temp_warning: 0 },
ch_series::POLLING_RATE,
);
if args.alarm {
Expand All @@ -194,7 +203,7 @@ fn main() {
print_device_status(
if args.mode == Mode::Default { ch510::DEFAULT_MODE } else { args.mode },
if args.fahrenheit { TemperatureUnit::Fahrenheit } else { TemperatureUnit::Celsius },
Alarm { state: AlarmState::NotSupported, temp_limit: 0 },
Alarm { state: AlarmState::NotSupported, temp_limit: 0, temp_warning: 0 },
ch510::POLLING_RATE,
);
if args.alarm {
Expand Down
22 changes: 17 additions & 5 deletions src/utils/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,30 @@ pub enum AlarmState {
pub struct Alarm {
pub state: AlarmState,
pub temp_limit: u8,
pub temp_warning: u8,
}

pub fn print_device_status(mode: Mode, temp_unit: TemperatureUnit, alarm: Alarm, polling_rate: u64) {
println!("-----");
println!("DISP. MODE: {}", mode.symbol().bright_cyan());
println!("TEMP. UNIT: {}", temp_unit.symbol().bright_cyan());
match alarm.state {
AlarmState::Auto => println!(
"ALARM: {} | {}",
"auto".bright_green(),
(alarm.temp_limit.to_string() + temp_unit.symbol()).bright_cyan()
),
AlarmState::Auto => {
if alarm.temp_warning > 0 {
println!(
"ALARM: {} | {} [warning: {}]",
"auto".bright_green(),
(alarm.temp_limit.to_string() + temp_unit.symbol()).bright_cyan(),
(alarm.temp_warning.to_string() + temp_unit.symbol()).bright_cyan()
);
} else {
println!(
"ALARM: {} | {}",
"auto".bright_green(),
(alarm.temp_limit.to_string() + temp_unit.symbol()).bright_cyan()
);
}
}
AlarmState::On => println!(
"ALARM: {} | {}",
"on".bright_green(),
Expand Down

0 comments on commit f87d931

Please sign in to comment.