Update readme, slash configs

This commit is contained in:
Luke D. Jones
2025-01-12 17:36:10 +13:00
parent 2123f369ad
commit 128bc3fce1
113 changed files with 1545 additions and 1305 deletions

View File

@@ -19,7 +19,7 @@ pub mod trait_impls;
pub struct Aura {
pub hid: Option<Arc<Mutex<HidRaw>>>,
pub backlight: Option<Arc<Mutex<KeyboardBacklight>>>,
pub config: Arc<Mutex<AuraConfig>>,
pub config: Arc<Mutex<AuraConfig>>
}
impl Aura {
@@ -91,17 +91,13 @@ impl Aura {
pub async fn write_effect_and_apply(
&self,
dev_type: AuraDeviceType,
mode: &AuraEffect,
mode: &AuraEffect
) -> Result<(), RogError> {
if matches!(dev_type, AuraDeviceType::LaptopKeyboardTuf) {
if let Some(platform) = &self.backlight {
let buf = [
1,
mode.mode as u8,
mode.colour1.r,
mode.colour1.g,
mode.colour1.b,
mode.speed as u8,
1, mode.mode as u8, mode.colour1.r, mode.colour1.g, mode.colour1.b,
mode.speed as u8
];
platform.lock().await.set_kbd_rgb_mode(&buf)?;
}
@@ -125,7 +121,7 @@ impl Aura {
return Ok(());
}
Err(RogError::MissingFunction(
"No LED backlight control available".to_string(),
"No LED backlight control available".to_string()
))
}
@@ -142,14 +138,24 @@ impl Aura {
let hid_raw = hid_raw.lock().await;
if let Some(p) = config.enabled.states.first() {
if p.zone == PowerZones::Ally {
let msg = [0x5d, 0xd1, 0x09, 0x01, p.new_to_byte() as u8, 0x0, 0x0];
let msg = [
0x5d,
0xd1,
0x09,
0x01,
p.new_to_byte() as u8,
0x0,
0x0
];
hid_raw.write_bytes(&msg)?;
return Ok(());
}
}
let bytes = config.enabled.to_bytes(config.led_type);
let msg = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
let msg = [
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]
];
hid_raw.write_bytes(&msg)?;
}
Ok(())
@@ -161,7 +167,7 @@ impl Aura {
pub async fn write_effect_block(
&self,
config: &mut AuraConfig,
effect: &AuraLaptopUsbPackets,
effect: &AuraLaptopUsbPackets
) -> Result<(), RogError> {
if config.brightness == LedBrightness::Off {
config.brightness = LedBrightness::Med;
@@ -194,7 +200,9 @@ impl Aura {
let r = row[9];
let g = row[10];
let b = row[11];
tuf.lock().await.set_kbd_rgb_mode(&[0, 0, r, g, b, 0])?;
tuf.lock().await.set_kbd_rgb_mode(&[
0, 0, r, g, b, 0
])?;
}
}
}
@@ -206,7 +214,9 @@ impl Aura {
if let Some(hid_raw) = &self.hid {
let mut config = self.config.lock().await;
if config.ally_fix.is_none() {
let msg = [0x5d, 0xbd, 0x01, 0xff, 0xff, 0xff, 0xff];
let msg = [
0x5d, 0xbd, 0x01, 0xff, 0xff, 0xff, 0xff
];
hid_raw.lock().await.write_bytes(&msg)?;
info!("Reset Ally power settings to base");
config.ally_fix = Some(true);