Skip to content

Commit

Permalink
doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
cronosun committed May 23, 2020
1 parent 47a12c5 commit 780fdf6
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 74 deletions.
86 changes: 86 additions & 0 deletions ADVANCED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
## Building

Checkout and use a current rust version. Should build out of the box. Windows only.

## Usage: `atrofac-cli`

### Change power plan

Note: This DOES NOT adjust the fan curve. It uses the default fan curve defined by Asus.

```shell
atrofac-cli plan <PLAN>
```

Examples:

```shell
atrofac-cli plan silent
atrofac-cli plan performance
atrofac-cli plan turbo
atrofac-cli plan windows
```

### Change fan curve

This adjusts the fan curve and sets a power plan.

```shell
atrofac-cli fan --plan <PLAN> --cpu <FAN_CURVE> --gpu <FAN_CURVE>
```

The `FAN_CURVE` is basically the same you can do graphically in the Armoury Crate GUI. It's a list (8 entries) of temperature and fan percentage. Assume you want to set a fan curve that looks like this:

| Entry | Temperature | Fan Percentage |
| --- |:---:| ---:|
| 0 | 30 | 0% |
| 1 | 40 | 5% |
| 2 | 50 | 10% |
| 3 | 60 | 20% |
| 4 | 70 | 35% |
| 5 | 80 | 55% |
| 6 | 90 | 65% |
| 7 | 100 | 65% |

... in this case the `FAN_CURVE` string would look like this: `30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65%`.

#### Examples

Set the silent power profile and set the fan curves (CPU & GPU) to a minimum:

```shell
atrofac-cli fan
```

Set the windows power plan and set the fan curves:

```shell
atrofac-cli fan --plan windows --cpu 30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65% --gpu 30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65%
```

#### Limits

autrofac will automatically adjust dangerous fan curves (**NO GUARANTEE THAT THIS REALLY WORKS**). These are the limits:

| Entry | Temperature | Fan Percentage (CPU) | Fan Percentage (GPU) |
| --- |:---:| ---:| ---:|
| 0 | 30..39 | 0% or higher | 0% or higher |
| 1 | 40..49 | 0% or higher | 0% or higher |
| 2 | 50..59 | 0% or higher | 0% or higher |
| 3 | 60..69 | 0% or higher | 0% or higher |
| 4 | 70..79 | 31% or higher | 34% or higher |
| 5 | 80..89 | 49% or higher | 51% or higher |
| 6 | 90..99 | 56% or higher | 61% or higher |
| 6 | 100..109 | 56% or higher | 61% or higher |

So it's possible to operate the Zephyrus G14 fanless as long as the temperatures of the GPU & CPU are below 69 degrees celsius.

## GUI

There's no GUI yet... but you can crate a shortcut, like this:

![Shortcut](bin/shortcut.png)

## Technical details

It uses the `DeviceIoControl` function (windows API) on the `\\.\ATKACPI`-file to change the power plan and set the fan curve (like the Armoury Crate does).
108 changes: 44 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,94 +11,74 @@ A library and a command line application to control the power plan, and the fan
This is a very early proof of concept:

* Needs to be tested on other devices than just mine (firmware `GA401IU.212`, Ryzen 7 4800HS, GeForce GTX 1660 Ti).
* A graphical user interface would be nice.
* Documentation from Asus would be nice.

## Building
## Getting started (end user documentation)

Checkout and use a current rust version. Should build out of the box. Windows only.
You most likely want to use the atrofac GUI (if not, see here for the command line version: [ADVANCED.md](ADVANCED.md)). It's a simple system tray application that runs in the background.

There's no CI yet, but there's a prebuilt binary of the CLI-tool: [atrofac-cli.exe](bin/atrofac-cli.exe)
![System tray](bin/systray.png)

## Usage: `atrofac-cli`
### Step 1: Download

### Change power plan
Download the binary: [atrofac-gui.exe](bin/atrofac-gui.exe).

Note: This DOES NOT adjust the fan curve. It uses the default fan curve defined by Asus.
### Step 2: Autostart

```shell
atrofac-cli plan <PLAN>
```
You usually want atrofac to be started when your computer starts. You can also skip this step and start the application manually.

Examples:
Press Windows-Key + R. This opens "Run":

```shell
atrofac-cli plan silent
atrofac-cli plan performance
atrofac-cli plan turbo
atrofac-cli plan windows
```
![Run](bin/startup.png)

### Change fan curve
Enter `shell:startup`. Now move the "autrofac-gui" to the Start-up folder. Done.

This adjusts the fan curve and sets a power plan.
![Run](bin/startup_folder.png)

```shell
atrofac-cli fan --plan <PLAN> --cpu <FAN_CURVE> --gpu <FAN_CURVE>
```
### Step 3: Start the app

The `FAN_CURVE` is basically the same you can do graphically in the Armoury Crate GUI. It's a list (8 entries) of temperature and fan percentage. Assume you want to set a fan curve that looks like this:
Start the app and you should see a new icon in the system tray; the app is running.

| Entry | Temperature | Fan Percentage |
| --- |:---:| ---:|
| 0 | 30 | 0% |
| 1 | 40 | 5% |
| 2 | 50 | 10% |
| 3 | 60 | 20% |
| 4 | 70 | 35% |
| 5 | 80 | 55% |
| 6 | 90 | 65% |
| 7 | 100 | 65% |
![Screenshot](bin/tray.png)

... in this case the `FAN_CURVE` string would look like this: `30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65%`.
### More

