fix: LEDs managfement in rogcc

This commit is contained in:
Denis Benato
2026-01-24 16:48:18 +01:00
parent bbd8e775f1
commit 5d4b164b3b
5 changed files with 249 additions and 221 deletions

View File

@@ -46,8 +46,10 @@ export struct LaptopAuraPower {
states: [AuraPowerState],
}
// Modes with colour1: Static,Breathe,Star,Rain,Highlight,Laser,Ripple,Pulse,Comet,Flash (excl. Strobe,Rainbow,Nothing)
// Modes with colour2: Breathe, Star only.
// Speed: Breathe,Strobe,Rainbow,Star,Rain,Highlight,Laser,Ripple. Direction: Rainbow only.
export global AuraPageData {
// The ordering must match the rog-aura crate
in-out property <[string]> power_zone_names: [
@tr("Aura power zone" => "Logo"),
@tr("Aura power zone" => "Keyboard"),
@@ -87,15 +89,9 @@ export global AuraPageData {
@tr("Basic aura mode" => "Comet"),
@tr("Basic aura mode" => "Flash"),
];
in-out property <[string]> available_mode_names: [
@tr("Basic aura mode" => "Static"),
@tr("Basic aura mode" => "Breathe"),
@tr("Basic aura mode" => "Strobe"),
];
in-out property <[string]> available_mode_names: [ @tr("Basic aura mode" => "Static"), @tr("Basic aura mode" => "Breathe"), @tr("Basic aura mode" => "Strobe") ];
in-out property <int> current_available_mode: 0;
in-out property <[int]> supported_basic_modes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12];
in-out property <int> led_mode;
callback cb_led_mode(int);
in-out property <[string]> zone_names: [
@tr("Aura zone" => "None"),
@tr("Aura zone" => "Key1"),
@@ -106,51 +102,57 @@ export global AuraPageData {
@tr("Aura zone" => "Lightbar Left"),
@tr("Aura zone" => "Lightbar Right"),
];
in-out property <int> zone;
in-out property <[string]> direction_names: [
@tr("Aura direction" => "Right"),
@tr("Aura direction" => "Left"),
@tr("Aura direction" => "Up"),
@tr("Aura direction" => "Down"),
];
in-out property <int> direction;
in-out property <[string]> speed_names: [
@tr("Aura speed" => "Low"),
@tr("Aura speed" => "Medium"),
@tr("Aura speed" => "High"),
];
in-out property <int> speed;
in-out property <AuraEffect> led_mode_data: {
mode: 0,
zone: 0,
colour1: Colors.aquamarine,
colourbox1: Colors.aquamarine,
colour2: Colors.hotpink,
colourbox2: Colors.hotpink,
speed: 0,
direction: 0,
};
callback cb_led_mode_data(AuraEffect);
in-out property <color> color1;
in-out property <brush> colorbox1;
in-out property <color> color2;
in-out property <brush> colorbox2;
out property <bool> colour1_enabled: led_mode_data.mode == 0 || led_mode_data.mode == 1 || led_mode_data.mode == 4 || led_mode_data.mode == 6 || led_mode_data.mode == 7 || led_mode_data.mode == 8 || led_mode_data.mode == 10 || led_mode_data.mode == 11 || led_mode_data.mode == 12;
out property <bool> colour2_enabled: led_mode_data.mode == 1 || led_mode_data.mode == 4;
out property <bool> speed_enabled: led_mode_data.mode == 1 || led_mode_data.mode == 2 || led_mode_data.mode == 3 || led_mode_data.mode == 4 || led_mode_data.mode == 5 || led_mode_data.mode == 6 || led_mode_data.mode == 7 || led_mode_data.mode == 8;
out property <bool> direction_enabled: led_mode_data.mode == 3;
callback apply_led_mode_data();
callback apply_effect(AuraEffect);
apply_effect(e) => { led_mode_data = e; apply_led_mode_data(); }
in-out property <int> zone;
in-out property <int> speed;
in-out property <int> direction;
callback update_led_mode_data(AuraEffect);
update_led_mode_data(data) => {
led_mode_data = data;
current_available_mode = data.mode;
zone = data.zone;
speed = data.speed;
direction = data.direction;
color1 = data.colour1;
color2 = data.colour2;
colorbox1 = data.colour1;
colorbox2 = data.colour2;
update_led_mode_data(d) => {
led_mode_data = d;
zone = d.zone;
speed = d.speed;
direction = d.direction;
color1 = d.colour1;
color2 = d.colour2;
colorbox1 = d.colour1;
colorbox2 = d.colour2;
}
callback cb_hex_from_colour(color) -> string;
callback cb_hex_to_colour(string) -> color;
in-out property <AuraDevType> device_type: AuraDevType.Old;
// List of indexes to power_zone_names. Must correspond to rog-aura crate
in-out property <[PowerZones]> supported_power_zones: [
PowerZones.Keyboard,
PowerZones.Lightbar,