mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Animatrix: Default to GA402 style if Unknown, use default-workspace.
Also rename daemon crates to the bin names they use to be less confusing. Signed-off-by: Luke D. Jones <luke@ljones.dev>
This commit is contained in:
@@ -57,9 +57,8 @@ impl AnimeType {
|
||||
/// The width of diagonal images
|
||||
pub fn width(&self) -> usize {
|
||||
match self {
|
||||
AnimeType::GA401 | AnimeType::GA402 => 74,
|
||||
AnimeType::GU604 => 70,
|
||||
AnimeType::Unknown => 0,
|
||||
_ => 74,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +66,8 @@ impl AnimeType {
|
||||
pub fn height(&self) -> usize {
|
||||
match self {
|
||||
AnimeType::GA401 => 36,
|
||||
AnimeType::GA402 => 39,
|
||||
AnimeType::GU604 => 43,
|
||||
AnimeType::Unknown => 0,
|
||||
_ => 39,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +75,8 @@ impl AnimeType {
|
||||
pub fn data_length(&self) -> usize {
|
||||
match self {
|
||||
AnimeType::GA401 => PANE_LEN * 2,
|
||||
AnimeType::GA402 => PANE_LEN * 3,
|
||||
AnimeType::GU604 => PANE_LEN * 3,
|
||||
AnimeType::Unknown => 0,
|
||||
_ => PANE_LEN * 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,9 +140,8 @@ impl AnimeDiagonal {
|
||||
pub fn into_data_buffer(&self, anime_type: AnimeType) -> Result<AnimeDataBuffer> {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => self.to_ga401_packets(),
|
||||
AnimeType::GA402 => self.to_ga402_packets(),
|
||||
AnimeType::GU604 => self.to_gu604_packets(),
|
||||
AnimeType::Unknown => self.to_unknown_packets(),
|
||||
_ => self.to_ga402_packets(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,9 +376,4 @@ impl AnimeDiagonal {
|
||||
|
||||
AnimeDataBuffer::from_vec(crate::AnimeType::GA402, buf)
|
||||
}
|
||||
|
||||
fn to_unknown_packets(&self) -> Result<AnimeDataBuffer> {
|
||||
let buf = vec![0u8; AnimeType::Unknown.data_length()];
|
||||
AnimeDataBuffer::from_vec(crate::AnimeType::Unknown, buf)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,9 +119,8 @@ impl AnimeImage {
|
||||
fn scale_x(anime_type: AnimeType) -> f32 {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.8,
|
||||
AnimeType::GA402 => 0.77,
|
||||
AnimeType::GU604 => 0.78,
|
||||
AnimeType::Unknown => 0.0,
|
||||
_ => 0.77,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +136,8 @@ impl AnimeImage {
|
||||
fn scale_y(anime_type: AnimeType) -> f32 {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.3,
|
||||
AnimeType::GA402 => 0.283,
|
||||
AnimeType::GU604 => 0.28,
|
||||
AnimeType::Unknown => 0.0,
|
||||
_ => 0.283,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,14 +170,6 @@ impl AnimeImage {
|
||||
}
|
||||
(y + 1) / 2 - 3
|
||||
}
|
||||
AnimeType::GA402 => {
|
||||
// first 11 rows start at zero
|
||||
if y <= 11 {
|
||||
return 0;
|
||||
}
|
||||
// and then their offset grows by one every two rows
|
||||
(y + 1) / 2 - 5
|
||||
}
|
||||
AnimeType::GU604 => {
|
||||
// first 9 rows start at zero
|
||||
if y <= 9 {
|
||||
@@ -188,7 +178,14 @@ impl AnimeImage {
|
||||
// and then their offset grows by one every two rows
|
||||
(y - 9) / 2
|
||||
}
|
||||
AnimeType::Unknown => 0,
|
||||
_ => {
|
||||
// first 11 rows start at zero
|
||||
if y <= 11 {
|
||||
return 0;
|
||||
}
|
||||
// and then their offset grows by one every two rows
|
||||
(y + 1) / 2 - 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,19 +214,18 @@ impl AnimeImage {
|
||||
}
|
||||
36 - (y + 1) / 2
|
||||
}
|
||||
AnimeType::GA402 => {
|
||||
if y <= 11 {
|
||||
return 34;
|
||||
}
|
||||
39 - y / 2
|
||||
}
|
||||
AnimeType::GU604 => {
|
||||
if y <= 9 {
|
||||
return 38 + y % 2;
|
||||
}
|
||||
38 - Self::first_x(anime_type, y) + y % 2
|
||||
}
|
||||
AnimeType::Unknown => 0,
|
||||
_ => {
|
||||
if y <= 11 {
|
||||
return 34;
|
||||
}
|
||||
39 - y / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,9 +234,9 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
// 33.0 = Longest row LED count (physical) plus half-pixel offset
|
||||
AnimeType::GA401 => (33.0 + 0.5) * Self::scale_x(anime_type),
|
||||
AnimeType::GA402 => (35.0 + 0.5) * Self::scale_x(anime_type),
|
||||
|
||||
AnimeType::GU604 => (38.0 + 0.5) * Self::scale_x(anime_type),
|
||||
AnimeType::Unknown => 0.0,
|
||||
_ => (35.0 + 0.5) * Self::scale_x(anime_type),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,9 +244,8 @@ impl AnimeImage {
|
||||
fn height(anime_type: AnimeType) -> u32 {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 55,
|
||||
AnimeType::GA402 => 61,
|
||||
AnimeType::GU604 => 62,
|
||||
AnimeType::Unknown => 0,
|
||||
_ => 61,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,10 +254,9 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
// 54.0 = End column LED count (physical) plus one dead pixel
|
||||
AnimeType::GA401 => (54.0 + 1.0) * Self::scale_y(anime_type),
|
||||
// GA402 may not have dead pixels and require only the physical LED count
|
||||
AnimeType::GA402 => 61.0 * Self::scale_y(anime_type),
|
||||
AnimeType::GU604 => 62.0 * Self::scale_y(anime_type),
|
||||
AnimeType::Unknown => 0.0,
|
||||
// GA402 may not have dead pixels and require only the physical LED count
|
||||
_ => 61.0 * Self::scale_y(anime_type),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +268,9 @@ impl AnimeImage {
|
||||
1 | 3 => 35, // Some rows are padded
|
||||
_ => 36 - y / 2,
|
||||
},
|
||||
// GA402 does not have padding, equivalent to width
|
||||
AnimeType::GA402 => AnimeImage::width(anime_type, y),
|
||||
AnimeType::GU604 => AnimeImage::width(anime_type, y),
|
||||
AnimeType::Unknown => 0,
|
||||
// GA402 does not have padding, equivalent to width
|
||||
_ => AnimeImage::width(anime_type, y),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user