mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
15 Commits
da7395b9df
...
f4dc4dfea9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4dc4dfea9 | ||
|
|
1238e090a5 | ||
|
|
f92545b0bb | ||
|
|
bf0ea88f01 | ||
|
|
4db901ce17 | ||
|
|
e105e6bd86 | ||
|
|
465f472c25 | ||
|
|
b04fed9a6d | ||
|
|
0311c74049 | ||
|
|
c08355f5c2 | ||
|
|
9ee154cd1c | ||
|
|
14c4b0501d | ||
|
|
eab7e89fa3 | ||
|
|
2c61cd8da6 | ||
|
|
c7de3fb0c8 |
0
rog-anime/data/g835l/images/.gitkeep
Normal file
0
rog-anime/data/g835l/images/.gitkeep
Normal file
BIN
rog-anime/data/g835l/templates/custom-image-template.png
Normal file
BIN
rog-anime/data/g835l/templates/custom-image-template.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 518 B |
@@ -121,8 +121,6 @@ impl AnimeImage {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.8,
|
||||
AnimeType::GU604 => 0.78,
|
||||
// TODO: Measure physical display and calculate correct value
|
||||
AnimeType::G835L => 0.77,
|
||||
_ => 0.77,
|
||||
}
|
||||
}
|
||||
@@ -139,12 +137,8 @@ impl AnimeImage {
|
||||
fn scale_y(anime_type: AnimeType) -> f32 {
|
||||
match anime_type {
|
||||
AnimeType::GA401 => 0.3,
|
||||
AnimeType::GU604 => 0.28,
|
||||
// TODO: Calculate correct values for G635L and G835L.
|
||||
// Known values for G835L diagonal W*H is 68*34
|
||||
AnimeType::G635L => 0.28,
|
||||
AnimeType::G835L => 0.28,
|
||||
_ => 0.283,
|
||||
AnimeType::GA402 => 0.283,
|
||||
_ => 0.28,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +161,7 @@ impl AnimeImage {
|
||||
/// \ |
|
||||
/// |----|\ |
|
||||
/// ^ ------+
|
||||
/// first_x (grows as y increases)
|
||||
/// first_x
|
||||
/// ```
|
||||
///
|
||||
/// For G835L (inverted pattern - triangle grows then rectangle shifts):
|
||||
@@ -276,8 +270,7 @@ impl AnimeImage {
|
||||
// 33.0 = Longest row LED count (physical) plus half-pixel offset
|
||||
AnimeType::GA401 => (33.0 + 0.5) * Self::scale_x(anime_type),
|
||||
AnimeType::GU604 => (38.0 + 0.5) * Self::scale_x(anime_type),
|
||||
// G835L: max 15 LEDs wide + rectangle shift (~20 pixels) + stagger
|
||||
AnimeType::G835L => (35.0 + 0.5) * Self::scale_x(anime_type),
|
||||
AnimeType::G835L => (33.0 + 0.5) * Self::scale_x(anime_type),
|
||||
_ => (35.0 + 0.5) * Self::scale_x(anime_type),
|
||||
}
|
||||
}
|
||||
@@ -448,13 +441,35 @@ impl AnimeImage {
|
||||
let transform =
|
||||
Mat3::from_scale_angle_translation(self.scale, self.angle, self.translation);
|
||||
|
||||
let pos_in_leds = Mat3::from_translation(Vec2::new(20.0, 20.0));
|
||||
let pos_in_leds = Mat3::from_translation(self.led_center());
|
||||
// Get LED-to-image coords
|
||||
let led_from_px = pos_in_leds * led_from_cm * transform * cm_from_px * center;
|
||||
|
||||
led_from_px.inverse()
|
||||
}
|
||||
|
||||
fn led_center(&self) -> Vec2 {
|
||||
if self.anime_type != AnimeType::G835L {
|
||||
return Vec2::new(20.0, 20.0);
|
||||
}
|
||||
|
||||
let mut min = Vec2::splat(f32::INFINITY);
|
||||
let mut max = Vec2::splat(f32::NEG_INFINITY);
|
||||
for led in self.led_pos.iter().flatten() {
|
||||
let pos = Vec2::new(led.x(), led.y());
|
||||
min = min.min(pos);
|
||||
max = max.max(pos);
|
||||
}
|
||||
|
||||
if min.x.is_finite() {
|
||||
let mut center = (min + max) * 0.5;
|
||||
center.y += 1.0;
|
||||
center
|
||||
} else {
|
||||
Vec2::new(20.0, 20.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate the base image from inputs. The result can be displayed as is
|
||||
/// or updated via scale, position, or angle then displayed again after
|
||||
/// `update()`.
|
||||
|
||||
Reference in New Issue
Block a user