#### Examples
atrofac comes preconfigured with 6 different profiles ("Silent (Fanless)", "Silent (Low-Speed-Fan)", ...). If you want to see what those profiles do - or change them, click on "Edit configuration"; the configuration is just a yaml file. After saving the file you have to click "Reload configuration" to apply the changes. If you break the configuration file, the app won't start up anymore. Don't worry: Just delete the broken configuration file and atrofac will create a new one. The file can be found here (note: the folder `AppData` is hidden by default):

Set the silent power profile and set the fan curves (CPU & GPU) to a minimum:
``
C:\Users\<YOUR_USER_NAME>\AppData\Roaming\atrofac_gui_config.yaml
``

```shell
atrofac-cli fan
```
An entry for a plan looks like this:

Set the windows power plan and set the fan curves:

```shell
atrofac-cli fan --profile windows --cpu 30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65% --gpu 30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65%
```yaml
- name: Silent (Fanless)
plan: silent
update_interval_sec: 30
cpu_curve: "30c:0%,40c:0%,50c:0%,60c:0%,70c:31%,80c:49%,90c:56%,100c:56%"
gpu_curve: "30c:0%,40c:0%,50c:0%,60c:0%,70c:34%,80c:51%,90c:61%,100c:61%"
```
#### Limits

autrofac will automatically adjust dangerous fan curves (**NO GUARANTEE THAT THIS REALLY WORKS**). These are the limits:

| Entry | Temperature | Fan Percentage (CPU) | Fan Percentage (GPU) |
| --- |:---:| ---:| ---:|
| 0 | 30..39 | 0% or higher | 0% or higher |
| 1 | 40..49 | 0% or higher | 0% or higher |
| 2 | 50..59 | 0% or higher | 0% or higher |
| 3 | 60..69 | 0% or higher | 0% or higher |
| 4 | 70..79 | 31% or higher | 34% or higher |
| 5 | 80..89 | 49% or higher | 51% or higher |
| 6 | 90..99 | 56% or higher | 61% or higher |
| 6 | 100..109 | 56% or higher | 61% or higher |
* `name`: The name, obviously.
* `plan`: One of `silent`, `windows`, `performance`, `turbo`.
* `update_interval_sec`: Armoury crate will overwrite the changes made by atrofac eventually (usually when waking up from sleep; when going from AC to DC or vice versa). So atrofac will periodically apply the settings every n seconds. I suggest choosing a value between 5-240 seconds.
* `cpu_curve`: CPU fan curve, see [ADVANCED.md](ADVANCED.md).
* `gpu_curve`: GPU fan curve, see [ADVANCED.md](ADVANCED.md).

You can also omit `cpu_curve` and `gpu_curve` in that case the default fan curves (as defined by Asus) are used.

So it's possible to operate the Zephyrus G14 fanless as long as the temperatures of the GPU & CPU are below 69 degrees celsius.
## Advanced

## GUI
See [ADVANCED.md](ADVANCED.md) if you need more information such as:

There's no GUI yet... but you can crate a shortcut, like this:
* The command line version of this tool.
* Building.
* Technical information.
* Fan-curve details.

## Binaries

![Shortcut](bin/shortcut.png)
There's no CI yet, but there are prebuilt binaries:

## Technical details
* GUI: [atrofac-gui.exe](bin/atrofac-gui.exe)
* CLI-tool: [atrofac-cli.exe](bin/atrofac-cli.exe)

It uses the `DeviceIoControl` function (windows API) on the `\\.\ATKACPI`-file to change the power plan and set the fan curve (like the Armoury Crate does).
Binary file modified bin/atrofac-cli.exe
Binary file not shown.
Binary file added bin/atrofac-gui.exe
Binary file not shown.
Binary file added bin/startup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/startup_folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/systray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/tray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions gui/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ fn main() {

// nothing to do for other operating systems
#[cfg(not(target_os = "windows"))]
fn main() {
}
fn main() {}
1 change: 0 additions & 1 deletion libgui/src/engine/engine.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use std::fs::{File, OpenOptions};
use std::io::{BufReader, BufWriter, Write};
use std::path::PathBuf;
Expand Down
13 changes: 7 additions & 6 deletions libgui/src/system/implementation.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use crate::system::{MenuItem, MenuItemIdx, MenuItemState, SystemEvent, SystemInterface};
use crate::systray::{Application, SystrayAction, SystrayError};
use atrofac_library::AfErr;
use msgbox::IconType;
use std::convert::TryFrom;
use std::path::PathBuf;
use std::process::Command;

use std::time::Duration;

use msgbox::IconType;

use atrofac_library::AfErr;

use crate::system::{MenuItem, MenuItemIdx, MenuItemState, SystemEvent, SystemInterface};
use crate::systray::{Application, SystrayAction, SystrayError};

pub struct SystemImpl {
app: Application,
}
Expand Down Expand Up @@ -39,7 +41,6 @@ impl SystemInterface for SystemImpl {
match string_menu_item.state {
MenuItemState::Default => {}
MenuItemState::Checked => {
// TODO
map_err(self.app.window.select_menu_item(index))?;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libgui/src/systray/win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ impl Window {
let hicon = unsafe {
user32::CreateIconFromResourceEx(
icon_data.as_ptr() as PBYTE,
buffer.len() as u32-offset as u32,
buffer.len() as u32 - offset as u32,
TRUE,
0x30000,
width as i32,
Expand Down

0 comments on commit 780fdf6

Please sign in to comment.