mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
rog-aura: tested effects on TUF, works
This commit is contained in:
@@ -139,7 +139,7 @@ I'm unsure of how many laptops this works on, so please try it.
|
|||||||
|
|
||||||
`led_type: PerZone` works on most zoned laptops but I've no idea if it works on unzoned. Please try it if you can.
|
`led_type: PerZone` works on most zoned laptops but I've no idea if it works on unzoned. Please try it if you can.
|
||||||
|
|
||||||
Does not work for TUF laptops.
|
For TUF use `"Zone": "None"` (and yes this does mean an audio EQ can be done now).
|
||||||
|
|
||||||
`~/.config/rog/rog-user.cfg` contains a setting `"active_aura": "<FILENAME>"` where `<FILENAME>` is the name of the Aura config to use, located in the same directory and without the file postfix, e.g, `"active_anime": "aura-default"`
|
`~/.config/rog/rog-user.cfg` contains a setting `"active_aura": "<FILENAME>"` where `<FILENAME>` is the name of the Aura config to use, located in the same directory and without the file postfix, e.g, `"active_anime": "aura-default"`
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ An Aura config itself is a file with contents:
|
|||||||
"led_type": {
|
"led_type": {
|
||||||
"Key": "N9"
|
"Key": "N9"
|
||||||
},
|
},
|
||||||
"colour": [
|
"start_colour": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
255
|
255
|
||||||
@@ -197,7 +197,7 @@ An Aura config itself is a file with contents:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
If your laptop supports multizone, `"led_type"` can also be `"PerZone": <one of the following>`
|
If your laptop supports multizone, `"led_type"` can also be `"Zone": <one of the following>`
|
||||||
- `"None"`
|
- `"None"`
|
||||||
- `"KeyboardLeft"`
|
- `"KeyboardLeft"`
|
||||||
- `"KeyboardCenterLeft"`
|
- `"KeyboardCenterLeft"`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Using a combination of key-colour array plus a key layout to generate outputs.
|
//! Using a combination of key-colour array plus a key layout to generate outputs.
|
||||||
|
|
||||||
use rog_aura::{keys::Key, layouts::KeyLayout, Colour, LedType, Sequences, Speed, Effect, Breathe};
|
use rog_aura::{keys::Key, layouts::KeyLayout, Breathe, Colour, Effect, LedType, Sequences, Speed};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -9,8 +9,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||||
|
|
||||||
let mut seq = Sequences::new();
|
let mut seq = Sequences::new();
|
||||||
let mut key = Effect::Breathe(
|
let mut key = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(LedType::Key(Key::W),
|
LedType::Key(Key::W),
|
||||||
Colour(255, 127, 0),
|
Colour(255, 127, 0),
|
||||||
Colour(127, 0, 255),
|
Colour(127, 0, 255),
|
||||||
Speed::Med,
|
Speed::Med,
|
||||||
@@ -24,8 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
key.set_led_type(LedType::Key(Key::D));
|
key.set_led_type(LedType::Key(Key::D));
|
||||||
seq.push(key.clone());
|
seq.push(key.clone());
|
||||||
|
|
||||||
let mut key = Effect::Breathe(
|
let mut key = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(
|
|
||||||
LedType::Key(Key::Q),
|
LedType::Key(Key::Q),
|
||||||
Colour(127, 127, 127),
|
Colour(127, 127, 127),
|
||||||
Colour(127, 255, 255),
|
Colour(127, 255, 255),
|
||||||
@@ -35,8 +34,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
key.set_led_type(LedType::Key(Key::E));
|
key.set_led_type(LedType::Key(Key::E));
|
||||||
seq.push(key.clone());
|
seq.push(key.clone());
|
||||||
|
|
||||||
let mut key = Effect::Breathe(
|
let mut key = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(
|
|
||||||
LedType::Key(Key::N1),
|
LedType::Key(Key::N1),
|
||||||
Colour(166, 127, 166),
|
Colour(166, 127, 166),
|
||||||
Colour(127, 155, 20),
|
Colour(127, 155, 20),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Using a combination of key-colour array plus a key layout to generate outputs.
|
//! Using a combination of key-colour array plus a key layout to generate outputs.
|
||||||
|
|
||||||
use rog_aura::{layouts::KeyLayout, Colour, LedType, PerZone, Sequences, Speed, Effect, Breathe};
|
use rog_aura::{layouts::KeyLayout, Breathe, Colour, Effect, LedType, PerZone, Sequences, Speed};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -10,8 +10,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
let mut seq = Sequences::new();
|
let mut seq = Sequences::new();
|
||||||
|
|
||||||
let zone = Effect::Breathe(
|
let zone = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(
|
|
||||||
LedType::Zone(PerZone::KeyboardLeft),
|
LedType::Zone(PerZone::KeyboardLeft),
|
||||||
Colour(166, 127, 166),
|
Colour(166, 127, 166),
|
||||||
Colour(127, 155, 20),
|
Colour(127, 155, 20),
|
||||||
@@ -19,8 +18,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
));
|
));
|
||||||
seq.push(zone);
|
seq.push(zone);
|
||||||
|
|
||||||
let zone = Effect::Breathe(
|
let zone = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(
|
|
||||||
LedType::Zone(PerZone::KeyboardCenterLeft),
|
LedType::Zone(PerZone::KeyboardCenterLeft),
|
||||||
Colour(16, 127, 255),
|
Colour(16, 127, 255),
|
||||||
Colour(127, 15, 20),
|
Colour(127, 15, 20),
|
||||||
@@ -28,8 +26,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
));
|
));
|
||||||
seq.push(zone);
|
seq.push(zone);
|
||||||
|
|
||||||
let zone = Effect::Breathe(
|
let zone = Effect::Breathe(Breathe::new(
|
||||||
Breathe::new(
|
|
||||||
LedType::Zone(PerZone::LightbarRightCorner),
|
LedType::Zone(PerZone::LightbarRightCorner),
|
||||||
Colour(0, 255, 255),
|
Colour(0, 255, 255),
|
||||||
Colour(255, 0, 255),
|
Colour(255, 0, 255),
|
||||||
|
|||||||
@@ -67,45 +67,45 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if supported.keyboard_led.per_key_led_mode {
|
// if supported.keyboard_led.per_key_led_mode {
|
||||||
if let Some(cfg) = config.active_aura {
|
if let Some(cfg) = config.active_aura {
|
||||||
let mut aura_config = UserAuraConfig::load(cfg)?;
|
let mut aura_config = UserAuraConfig::load(cfg)?;
|
||||||
|
|
||||||
// Find and load a matching layout for laptop
|
// Find and load a matching layout for laptop
|
||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.open(PathBuf::from(BOARD_NAME))
|
.open(PathBuf::from(BOARD_NAME))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
println!("{BOARD_NAME}, {e}");
|
println!("{BOARD_NAME}, {e}");
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
let mut board_name = String::new();
|
let mut board_name = String::new();
|
||||||
file.read_to_string(&mut board_name)?;
|
file.read_to_string(&mut board_name)?;
|
||||||
|
|
||||||
let layout = KeyLayout::find_layout(board_name.as_str(), PathBuf::from(DATA_DIR))
|
let layout = KeyLayout::find_layout(board_name.as_str(), PathBuf::from(DATA_DIR))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
println!("{BOARD_NAME}, {e}");
|
println!("{BOARD_NAME}, {e}");
|
||||||
})
|
})
|
||||||
.unwrap_or(KeyLayout::ga401_layout());
|
.unwrap_or(KeyLayout::ga401_layout());
|
||||||
|
|
||||||
executor
|
executor
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
// Create server
|
// Create server
|
||||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||||
// let connection = Connection::session().await.unwrap();
|
// let connection = Connection::session().await.unwrap();
|
||||||
// connection.request_name(DBUS_NAME).await.unwrap();
|
// connection.request_name(DBUS_NAME).await.unwrap();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
aura_config.aura.next_state(&layout);
|
aura_config.aura.next_state(&layout);
|
||||||
let packets = aura_config.aura.create_packets();
|
let packets = aura_config.aura.create_packets();
|
||||||
|
|
||||||
client.proxies().led().per_key_raw(packets).unwrap();
|
client.proxies().led().per_key_raw(packets).unwrap();
|
||||||
std::thread::sleep(std::time::Duration::from_millis(60));
|
std::thread::sleep(std::time::Duration::from_millis(60));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
smol::block_on(executor.tick());
|
smol::block_on(executor.tick());
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use rog_anime::{ActionLoader, AnimTime, AnimeType, Fade, Sequences, Vec2};
|
use rog_anime::{ActionLoader, AnimTime, AnimeType, Fade, Sequences, Vec2};
|
||||||
use rog_aura::{keys::Key, Breathe, Colour, Effect, LedType, Speed, Static, Flicker};
|
use rog_aura::{keys::Key, Breathe, Colour, Effect, Flicker, LedType, Speed, Static};
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
@@ -224,7 +224,12 @@ impl Default for UserAuraConfig {
|
|||||||
key.set_led_type(LedType::Key(Key::Esc));
|
key.set_led_type(LedType::Key(Key::Esc));
|
||||||
seq.push(key);
|
seq.push(key);
|
||||||
|
|
||||||
let key = Effect::Flicker(Flicker::new(LedType::Key(Key::N9), Colour(0, 0, 255), 80, 40));
|
let key = Effect::Flicker(Flicker::new(
|
||||||
|
LedType::Key(Key::N9),
|
||||||
|
Colour(0, 0, 255),
|
||||||
|
80,
|
||||||
|
40,
|
||||||
|
));
|
||||||
seq.push(key.clone());
|
seq.push(key.clone());
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -321,6 +321,13 @@ impl CtrlKbdLed {
|
|||||||
for row in effect.iter() {
|
for row in effect.iter() {
|
||||||
hid_raw.write_bytes(row)?;
|
hid_raw.write_bytes(row)?;
|
||||||
}
|
}
|
||||||
|
} else if let LEDNode::KbdLed(tuf) = &self.led_node {
|
||||||
|
for row in effect.iter() {
|
||||||
|
let r = row[9];
|
||||||
|
let g = row[10];
|
||||||
|
let b = row[11];
|
||||||
|
tuf.set_kbd_rgb_mode(&[0, 0, r, g, b, 0])?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.flip_effect_write = !self.flip_effect_write;
|
self.flip_effect_write = !self.flip_effect_write;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,12 +178,13 @@ impl EffectState for Breathe {
|
|||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct Flicker {
|
pub struct Flicker {
|
||||||
led_type: LedType,
|
led_type: LedType,
|
||||||
/// The starting colour
|
start_colour: Colour,
|
||||||
colour: Colour,
|
|
||||||
max_percentage: u8,
|
max_percentage: u8,
|
||||||
min_percentage: u8,
|
min_percentage: u8,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
count: u8,
|
count: u8,
|
||||||
|
#[serde(skip)]
|
||||||
|
colour: Colour,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Flicker {
|
impl Flicker {
|
||||||
@@ -194,6 +195,7 @@ impl Flicker {
|
|||||||
count: 4,
|
count: 4,
|
||||||
max_percentage,
|
max_percentage,
|
||||||
min_percentage,
|
min_percentage,
|
||||||
|
start_colour: colour,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,9 +206,13 @@ impl EffectState for Flicker {
|
|||||||
max_percentage,
|
max_percentage,
|
||||||
min_percentage,
|
min_percentage,
|
||||||
colour,
|
colour,
|
||||||
|
start_colour,
|
||||||
..
|
..
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
|
if self.count == 0 {
|
||||||
|
self.count = 4;
|
||||||
|
}
|
||||||
self.count -= 1;
|
self.count -= 1;
|
||||||
if self.count != 0 {
|
if self.count != 0 {
|
||||||
return;
|
return;
|
||||||
@@ -214,15 +220,15 @@ impl EffectState for Flicker {
|
|||||||
|
|
||||||
// TODO: make a "percentage" method on Colour.
|
// TODO: make a "percentage" method on Colour.
|
||||||
let max_light = Colour(
|
let max_light = Colour(
|
||||||
(colour.0 as f32 / 100.0 * *max_percentage as f32) as u8,
|
(start_colour.0 as f32 / 100.0 * *max_percentage as f32) as u8,
|
||||||
(colour.1 as f32 / 100.0 * *max_percentage as f32) as u8,
|
(start_colour.1 as f32 / 100.0 * *max_percentage as f32) as u8,
|
||||||
(colour.2 as f32 / 100.0 * *max_percentage as f32) as u8,
|
(start_colour.2 as f32 / 100.0 * *max_percentage as f32) as u8,
|
||||||
);
|
);
|
||||||
// min light is a percentage of the set colour
|
// min light is a percentage of the set colour
|
||||||
let min_light = Colour(
|
let min_light = Colour(
|
||||||
(colour.0 as f32 / 100.0 * *min_percentage as f32) as u8,
|
(start_colour.0 as f32 / 100.0 * *min_percentage as f32) as u8,
|
||||||
(colour.1 as f32 / 100.0 * *min_percentage as f32) as u8,
|
(start_colour.1 as f32 / 100.0 * *min_percentage as f32) as u8,
|
||||||
(colour.2 as f32 / 100.0 * *min_percentage as f32) as u8,
|
(start_colour.2 as f32 / 100.0 * *min_percentage as f32) as u8,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convert the 255 to percentage
|
// Convert the 255 to percentage
|
||||||
|
|||||||
Reference in New Issue
Block a user