Attempt to get multi-static working

This commit is contained in:
Luke
2020-05-22 20:53:05 +12:00
parent 5e781cbd3d
commit bd67afb104
42 changed files with 579 additions and 42 deletions

View File

@@ -24,6 +24,7 @@ pub enum AuraCommand {
WriteBytes(Vec<u8>),
WriteEffect(Vec<Vec<u8>>),
ReloadLast,
WriteMultizone(Vec<Vec<u8>>),
}
/// UNSAFE: Must live as long as RogCore
@@ -136,6 +137,7 @@ where
}
}
AuraCommand::WriteBytes(bytes) => self.set_and_save(&bytes, config).await?,
AuraCommand::WriteMultizone(effect) => self.write_multizone(effect).await?,
AuraCommand::WriteEffect(effect) => self.write_effect(effect).await?,
AuraCommand::ReloadLast => self.reload_last_builtin(&config).await?,
}
@@ -188,6 +190,16 @@ where
Ok(())
}
#[inline]
async fn write_multizone(&mut self, effect: Vec<Vec<u8>>) -> Result<(), AuraError> {
for row in effect.iter() {
self.write_bytes(row).await?;
}
self.write_bytes(&LED_SET).await?;
self.write_bytes(&LED_APPLY).await?;
Ok(())
}
/// Used to set a builtin mode and save the settings for it
#[inline]
async fn set_and_save(&self, bytes: &[u8], config: &mut Config) -> Result<(), AuraError> {