mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Fix anime exampels
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use std::{env, error::Error, path::Path, process::exit};
|
use std::{env, error::Error, path::Path, process::exit};
|
||||||
|
|
||||||
use rog_anime::{AnimeDataBuffer, AnimeDiagonal};
|
use rog_anime::{usb::get_anime_type, AnimeDiagonal};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@@ -16,10 +16,12 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
let matrix =
|
let matrix =
|
||||||
AnimeDiagonal::from_png(Path::new(&args[1]), None, args[2].parse::<f32>().unwrap())?;
|
AnimeDiagonal::from_png(Path::new(&args[1]), None, args[2].parse::<f32>().unwrap())?;
|
||||||
|
|
||||||
|
let anime_type = get_anime_type()?;
|
||||||
|
|
||||||
client
|
client
|
||||||
.proxies()
|
.proxies()
|
||||||
.anime()
|
.anime()
|
||||||
.write(<AnimeDataBuffer>::from(&matrix))
|
.write(matrix.into_data_buffer(anime_type))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{thread::sleep, time::Duration};
|
use std::{thread::sleep, time::Duration};
|
||||||
|
|
||||||
use rog_anime::{AnimeDataBuffer, AnimeDiagonal};
|
use rog_anime::{usb::get_anime_type, AnimeDiagonal};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
// In usable data:
|
// In usable data:
|
||||||
@@ -25,8 +25,12 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let m = <AnimeDataBuffer>::from(&matrix);
|
let anime_type = get_anime_type().unwrap();
|
||||||
client.proxies().anime().write(m).unwrap();
|
client
|
||||||
|
.proxies()
|
||||||
|
.anime()
|
||||||
|
.write(matrix.into_data_buffer(anime_type))
|
||||||
|
.unwrap();
|
||||||
sleep(Duration::from_millis(300));
|
sleep(Duration::from_millis(300));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{env, path::Path, thread::sleep};
|
use std::{env, path::Path, thread::sleep};
|
||||||
|
|
||||||
use rog_anime::{ActionData, ActionLoader, Sequences};
|
use rog_anime::{usb::get_anime_type, ActionData, ActionLoader, Sequences};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@@ -14,7 +14,8 @@ fn main() {
|
|||||||
|
|
||||||
let path = Path::new(&args[1]);
|
let path = Path::new(&args[1]);
|
||||||
let brightness = args[2].parse::<f32>().unwrap();
|
let brightness = args[2].parse::<f32>().unwrap();
|
||||||
let mut seq = Sequences::new();
|
let anime_type = get_anime_type().unwrap();
|
||||||
|
let mut seq = Sequences::new(anime_type);
|
||||||
seq.insert(
|
seq.insert(
|
||||||
0,
|
0,
|
||||||
&ActionLoader::AsusAnimation {
|
&ActionLoader::AsusAnimation {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use rog_anime::{AnimeDataBuffer, AnimeGrid};
|
use rog_anime::{usb::get_anime_type, AnimeDataBuffer, AnimeGrid};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
// In usable data:
|
// In usable data:
|
||||||
@@ -8,7 +8,8 @@ use rog_dbus::RogDbusClientBlocking;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||||
let mut matrix = AnimeGrid::new(None);
|
let anime_type = get_anime_type().unwrap();
|
||||||
|
let mut matrix = AnimeGrid::new(anime_type);
|
||||||
let tmp = matrix.get_mut();
|
let tmp = matrix.get_mut();
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use rog_anime::AnimeDataBuffer;
|
use rog_anime::{usb::get_anime_type, AnimeDataBuffer};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
// In usable data:
|
// In usable data:
|
||||||
@@ -6,7 +6,8 @@ use rog_dbus::RogDbusClientBlocking;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||||
let mut matrix = AnimeDataBuffer::new();
|
let anime_type = get_anime_type().unwrap();
|
||||||
|
let mut matrix = AnimeDataBuffer::new(anime_type);
|
||||||
matrix.data_mut()[1] = 100; // start = 1
|
matrix.data_mut()[1] = 100; // start = 1
|
||||||
for n in matrix.data_mut()[2..32].iter_mut() {
|
for n in matrix.data_mut()[2..32].iter_mut() {
|
||||||
*n = 250;
|
*n = 250;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::{env, error::Error, path::Path, process::exit};
|
use std::{env, error::Error, path::Path, process::exit};
|
||||||
|
|
||||||
use rog_anime::{
|
use rog_anime::{
|
||||||
|
usb::get_anime_type,
|
||||||
AnimeDataBuffer, {AnimeImage, Vec2},
|
AnimeDataBuffer, {AnimeImage, Vec2},
|
||||||
};
|
};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
@@ -15,6 +16,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let anime_type = get_anime_type()?;
|
||||||
let matrix = AnimeImage::from_png(
|
let matrix = AnimeImage::from_png(
|
||||||
Path::new(&args[1]),
|
Path::new(&args[1]),
|
||||||
args[2].parse::<f32>().unwrap(),
|
args[2].parse::<f32>().unwrap(),
|
||||||
@@ -24,6 +26,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
args[5].parse::<f32>().unwrap(),
|
args[5].parse::<f32>().unwrap(),
|
||||||
),
|
),
|
||||||
args[6].parse::<f32>().unwrap(),
|
args[6].parse::<f32>().unwrap(),
|
||||||
|
anime_type,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
client
|
client
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use rog_anime::{
|
use rog_anime::{
|
||||||
|
usb::get_anime_type,
|
||||||
AnimeDataBuffer, {AnimeImage, Vec2},
|
AnimeDataBuffer, {AnimeImage, Vec2},
|
||||||
};
|
};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
@@ -17,6 +18,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let anime_type = get_anime_type()?;
|
||||||
let mut matrix = AnimeImage::from_png(
|
let mut matrix = AnimeImage::from_png(
|
||||||
Path::new(&args[1]),
|
Path::new(&args[1]),
|
||||||
args[2].parse::<f32>().unwrap(),
|
args[2].parse::<f32>().unwrap(),
|
||||||
@@ -26,6 +28,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
args[5].parse::<f32>().unwrap(),
|
args[5].parse::<f32>().unwrap(),
|
||||||
),
|
),
|
||||||
args[6].parse::<f32>().unwrap(),
|
args[6].parse::<f32>().unwrap(),
|
||||||
|
anime_type,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use rog_aura::{GX502Layout, Key, KeyColourArray, KeyLayout};
|
use rog_aura::{GX502Layout, Key, KeyColourArray, KeyLayout};
|
||||||
use rog_dbus::RogDbusClient;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
use std::collections::LinkedList;
|
use std::collections::LinkedList;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -52,7 +52,7 @@ impl Ball {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let (dbus, _) = RogDbusClient::new()?;
|
let (dbus, _) = RogDbusClientBlocking::new()?;
|
||||||
|
|
||||||
let mut colours = KeyColourArray::new();
|
let mut colours = KeyColourArray::new();
|
||||||
|
|
||||||
@@ -60,8 +60,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
let mut balls = [Ball::new(2, 1, 12), Ball::new(4, 6, 12)];
|
let mut balls = [Ball::new(2, 1, 12), Ball::new(4, 6, 12)];
|
||||||
|
|
||||||
dbus.proxies().led().init_effect()?;
|
|
||||||
|
|
||||||
let rows = layout.get_rows();
|
let rows = layout.get_rows();
|
||||||
loop {
|
loop {
|
||||||
for (n, ball) in balls.iter_mut().enumerate() {
|
for (n, ball) in balls.iter_mut().enumerate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user