MCPcopy Create free account
hub / github.com/RizeCrime/linuxblaster_control / global_profile_set

Function global_profile_set

src/features.rs:754–787  ·  view source on GitHub ↗
(feature: &Feature, value: f32)

Source from the content-addressed store, hash-verified

752}
753
754fn global_profile_set(feature: &Feature, value: f32) {
755 let profile_id = match feature.id {
756 FeatureId::SbxMaster => 0x01u8,
757 FeatureId::ScoutMode => 0x02u8,
758 _ => panic!("global_profile_set called on {:?}", feature.id),
759 };
760
761 let state = if value > 0.0 { 0x01u8 } else { 0x00u8 };
762
763 debug!(
764 "Writing global profile: {} = {} (id: 0x{:02x}, state: 0x{:02x})",
765 feature.id, value, profile_id, state
766 );
767
768 let mut payload = [0u8; 65];
769 payload[1] = 0x5a;
770 payload[2] = 0x26;
771 payload[3] = 0x05;
772 payload[4] = 0x07;
773 payload[5] = profile_id;
774 payload[6] = 0x00;
775 payload[7] = state;
776 payload[8] = 0x00;
777
778 DEVICE_CONNECTION
779 .get()
780 .expect("Device connection must be initialized")
781 .lock()
782 .unwrap()
783 .write(&payload)
784 .expect("Failed to send write to device");
785
786 read_ack();
787}
788
789// ─── Output Getter/Setter (0x2c) ────────────────────────────────────────────
790

Callers

nothing calls this directly

Calls 1

read_ackFunction · 0.85

Tested by

no test coverage detected