feat: use mdBook for documentation (#10)

This commit is contained in:
Markus Zehnder
2025-08-28 23:22:04 +02:00
committed by GitHub
parent d98cd89c48
commit 3414589bd5
24 changed files with 317 additions and 194 deletions
+28
View File
@@ -0,0 +1,28 @@
# Sensor Panels
- [Sensor panels](panel.md)
- [Custom sensor panels](custom_panel.md)
- [Configuration](cfg/)
## Sensor Modes
Different sensor modes are supported:
- [Sensor mode 1: Text](cfg/mode1_text.md)
- [Sensor mode 2: Circular Progress](cfg/mode2_circular.md)
- [Sensor mode 3: Progress](cfg/mode3_progress.md)
- [Sensor mode 4: Pointer](cfg/mode4_pointer.md)
## Sensor Data Sources
The sensor value reading is separated from the `asterctl` tool.
Sensor values are provided in separate text files and are automatically read when the file changes.
Only the file data source is supported at the moment, other sources like pipes, sockets etc. might be supported later.
- [Text file data source](provider/text_file.md)
### Sensor Data Providers
- Proof of concept [Linux shell scripts](provider/shell_scripts.md)
- [sysinfo tool](provider/sysinfo.md)
+43
View File
@@ -0,0 +1,43 @@
# Sensor Configuration
Specify configuration file to use:
```shell
asterctl --config monitor.json
```
- The configuration file is loaded from the configuration directory if not an absolute path is specified.
- The default configuration directory is `./cfg` and can be changed with the `--config-dir` command line option.
The original AOOSTAR-X json configuration file format is used, but only a subset of the configuration is supported:
- Setup object fields:
- `switchTime`: Optional switch time between panels in seconds, string value interpreted as float and converted to milliseconds. Default: 5
- `refresh`: Panel redraw interval in seconds specified as a float number. Default: 1
- Panel object fields in `diy[]`:
- `img`: Background image filename. Loaded from the specified configuration directory if not an absolute path is specified.
- `sensor`: Array of sensor objects.
- Sensor object fields:
- `label`: label identifier, also used as sensor value data source identifier
- `integerDigits`: sensor value format option: number of integer places. Value is 0-prefixed to number of places and set to `99` if overflown.
- `decimalDigits`: sensor value format option: number of decimal places.
- `unit`: optional unit label, appended after the sensor value
- `x`: x-position
- `y`: y-position
- `fontFamily`: Font name matching font filename without file extension. Fonts are loaded from the configured font directory.
- `fontSize`: Font size
- `fontColor`: Font color in `#RRGGBB` notation, or `-1` if not set. Examples: `#ffffff` = white, `#ff0000` = red. Default: `#ffffff`
- `textAlign`: Text alignment: `left`, `right`, `center`
- Fields used for the fan (2), progress (3) and pointer (4) sensor modes:
- `min_value` and `max_value`
- `width` and `height`
- `direction`
- `pic`: progress image, loaded from the specified configuration directory if not an absolute path is specified.
- `min_angle` and `max_angle`
- `xz_x` and `xz_y`
Example configuration file: [cfg/monitor.json](https://github.com/zehnm/aoostar-rs/blob/main/cfg/monitor.json).
Sensor values are not read from the configuration file (the `sensor.value` field is ignored).
See [Sensor Value Provider](../provider).
More options might be supported later.
+96
View File
@@ -0,0 +1,96 @@
# Sensor Mode 1 Text
A text sensor renders a text label with a sensor value and an optional unit text on the panel.
The value can be formatted as a fixed point decimal number or as an integer.
Text sensor configuration fields:
- `mode`: 1 (for text)
- `label`: label identifier, also used as sensor value data source identifier
- `direction`: 1 = left to right, 2 = right to left, 3 = top to bottom, 4 = bottom to top
- `label`: data source id to retrieve the current value from
- `unit`: optional unit label, appended after the sensor value
- `x`, `y`: position on the panel
- `fontFamily`: Font name matching font filename without file extension.
- Fonts are loaded from the configured font directory, or from the custom panel's `fonts` directory.
- An absolute file path can also be used.
- `fontSize`: Font size
- `fontColor`: Font color in `#RRGGBB` notation, or `-1` if not set.
- Examples: `#ffffff` = white, `#ff0000` = red. Default: `#ffffff`
- `textAlign`: Text alignment: `left`, `center`, `right`
- `integerDigits`: number of integer digits: -1 or missing field = all digits, > 0 prefix with `0` and set to `9` if overflown
- `decimalDigits`: number fixed point digits: -1 = auto, 0 = integer number without decimal digits, > 0 fixed number of decimal digits
## Value Formatting
The sensor value can be formatted with the `unit` and `integerDigits` & `decimalDigits` options.
- The unit value is simply appended to the value, without whitespace.
- Example formatting for the value `123.456` with `integerDigits` & `decimalDigits`:
| integer | decimal | output |
|---------|---------|----------|
| 5 | 2 | 00123.46 |
| 5 | 1 | 00123.5 |
| 5 | 0 | 00123 |
| -1 | 2 | 123.46 |
| -1 | 1 | 123.5 |
| -1 | 0 | 123 |
| 2 | 0 | 99 |
## Example
Example `panel.json` with two "text" indicator sensors and the following (partial) background image in `img`:
<img src="../../img/sensor_mode1_background.png" alt="sensor mode 1 background image example">
The background image and sensor definitions are taken from the default system panel configuration in the AOOSTAR-X app.
```json
{
"name": "Text test panel",
"img": "background.png",
"sensor": [
{
"mode": 1,
"name": "CPU temp",
"label": "cpu_temperature",
"x": 195,
"y": 110,
"value": "65",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 120,
"fontColor": -1,
"textAlign": "center",
"decimalDigits": 0
},
{
"mode": 1,
"name": "CPU usage",
"label": "cpu_percent",
"unit": "%",
"x": 200,
"y": 285,
"value": "47.4",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 60,
"fontColor": -1,
"textAlign": "center",
"decimalDigits": 0
}
]
}
```
The following graphic is rendered for the two text fields defined above:
<img src="../../img/sensor_mode1.png" alt="sensor mode 1 example">
## Known Issues
Text sensor formatting has been reverse engineered from the AOOSTAR-X app. Not all options are supported
- Text position and font size calculation doesn't always match AOOSTAR-X.
- Needs investigation if value is in pixel or points.
- Might also need dpi adjustments.
- `fontWeight` not yet supported.
+69
View File
@@ -0,0 +1,69 @@
# Sensor Mode 2 Circular Progress
A circular progress sensor (known as `fan` in the AOOSTAR-X software) masks a progress bar image for a certain angular
range based on the corresponding sensor value. The masked image is alpha-blended with the panel image.
Sensor configuration fields:
- `mode`: 2 (for fan)
- `direction`: 1 = clockwise, 2 = counter-clockwise
- `label`: label identifier, also used as sensor value data source identifier
- `x`, `y`: position on the panel
- `width`, `height`: size of the circular progress element (not yet used)
- `pic`: circular progress image to overlay. Should match `width`, `height`
- `minAngle`, `maxAngle`: range of the masked image
- `minValue`, `maxValue`: clamp sensor value to this range
- `xz_x`, `xz_y`
## Example
The following configuration and graphics are taken from the `仪表盘_windows` panel configuration in `有线网卡 windows驱动.rar`.
Example `panel.json` with a single "fan" indicator sensor and the following (partial) background image in `img`:
<img src="../../img/sensor_mode2_background.jpg" alt="sensor mode 2 background image example">
```json
{
"name": "Fan test panel",
"img": "background.jpg",
"sensor": [
{
"id": "29d9ef2d-30b4-459d-b2b0-43cb6d4d6b41",
"itemName": "CPU usage",
"mode": 2,
"direction": 1,
"label": "cpu_percent",
"value": "47.7",
"x": 168,
"y": 184,
"width": 237,
"height": 237,
"minAngle": -160,
"maxAngle": 30,
"minValue": 0,
"maxValue": 80,
"xz_x": 0,
"xz_y": 0,
"pic": "progress_circle.png"
}
]
}
```
Progress image `"pic": "progress_circle.png"`:
![progress graphic](../../img/progress_circle.png)
The following graphic is rendered for progress example above:
<img src="../../img/sensor_mode2.jpg" alt="sensor mode 2 example">
## Known Issues
Fan sensor rendering has been reverse engineered from the AOOSTAR-X app. Not all options are supported.
- Work in progress, not yet fully tested
- `direction: 2` doesn't seem to work
- `widht`, `height` should be considered and auto-resized as for mode 4
+98
View File
@@ -0,0 +1,98 @@
# Sensor Mode 3 Progress
A progress sensor crops a progress image based on the corresponding sensor value and alpha-blends it with the panel image.
Sensor configuration fields:
- `mode`: 3 (for progress)
- `label`: label identifier, also used as sensor value data source identifier
- `direction`: 1 = left to right, 2 = right to left, 3 = top to bottom, 4 = bottom to top
- `x`, `y`: position on the panel
- `pic`: progress image to crop and overlay
- `minValue`, `maxValue`: clamp sensor value to this range
## Example
Example `panel.json` with two "progress" indicator sensor and the following (partial) background image in `img`:
<img src="../../img/sensor_mode3_background.png" alt="sensor mode 3 background image example">
The background image and sensor definitions are taken from the default system panel configuration in the AOOSTAR-X app.
```json
{
"name": "Progress test panel",
"img": "background.png",
"sensor": [
{
"mode": 3,
"name": "SSD 4 usage",
"label": "storage_ssd4_usage",
"x": 400,
"y": 45,
"direction": 1,
"value": "35",
"minValue": 0,
"maxValue": 100,
"pic": "progress.png"
},
{
"mode": 3,
"name": "SSD 5 usage",
"label": "storage_ssd5_usage",
"x": 400,
"y": 106,
"direction": 1,
"value": "80",
"minValue": 0,
"maxValue": 100,
"pic": "progress.png"
},
{
"mode": 1,
"name": "SSD 4 temp",
"label": "storage_ssd4_temperature",
"x": 580,
"y": 70,
"direction": 1,
"value": "34",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃"
},
{
"mode": 1,
"name": "SSD 5 temp",
"label": "storage_ssd5_temperature",
"x": 580,
"y": 130,
"direction": 1,
"value": "35",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃"
}
]
}
```
Progress image `"pic": "progress.png"`:
![progress graphic](../../img/progress.png)
The following graphic is rendered for progress example above:
<img src="../../img/sensor_mode3.png" alt="sensor mode 3 example">
## Known Issues
Progress sensor rendering has been reverse engineered from the AOOSTAR-X app. Not all options are supported.
- Work in progress, not yet fully tested
- `widht`, `height` should be considered and auto-resized as for mode 4
+65
View File
@@ -0,0 +1,65 @@
# Sensor Mode 4 Pointer
A pointer sensor rotates an image at a certain angle calculated from the current sensor value and alpha-blends it with
the panel image.
Sensor configuration fields:
- `mode`: 4 (for pointer)
- `direction`: 1 = clockwise, 2 = counter-clockwise
- `label`: label identifier, also used as sensor value data source identifier
- `x`, `y`: position on the panel
- `width`, `height`: size of the pointer
- `pic`: pointer image to overlay. Should match `width`, `height`, otherwise it will be resized
- `minAngle`, `maxAngle`: range of the rotated image
- `minValue`, `maxValue`: scaling range to apply on the value for `minAngle` .. `maxAngle` (to be verified)
- `xz_x`, `xz_y`
## Example
The following configuration and graphics are taken from the `三环_windows` panel configuration in `有线网卡 windows驱动.rar`.
Example `panel.json` with a single "pointer" indicator sensor and the following (partial) background image in `img`:
<img src="../../img/sensor_mode4_background.png" alt="sensor mode 4 background image example">
```json
{
"name": "Pointer test panel",
"img": "background.jpg",
"sensor": [
{
"id": "a9d4acac-2af9-4fe0-9f69-86cd09f25696",
"itemName": "CPU dial",
"mode": 4,
"direction": 1,
"label": "cpu_percent",
"value": "47.7",
"x": 160,
"y": 208,
"width": 302,
"height": 302,
"minAngle": -110,
"maxAngle": 110,
"minValue": 0,
"maxValue": 90,
"xz_x": 0,
"xz_y": 0,
"pic": "pointer.png"
}
]
}
```
Pointer image `"pic": "pointer.png"`:
![pointer graphic](../../img/mode4_pic.png)
The following graphic is rendered for a sensor value of `47.7`:
<img src="../../img/sensor_mode4.png" alt="sensor mode 4 example">
## Known Issues
Pointer sensor rendering has been reverse engineered from the AOOSTAR-X app. Not all options are supported.
- Work in progress, not yet fully tested
+33
View File
@@ -0,0 +1,33 @@
# Custom Panels
By default, the defined panels in the main configuration file are loaded and rendered.
Additional custom panels can be included with the `--panels` command line parameter.
A custom panel consists of:
- a `panel.json` file with just the json object of the `diy` array of the main configuration file.
- `img` subdirectory containing the referenced images in `panel.json`
- `fonts` subdirectory containing the referenced fonts in `panel.json`
Example:
```
.
├── fonts
│   ├── HarmonyOS_Sans_SC_Bold.ttf
│   └── ROGFontsv.ttf
├── img
│   ├── 6ae90fde-d0a1-44ec-9e15-7b6af14e3b7b.jpg
│   ├── 95f38f70-9e0c-4b54-80a9-6bd7b0b4475c_1744449208_1746941971.png
│   ├── f1c3d74c-0157-4b77-82a6-f07e565fe439_1744447224_1746941971.png
│   └── f5d534e5-4527-4ca0-a0e9-69e8eef86f62_1744447151_1746941971.png
└── panel.json
```
There are lots of custom panel configurations available online.
AOOSTAR support sent the following link: <http://pan.sztbkj.com:5244/>, look for a file called [`有线网卡 windows驱动.rar`](http://pan.sztbkj.com:5244/WTR%20MAX%206+5%E7%9B%98%E4%BD%8D/%E9%A9%B1%E5%8A%A8/%E6%9C%89%E7%BA%BF%E7%BD%91%E5%8D%A1%20windows%E9%A9%B1%E5%8A%A8.rar)
in the `WTR MAX 6+5盘位/驱动/` subfolder.
Example:
```shell
asterctl --config monitor.json --panels cfg/01_custom --panels cfg/02_custom
```
+27
View File
@@ -0,0 +1,27 @@
# Sensor Panels
The `asterctl` tool is started in sensor panel mode if the `--config` command line option is specified.
Sensor panels are dynamic screens showing various sensor values. Multiple rotating panels are supported.
The sensor values must be provided in simple key-value text files from external scripts or tools. The `asterctl` tool
is only responsible for rendering the panels on the embedded screen.
Example panels from the AOOSTAR-X software, rendered with `asterctl` using dummy sensor values:
<img src="../img/sensor_panel-01.png" alt="Sensor panel 1">
<img src="../img/sensor_panel-02.png" alt="Sensor panel 1">
See [custom sensor panels](custom_panel.md) for including custom panels.
## Supported Features
- One or multiple panels rotating in configurable interval (configuration value `setup.switchTime`).
- Each panel can be configured with multiple sensor fields.
- Text sensor value fields are supported (`sensor.mode: 1`), but there are still some text size and positioning issues.
- Fan (2), progress (3) and pointer (4) sensor modes are being worked on and not all configuration options are working yet.
- Each sensor field can be customized with an individual font, size, color and text alignment.
- Panels are redrawn at a configurable interval (configuration value `setup.refresh`).
- Only the updated areas of the image are sent to the display for faster updates.
See [Sensor Configuration](cfg/) for more information.
+1
View File
@@ -0,0 +1 @@
# Sensor Value Provider
+29
View File
@@ -0,0 +1,29 @@
# Sensor Data Provider Shell Scripts
The [/linux/scripts](../../../linux/scripts) directory contains some proof-of-concept Linux shell scripts.
CPU and memory usage are written into a sensor data source text file that can be used by `asterctl`.
```
./cpu_usage.sh -h
Simple PoC script to periodically write the CPU usage into a sensor text file.
Usage:
./cpu_usage.sh [-r REFRESH] [-s SENSOR_FILE] [-t TEMP_DIR]
-r REFRESH refresh in seconds. Default: 1
-s SENSOR_FILE output sensor file. Default: /tmp/sensors/cpu.txt
-t TEMP_DIR temporary directory. Default: /tmp
```
```
./mem_usage.sh -h
Simple PoC script to periodically write the memory usage into a sensor text file.
Usage:
./mem_usage.sh [-r REFRESH] [-s SENSOR_FILE] [-t TEMP_DIR]
-r REFRESH refresh in seconds. Default: 5
-s SENSOR_FILE output sensor file. Default: /tmp/sensors/mem.txt
-t TEMP_DIR temporary directory. Default: /tmp
```
+51
View File
@@ -0,0 +1,51 @@
# sysinfo Tool
The Rust based [sysinfo](https://github.com/zehnm/aoostar-rs/blob/main/crates/sysinfo) tool gathers many more system sensor values with the help of
the [sysinfo](https://github.com/GuillaumeGomez/sysinfo) crate.
It supports FreeBSD, Linux, macOS, Windows and other OSes, but it has only been tested on Linux so far.
```
Proof of concept sensor value collection for the asterctl screen control tool
Usage: sysinfo [OPTIONS]
Options:
-o, --out <OUT>
Output sensor file
-t, --temp-dir <TEMP_DIR>
Temporary directory for preparing the output sensor file.
The system temp directory is used if not specified.
The temp directory must be on the same file system for atomic rename
operation!
--console
Print values in console
-r, --refresh <REFRESH>
System sensor refresh interval in seconds
--disk-refresh <DISK_REFRESH>
Enable individual disk refresh logic as used in AOOSTAR-X.
Refresh interval in seconds
--smartctl
Retrieve drive temperature if `disk-update` option is enabled.
Requires smartctl and password-less sudo!
```
Single test run with printing all sensors in the console:
```shell
sysinfo --console
```
Normal mode providing sensor values for `asterctl` in `/tmp/sensors/sysinfo.txt` every 3 seconds:
```shell
sysinfo --refresh 3 --out /tmp/sensors/sysinfo.txt
```
Note: the lower the refresh rate, the more resources are used!
+57
View File
@@ -0,0 +1,57 @@
# Text File Data Source
- Text file with ending: `.txt`
- Simple key / value pairs, separated by a colon `:`. Example: `foo: bar`
- Line based: one key / value per line.
- Key and value are trimmed. Any whitespace will be removed.
- Empty lines and comments are ignored.
- Comments start with `#` at the beginning of the line.
- Support for special keys: if key ends with `#unit` then the value is the unit for the corresponding key before the suffix
- Example: `net_download_speed#unit: M/S` is the unit value for `net_download_speed`.
- This can be used for dynamic unit values if they sensor value provider cannot add the unit to the corresponding value.
- File contents will automatically be read when updated.
- This requires the sensor value provider to use atomic file updates!
- Best practice is to use a temporary file on the same filesystem and use a move or rename operation after all values have been written.
- One or multiple sensor text files are supported.
- Either a single file can be specified, or a directory path.
- If a directory is specified, all children matching the sensor file naming pattern will be read and monitored.
- Any subdirectories are ignored (no recursive support).
Example text file for the [cfg/monitor.json](https://github.com/zehnm/aoostar-rs/blob/main/cfg/monitor.json) panel configuration:
```
cpu_temperature: 65
cpu_percent: 98
memory_usage: 77
memory_Temperature: 48
net_ip_address: 146.56.182.244
gpu_core: 98
gpu_temperature: 78
net_upload_speed: 100
net_upload_speed#unit: K/S
net_download_speed: 120
net_download_speed#unit: M/S
motherboard_temperature: 38
storage_ssd[0]['temperature']: 31
storage_ssd[0]['used']: 17
storage_ssd[1]['temperature']: 32
storage_ssd[1]['used']: 27
storage_ssd[2]['temperature']: 33
storage_ssd[2]['used']: 37
storage_ssd[3]['temperature']: 34
storage_ssd[3]['used']: 47
storage_ssd[4]['temperature']: 35
storage_ssd[4]['used']: 57
storage_hdd[0]['temperature']: 36
storage_hdd[0]['used']: 17
storage_hdd[1]['temperature']: 37
storage_hdd[1]['used']: 27
storage_hdd[2]['temperature']: 38
storage_hdd[2]['used']: 37
storage_hdd[3]['temperature']: 39
storage_hdd[3]['used']: 47
storage_hdd[4]['temperature']: 40
storage_hdd[4]['used']: 57
storage_hdd[5]['temperature']: 10
storage_hdd[5]['used']: 67
```