Fix slash enable

This commit is contained in:
Luke Jones
2025-02-17 11:38:29 +13:00
parent 5c3348a9f5
commit ae8ce83583
10 changed files with 112 additions and 51 deletions

View File

@@ -4,8 +4,7 @@ use config::SlashConfig;
use futures_util::lock::{Mutex, MutexGuard};
use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw;
use rog_slash::usb::{get_options_packet, pkt_set_mode, pkts_for_init};
use rog_slash::SlashType;
use rog_slash::usb::{slash_pkt_enable, slash_pkt_init, slash_pkt_options, slash_pkt_set_mode};
use crate::error::RogError;
@@ -46,14 +45,14 @@ impl Slash {
pub async fn do_initialization(&self) -> Result<(), RogError> {
// Don't try to initialise these models as the asus drivers already did
let config = self.config.lock().await;
if !matches!(config.slash_type, SlashType::GA605 | SlashType::GU605) {
for pkt in &pkts_for_init(config.slash_type) {
self.write_bytes(pkt).await?;
}
for pkt in &slash_pkt_init(config.slash_type) {
self.write_bytes(pkt).await?;
}
self.write_bytes(&slash_pkt_enable(config.slash_type, config.enabled))
.await?;
// Apply config upon initialization
let option_packets = get_options_packet(
let option_packets = slash_pkt_options(
config.slash_type,
config.enabled,
config.brightness,
@@ -61,7 +60,7 @@ impl Slash {
);
self.write_bytes(&option_packets).await?;
let mode_packets = pkt_set_mode(config.slash_type, config.display_mode);
let mode_packets = slash_pkt_set_mode(config.slash_type, config.display_mode);
// self.node.write_bytes(&mode_packets[0])?;
self.write_bytes(&mode_packets[1]).await?;