Buttplug sex toy control library

feat: Better timing for the Fredorch F21S

This uses a lookup table vs trying to come up with
a magic algorithm. It's not perfect, but it's worlds
better. Be aware that the chatty-ness of the protocol
still means updates aren't as immediate as you'd want.

authored by

blackspherefollower and committed by qdot.tngl.sh e3b32dce d180af65

+32 -6
+21
crates/buttplug_server/src/device/protocol_impl/fredorch.rs
··· 253 ) 254 .into()]) 255 } 256 }
··· 253 ) 254 .into()]) 255 } 256 + 257 + // TODO: Something is off... I think we need to program in both directions independently 258 + fn handle_output_oscillate_cmd(&self, _feature_index: u32, _feature_id: Uuid, speed: u32) -> Result<Vec<HardwareCommand>, ButtplugDeviceError> { 259 + // If we ever get oscillate with range, these should be loaded from the last set range 260 + let min_pos = if speed == 0 { 0 } else { 0 }; 261 + let max_pos = if speed == 0 { 0 } else { 15 }; 262 + let mut data: Vec<u8> = vec![ 263 + 0x01, 0x10, 0x00, 0x6B, 0x00, 0x05, 0x0a, 0x00, speed as u8, 0x00, speed as u8, 0x00, min_pos * 15, 0x00, max_pos * 15, 264 + 0x00, 0x01, 265 + ]; 266 + let crc = crc16(&data); 267 + data.push(crc[0]); 268 + data.push(crc[1]); 269 + Ok(vec![HardwareWriteCmd::new( 270 + &[FREDORCH_PROTOCOL_UUID], 271 + Endpoint::Tx, 272 + data, 273 + false, 274 + ) 275 + .into()]) 276 + } 277 }
+2 -2
crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json
··· 1 { 2 "version": { 3 "major": 4, 4 - "minor": 86 5 }, 6 "protocols": { 7 "activejoy": { ··· 1187 ], 1188 "position": [ 1189 0, 1190 - 150 1191 ] 1192 } 1193 }
··· 1 { 2 "version": { 3 "major": 4, 4 + "minor": 87 5 }, 6 "protocols": { 7 "activejoy": { ··· 1187 ], 1188 "position": [ 1189 0, 1190 + 15 1191 ] 1192 } 1193 }
+8 -3
crates/buttplug_server_device_config/device-config-v4/protocols/fredorch.yml
··· 6 position_with_duration: 7 position: 8 - 0 9 - - 150 10 duration: 11 - - 0 12 - - 100000 13 id: cbd6a5b5-50c0-4fb5-93e3-408fd027ff4d 14 communication: 15 - btle:
··· 6 position_with_duration: 7 position: 8 - 0 9 + - 15 10 duration: 11 + - 0 12 + - 100000 13 + # Disable Oscillate for now 14 + # Oscillate: 15 + # step-range: 16 + # - 0 17 + # - 20 18 id: cbd6a5b5-50c0-4fb5-93e3-408fd027ff4d 19 communication: 20 - btle:
+1 -1
crates/buttplug_server_device_config/device-config-v4/version.yaml
··· 1 version: 2 major: 4 3 - minor: 86
··· 1 version: 2 major: 4 3 + minor: 87