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

@@ -82,6 +82,26 @@ impl AuraDbusWriter {
Ok(())
}
#[inline]
pub fn write_multizone(
&mut self,
group: &[[u8; LED_MSG_LEN]; 4],
) -> Result<(), Box<dyn Error>> {
self.connection.process(Duration::from_micros(300))?;
let msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "LedWriteEffect")?
.append1(&group[0].to_vec())
.append1(&group[1].to_vec())
.append1(&group[2].to_vec())
.append1(&group[3].to_vec());
self.connection.send(msg).unwrap();
thread::sleep(Duration::from_millis(self.block_time));
if self.stop.load(Ordering::Relaxed) {
panic!("Go signal to stop!");
}
Ok(())
}
#[inline]
pub fn write_bytes(&self, bytes: &[u8]) -> Result<String, Box<dyn std::error::Error>> {
let msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "LedWriteBytes")?

View File

@@ -107,6 +107,7 @@ pub enum BuiltInModeByte {
Pulse = 0x0a,
ThinZoomy = 0x0b,
WideZoomy = 0x0c,
MultiStatic,
None,
}
impl Default for BuiltInModeByte {
@@ -160,6 +161,7 @@ impl From<BuiltInModeByte> for u8 {
BuiltInModeByte::Pulse => 0x0a,
BuiltInModeByte::ThinZoomy => 0x0b,
BuiltInModeByte::WideZoomy => 0x0c,
BuiltInModeByte::MultiStatic => 0x00,
BuiltInModeByte::None => 0xff,
}
}