File tree Expand file tree Collapse file tree 3 files changed +5
-21
lines changed
crates/buttplug_server/src/device/protocol_impl/lovense Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Original file line number Diff line number Diff line change @@ -29,16 +29,17 @@ const LOVENSE_STROKER_PROTOCOL_UUID: Uuid = uuid!("a97fc354-5561-459a-bc62-110d7
2929
3030pub struct LovenseStroker {
3131 linear_info : Arc < ( AtomicU32 , AtomicU32 ) > ,
32+ need_range_zerod : bool ,
3233}
3334
3435impl LovenseStroker {
35- pub fn new ( hardware : Arc < Hardware > ) -> Self {
36+ pub fn new ( hardware : Arc < Hardware > , need_range_zerod : bool ) -> Self {
3637 let linear_info = Arc :: new ( ( AtomicU32 :: new ( 0 ) , AtomicU32 :: new ( 0 ) ) ) ;
3738 async_manager:: spawn ( update_linear_movement (
3839 hardware. clone ( ) ,
3940 linear_info. clone ( ) ,
4041 ) ) ;
41- Self { linear_info }
42+ Self { linear_info, need_range_zerod }
4243 }
4344}
4445
@@ -79,7 +80,7 @@ impl ProtocolHandler for LovenseStroker {
7980 HardwareWriteCmd :: new(
8081 & [ feature_id] ,
8182 Endpoint :: Tx ,
82- format!( "Mply:{}:{};" , speed, if speed == 0 { 0 } else { 20 } )
83+ format!( "Mply:{}:{};" , speed, if speed == 0 && self . need_range_zerod { 0 } else { 20 } )
8384 . as_bytes( )
8485 . to_vec( ) ,
8586 false ,
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ impl ProtocolInitializer for LovenseInitializer {
245245 ) ;
246246
247247 if device_type == "BA" || device_type == "H" {
248- Ok ( Arc :: new ( LovenseStroker :: new ( hardware) ) )
248+ Ok ( Arc :: new ( LovenseStroker :: new ( hardware, device_type == "H" ) ) )
249249 } else if output_count == 1 {
250250 Ok ( Arc :: new ( LovenseSingleActuator :: default ( ) ) )
251251 } else if lovense_max {
Original file line number Diff line number Diff line change @@ -146,15 +146,6 @@ async fn device_tester() {
146146 dev. index( ) ,
147147 feature. feature_index( )
148148 ) ;
149- } else if let Some ( out) = outs. get ( OutputType :: Position ) {
150- cmds. push ( feature. position ( out. step_count ( ) ) ) ;
151- println ! (
152- "{} ({}) should start moving to position {} on feature {}!" ,
153- dev. name( ) ,
154- dev. index( ) ,
155- out. step_count( ) ,
156- feature. feature_index( )
157- ) ;
158149 }
159150 } ) ;
160151 if cmds. len ( ) > 0 {
@@ -214,14 +205,6 @@ async fn device_tester() {
214205 dev. index( ) ,
215206 feature. feature_index( )
216207 ) ;
217- } else if outs. get ( OutputType :: Position ) . is_some ( ) {
218- cmds. push ( feature. position ( 0 ) ) ;
219- println ! (
220- "{} ({}) should start moving to position 0 on feature {}!" ,
221- dev. name( ) ,
222- dev. index( ) ,
223- feature. feature_index( )
224- ) ;
225208 }
226209 } ) ;
227210
You can’t perform that action at this time.
0 commit comments