First version published

This commit is contained in:
Zykino 2020-04-14 20:13:54 +02:00
parent 0d28f4b232
commit 4a3f75db58
4 changed files with 24 additions and 41 deletions

47
Cargo.lock generated
View File

@ -44,11 +44,12 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "confy" name = "confy"
version = "0.4.0" version = "0.4.0"
source = "git+https://github.com/rust-cli/confy#13a97fc205dbc06f44e0ba79d03ab609639e876b" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2913470204e9e8498a0f31f17f90a0de801ae92c8c5ac18c49af4819e6786697"
dependencies = [ dependencies = [
"directories", "directories",
"serde", "serde",
"serde_yaml", "toml",
] ]
[[package]] [[package]]
@ -90,12 +91,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "dtoa"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3"
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.14" version = "0.1.14"
@ -119,12 +114,6 @@ version = "0.2.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
[[package]]
name = "linked-hash-map"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.9" version = "1.0.9"
@ -202,18 +191,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "serde_yaml"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
dependencies = [
"dtoa",
"linked-hash-map",
"serde",
"yaml-rust",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.16" version = "1.0.16"
@ -234,6 +211,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "toml"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.0" version = "0.2.0"
@ -267,12 +253,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "yaml-rust"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
dependencies = [
"linked-hash-map",
]

View File

@ -4,14 +4,15 @@ version = "0.1.0"
authors = ["Zykino <Zykino@users.noreply.github.com>"] authors = ["Zykino <Zykino@users.noreply.github.com>"]
description = "Control your Raspberry Pi's temperature with a fan." description = "Control your Raspberry Pi's temperature with a fan."
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
keywords = ["temperature", "fan", "raspberry pi"] keywords = ["temperature", "fan", "raspberry"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
readme = "README.md" readme = "README.md"
repository = "https://zykino.net/gitea/zykino/Tempi"
documentation = "https://docs.rs/tempi"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
#"0.5.0"? # Will need something more than this version to have yaml support #"0.5.0"? # Will need something more than this version to have yaml support
confy = { git = "https://github.com/rust-cli/confy", features = ["yaml_conf"], default-features = false } confy = "0.4.0"
rppal = "0.11.3" rppal = "0.11.3"
serde = { version = "1.0.104", features = ["derive"] } serde = { version = "1.0.104", features = ["derive"] }

View File

@ -5,6 +5,11 @@ Control your Raspberry Pi's temperature with a fan.
This program control a GPIO pin depending on the temperature of your CPU. It is thought of as a way to regulate the CPU's temperature by connecting a fan to the GPIO and letting the program check the temperature at a regular interval in the background. This program control a GPIO pin depending on the temperature of your CPU. It is thought of as a way to regulate the CPU's temperature by connecting a fan to the GPIO and letting the program check the temperature at a regular interval in the background.
## Installation ## Installation
### From Crates.io
```sh
cargo install tempi
```
### From source ### From source
First you need to [install Rust]. Then you can do the Rust's standard installation procedure: First you need to [install Rust]. Then you can do the Rust's standard installation procedure:
```sh ```sh
@ -22,7 +27,8 @@ scp target/arm-unknown-linux-gnueabihf/release/tempi pi@<YOUR_PI_IP>:<PATH_TO_WH
To use the application you just have to start the `tempi` executable. If you want to use it on a daily basis, it is recommanded to start the application at logon or startup. To use the application you just have to start the `tempi` executable. If you want to use it on a daily basis, it is recommanded to start the application at logon or startup.
## Configuration ## Configuration
The only way to configure `tempi` is with a configuration file. The configuration file is written in yaml, but if you don't know what it is, you can surely copy one of the examples below and twist the values as you like. The only way to configure `tempi` is with a configuration file. The configuration file is written in yaml, you can copy one of the examples below and twist the values as you like.
On Linux the configuration file is `~/.config/tempi/tempi.yml`.
By default `tempi` will control the pin 18 (physical 12) in an `Hysteresis` mode. The configuration file corresponding is the following: By default `tempi` will control the pin 18 (physical 12) in an `Hysteresis` mode. The configuration file corresponding is the following:
```yaml ```yaml
@ -38,7 +44,7 @@ mode:
verbosity_mode: Human # One of Human, Machine or Quiet verbosity_mode: Human # One of Human, Machine or Quiet
``` ```
If you prefer using the `PWM` mode you first need to follow this instructions to [enable PWM on your Raspberry Pi]. It is also recommended to let [the members of the gpio group configure PWM] without being root. Then you can use and adapt the following configuration file: If you prefer using the `PWM` mode you first need to follow this instructions to [enable PWM on your Raspberry Pi]. It is also recommended to let [the members of the gpio group configure PWM] without being root. Then you can use and adapt the following configuration file:
```yaml ```yaml
--- ---
check_interval: check_interval:

View File

@ -29,7 +29,6 @@ impl Default for Config {
Config { Config {
check_interval: Duration::from_secs(10), check_interval: Duration::from_secs(10),
mode: FanMode::Hysteresis(HysteresisConfig::default()), mode: FanMode::Hysteresis(HysteresisConfig::default()),
//mode: FanMode::Pwm(PwmConfig::default()),
verbosity_mode: VerbosityMode::Human, verbosity_mode: VerbosityMode::Human,
} }
} }