Skip to content

Commit ccab543

Browse files
authored
Release v0.2.0
2 parents f32f2bd + 97a7737 commit ccab543

17 files changed

Lines changed: 307 additions & 46 deletions

File tree

Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ members = [
77
"omni-led-setup",
88
"omni-led-applications/audio",
99
"omni-led-applications/clock",
10+
"omni-led-applications/images",
1011
"omni-led-applications/media",
1112
"omni-led-applications/weather",
1213
]
1314

1415
resolver = "2"
16+
17+
[profile.release]
18+
lto = "fat"
19+
codegen-units = 1

Makefile.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ args = ["clean"]
99
[tasks.build-setup-dependencies]
1010
description = "Build binaries that will be included in the setup binary"
1111
command = "cargo"
12-
args = ["build", "--release", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
12+
args = ["build", "--release", "--package=omni-led", "--package=audio", "--package=clock",
13+
"--package=images", "--package=media", "--package=weather"]
1314

1415
[tasks.build-setup]
1516
description = "Build the setup binary"
@@ -27,12 +28,14 @@ dependencies = ["build-setup"]
2728
[tasks.build]
2829
description = "Build development binaries in debug mode"
2930
command = "cargo"
30-
args = ["build", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
31+
args = ["build", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock",
32+
"--package=images", "--package=media", "--package=weather"]
3133

3234
[tasks.build-release]
3335
description = "Build development binaries in release mode"
3436
command = "cargo"
35-
args = ["build", "--release", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
37+
args = ["build", "--release", "--features=dev", "--package=omni-led", "--package=audio",
38+
"--package=clock", "--package=images", "--package=media", "--package=weather"]
3639

3740
[tasks.run]
3841
description = "Run development binaries in debug mode"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ described [here](docs/customization.md).
3737
## Roadmap
3838

3939
- [ ] GIF support
40-
- [ ] Loading custom images (Load images and GIFs from disk)
40+
- [x] Loading custom images (Load images and GIFs from disk)
4141
- [ ] Getting events from discord (Mic status, currently speaking user etc.)
4242
- [ ] Graphical interface for installer and settings
4343

4444
## License
4545

46-
This project is licensed under the GNU General Public License v3.0, see [LICENSE](LICENSE) file for details.
46+
This project is licensed under the GNU General Public License v3.0, see [LICENSE](LICENSE) file for
47+
details.
File renamed without changes.

config/devices.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,31 @@ usb_device {
2323
memory_representation = 'BitPerPixel',
2424
}
2525

26+
usb_device {
27+
name = 'Steelseries Apex Pro',
28+
screen_size = {
29+
width = 128,
30+
height = 40,
31+
},
32+
usb_settings = {
33+
vendor_id = '0x1038',
34+
product_id = '0x1610',
35+
interface = '0x01',
36+
alternate_setting = '0x00',
37+
request_type = '0x21',
38+
request = '0x09',
39+
value = '0x0300',
40+
index = '0x01',
41+
},
42+
transform = function(buffer)
43+
local bytes = buffer:bytes()
44+
table.insert(bytes, 1, 0x61)
45+
table.insert(bytes, 0x00)
46+
return bytes
47+
end,
48+
memory_representation = 'BitPerPixel',
49+
}
50+
2651
emulator {
2752
name = 'Emulator',
2853
screen_size = {

config/scripts.lua

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -139,26 +139,26 @@ local function weather()
139139
end
140140

141141
SCREEN_BUILDER
142-
:new('Steelseries Apex 7 TKL')
143-
:with_layout_group({
144-
{
145-
layout = volume,
146-
run_on = { 'AUDIO.IsMuted', 'AUDIO.Name', 'AUDIO.Volume' },
147-
},
148-
{
149-
layout = spotify,
150-
run_on = { 'SPOTIFY.Artist', 'SPOTIFY.Progress', 'SPOTIFY.Title' },
151-
},
152-
{
153-
layout = clock,
154-
run_on = { 'CLOCK.Seconds' },
155-
},
156-
})
157-
:with_layout_group({
158-
{
159-
layout = weather,
160-
run_on = { 'CLOCK.Seconds' },
161-
}
162-
})
163-
:with_layout_group_toggle({ 'KEY(RAlt)', 'KEY(Slash)' })
164-
:register()
142+
:new('Emulator')
143+
:with_layout_group({
144+
{
145+
layout = volume,
146+
run_on = { 'AUDIO.IsMuted', 'AUDIO.Name', 'AUDIO.Volume' },
147+
},
148+
{
149+
layout = spotify,
150+
run_on = { 'SPOTIFY.Artist', 'SPOTIFY.Progress', 'SPOTIFY.Title' },
151+
},
152+
{
153+
layout = clock,
154+
run_on = { 'CLOCK.Seconds' },
155+
},
156+
})
157+
:with_layout_group({
158+
{
159+
layout = weather,
160+
run_on = { 'CLOCK.Seconds' },
161+
}
162+
})
163+
:with_layout_group_toggle({ 'KEY(RAlt)', 'KEY(Slash)' })
164+
:register()

docs/applications.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ to load any [custom application](#custom-applications) that provides the data y
99
OmniLED comes some applications pre-installed. Each one comes with its own README file that
1010
describes their usage and purpose.
1111

12-
- [audio](../oled-applications/audio/README.md)
13-
- [clock](../oled-applications/clock/README.md)
14-
- [media](../oled-applications/media/README.md)
15-
- [weather](../oled-applications/weather/README.md)
12+
- [audio](../omni-led-applications/audio/README.md)
13+
- [clock](../omni-led-applications/clock/README.md)
14+
- [images](../omni-led-applications/images/README.md)
15+
- [media](../omni-led-applications/media/README.md)
16+
- [weather](../omni-led-applications/weather/README.md)
1617

1718
## Custom Applications
1819

@@ -76,15 +77,15 @@ eliminates the need for the application to determine the server address manually
7677
> }
7778
> }
7879
> ```
79-
>
80+
>
8081
> In the above applications there 2 applications loaded: `my_application` and
8182
> `my_other_application`.
8283
> They both can be found in the default application directory, but for the first one
8384
> [`get_default_path`](scripting_reference.md#get_default_path) function was used, and for the
8485
> other the path was constructed manually using the [`PLATFORM`](scripting_reference.md#platform)
8586
> constants.
8687
> Also the application received different command line arguments, to send exactly what they expect.
87-
>
88+
>
8889
> For built-in applications' arguments refer to this [paragraph](#built-in-applications).
8990
9091
#### Reading `server.json`
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "images"
3+
version = "0.1.0"
4+
authors = ["Michał Bałabanow <m.balabanow@gmail.com>"]
5+
license = "GPL-3.0-only"
6+
edition = "2021"
7+
8+
[dependencies]
9+
clap = { version = "4.4", features = ["derive"] }
10+
image = "0.25"
11+
log = "0.4"
12+
omni-led-api = { path = "../../omni-led-api" }
13+
shlex = "1.3"
14+
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Images
2+
3+
Images application reads images from disk and converts them to a black and white image before
4+
sending it to OmniLED server.
5+
6+
## Running
7+
8+
```
9+
images --address <ADDRESS> [--image '<NAME> <PATH> [--format <FORMAT>] [--threshold <THRESHOLD>]']...
10+
```
11+
12+
Images expects two arguments
13+
14+
- Required:
15+
- `a`/`address` - server address
16+
- Optional:
17+
- `-i`/`--image` - loaded image options.
18+
This option can be specified multiple times and it a **single string** as it's argument with
19+
image load options:
20+
- `<NAME>` - This name will be used as variable name in user scripts.
21+
_This is a positional argument and shall always be specified as a first argument._
22+
- `<PATH>` - Path to an image file on disk.
23+
_This is a positional argument and shall always be specified as a second argument._
24+
- `-f`/`--format` - Image extension used as a hint for loading images when path doesn't
25+
contain an extension.
26+
- `-t`/`--threshold` - Threshold that will be used when converting the image to black and
27+
white. Values with brightness lower than threshold will be black, and above or equal to
28+
threshold will be white.
29+
Range: [0, 255].
30+
Default: 128
31+
32+
### Example
33+
34+
In this example `images` will load 2 images from disk.
35+
36+
```lua
37+
load_app {
38+
path = get_default_path('images'),
39+
args = {
40+
'--address', SERVER.Address,
41+
'--image', 'MyImage /path/to/my_image --format jpg --threshold 77',
42+
'--image', 'MyOtherImage "C:\\path\\to\\other image.png" --threshold 159',
43+
}
44+
}
45+
```
46+
47+
## Images Events
48+
49+
Images applications sends a single event with all loaded images with names specified as program
50+
arguments.
51+
52+
`IMAGES`: table
53+
54+
- `<NAME_1>`: `OLEDImage`,
55+
...
56+
- `<NAME_N>`: `OLEDImage`,

0 commit comments

Comments
 (0)