Skip to content

Commit

Permalink
Release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
llMBQll authored Dec 30, 2024
2 parents f32f2bd + 97a7737 commit ccab543
Show file tree
Hide file tree
Showing 17 changed files with 307 additions and 46 deletions.
16 changes: 14 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ members = [
"omni-led-setup",
"omni-led-applications/audio",
"omni-led-applications/clock",
"omni-led-applications/images",
"omni-led-applications/media",
"omni-led-applications/weather",
]

resolver = "2"

[profile.release]
lto = "fat"
codegen-units = 1
9 changes: 6 additions & 3 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ args = ["clean"]
[tasks.build-setup-dependencies]
description = "Build binaries that will be included in the setup binary"
command = "cargo"
args = ["build", "--release", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
args = ["build", "--release", "--package=omni-led", "--package=audio", "--package=clock",
"--package=images", "--package=media", "--package=weather"]

[tasks.build-setup]
description = "Build the setup binary"
Expand All @@ -27,12 +28,14 @@ dependencies = ["build-setup"]
[tasks.build]
description = "Build development binaries in debug mode"
command = "cargo"
args = ["build", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
args = ["build", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock",
"--package=images", "--package=media", "--package=weather"]

[tasks.build-release]
description = "Build development binaries in release mode"
command = "cargo"
args = ["build", "--release", "--features=dev", "--package=omni-led", "--package=audio", "--package=clock", "--package=media", "--package=weather"]
args = ["build", "--release", "--features=dev", "--package=omni-led", "--package=audio",
"--package=clock", "--package=images", "--package=media", "--package=weather"]

[tasks.run]
description = "Run development binaries in debug mode"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ described [here](docs/customization.md).
## Roadmap

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

## License

This project is licensed under the GNU General Public License v3.0, see [LICENSE](LICENSE) file for details.
This project is licensed under the GNU General Public License v3.0, see [LICENSE](LICENSE) file for
details.
File renamed without changes.
25 changes: 25 additions & 0 deletions config/devices.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ usb_device {
memory_representation = 'BitPerPixel',
}

usb_device {
name = 'Steelseries Apex Pro',
screen_size = {
width = 128,
height = 40,
},
usb_settings = {
vendor_id = '0x1038',
product_id = '0x1610',
interface = '0x01',
alternate_setting = '0x00',
request_type = '0x21',
request = '0x09',
value = '0x0300',
index = '0x01',
},
transform = function(buffer)
local bytes = buffer:bytes()
table.insert(bytes, 1, 0x61)
table.insert(bytes, 0x00)
return bytes
end,
memory_representation = 'BitPerPixel',
}

emulator {
name = 'Emulator',
screen_size = {
Expand Down
46 changes: 23 additions & 23 deletions config/scripts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,26 @@ local function weather()
end

SCREEN_BUILDER
:new('Steelseries Apex 7 TKL')
:with_layout_group({
{
layout = volume,
run_on = { 'AUDIO.IsMuted', 'AUDIO.Name', 'AUDIO.Volume' },
},
{
layout = spotify,
run_on = { 'SPOTIFY.Artist', 'SPOTIFY.Progress', 'SPOTIFY.Title' },
},
{
layout = clock,
run_on = { 'CLOCK.Seconds' },
},
})
:with_layout_group({
{
layout = weather,
run_on = { 'CLOCK.Seconds' },
}
})
:with_layout_group_toggle({ 'KEY(RAlt)', 'KEY(Slash)' })
:register()
:new('Emulator')
:with_layout_group({
{
layout = volume,
run_on = { 'AUDIO.IsMuted', 'AUDIO.Name', 'AUDIO.Volume' },
},
{
layout = spotify,
run_on = { 'SPOTIFY.Artist', 'SPOTIFY.Progress', 'SPOTIFY.Title' },
},
{
layout = clock,
run_on = { 'CLOCK.Seconds' },
},
})
:with_layout_group({
{
layout = weather,
run_on = { 'CLOCK.Seconds' },
}
})
:with_layout_group_toggle({ 'KEY(RAlt)', 'KEY(Slash)' })
:register()
13 changes: 7 additions & 6 deletions docs/applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ to load any [custom application](#custom-applications) that provides the data y
OmniLED comes some applications pre-installed. Each one comes with its own README file that
describes their usage and purpose.

- [audio](../oled-applications/audio/README.md)
- [clock](../oled-applications/clock/README.md)
- [media](../oled-applications/media/README.md)
- [weather](../oled-applications/weather/README.md)
- [audio](../omni-led-applications/audio/README.md)
- [clock](../omni-led-applications/clock/README.md)
- [images](../omni-led-applications/images/README.md)
- [media](../omni-led-applications/media/README.md)
- [weather](../omni-led-applications/weather/README.md)

## Custom Applications

Expand Down Expand Up @@ -76,15 +77,15 @@ eliminates the need for the application to determine the server address manually
> }
> }
> ```
>
>
> In the above applications there 2 applications loaded: `my_application` and
> `my_other_application`.
> They both can be found in the default application directory, but for the first one
> [`get_default_path`](scripting_reference.md#get_default_path) function was used, and for the
> other the path was constructed manually using the [`PLATFORM`](scripting_reference.md#platform)
> constants.
> Also the application received different command line arguments, to send exactly what they expect.
>
>
> For built-in applications' arguments refer to this [paragraph](#built-in-applications).
#### Reading `server.json`
Expand Down
14 changes: 14 additions & 0 deletions omni-led-applications/images/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "images"
version = "0.1.0"
authors = ["Michał Bałabanow <[email protected]>"]
license = "GPL-3.0-only"
edition = "2021"

[dependencies]
clap = { version = "4.4", features = ["derive"] }
image = "0.25"
log = "0.4"
omni-led-api = { path = "../../omni-led-api" }
shlex = "1.3"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
56 changes: 56 additions & 0 deletions omni-led-applications/images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Images

Images application reads images from disk and converts them to a black and white image before
sending it to OmniLED server.

## Running

```
images --address <ADDRESS> [--image '<NAME> <PATH> [--format <FORMAT>] [--threshold <THRESHOLD>]']...
```

Images expects two arguments

- Required:
- `a`/`address` - server address
- Optional:
- `-i`/`--image` - loaded image options.
This option can be specified multiple times and it a **single string** as it's argument with
image load options:
- `<NAME>` - This name will be used as variable name in user scripts.
_This is a positional argument and shall always be specified as a first argument._
- `<PATH>` - Path to an image file on disk.
_This is a positional argument and shall always be specified as a second argument._
- `-f`/`--format` - Image extension used as a hint for loading images when path doesn't
contain an extension.
- `-t`/`--threshold` - Threshold that will be used when converting the image to black and
white. Values with brightness lower than threshold will be black, and above or equal to
threshold will be white.
Range: [0, 255].
Default: 128

### Example

In this example `images` will load 2 images from disk.

```lua
load_app {
path = get_default_path('images'),
args = {
'--address', SERVER.Address,
'--image', 'MyImage /path/to/my_image --format jpg --threshold 77',
'--image', 'MyOtherImage "C:\\path\\to\\other image.png" --threshold 159',
}
}
```

## Images Events

Images applications sends a single event with all loaded images with names specified as program
arguments.

`IMAGES`: table

- `<NAME_1>`: `OLEDImage`,
...
- `<NAME_N>`: `OLEDImage`,
Loading

0 comments on commit ccab543

Please sign in to comment.