wiimote_sps 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/wiimote_sps.rb +33 -7
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 129410ef8990a7b8c5339a5eb63d7456289e28db
|
4
|
+
data.tar.gz: 62d9427cc0a91cba4418ab5f84f381027cd3d015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 675a1b1bd619048d304dafcc5a7dae9f8adfe18d3702ec2036c07f46432d4a524a20a16d8967167178d7d8371a1db3ea689eabbac00b6b36237adcc3baefbbfb
|
7
|
+
data.tar.gz: 14ff2ccd01b9ee905666ab97ed8ebd65fa02afb1dda87bda5b389bcd48acb208d2a876d5cd56a3ef32dfa85413ed56c8127eebd58ddeea7379ed579c11d27bad
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wiimote_sps.rb
CHANGED
@@ -38,16 +38,42 @@ class WiimoteSps < SimpleWiimote
|
|
38
38
|
when /rumble$/
|
39
39
|
|
40
40
|
case msg
|
41
|
-
when /^buzz/
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
when /^(buzz|vibrate|rumble|duration)/
|
42
|
+
|
43
|
+
r = msg.match(/duration\s([\d\.]+)/)
|
44
|
+
|
45
|
+
duration = r ? r.captures.first.to_f : 0.3
|
46
|
+
|
47
|
+
self.rumble = true; sleep duration; self.rumble = false
|
48
|
+
|
45
49
|
end
|
46
50
|
|
47
51
|
when /led$/
|
48
|
-
|
49
|
-
|
50
|
-
|
52
|
+
|
53
|
+
r = msg.match(/(\d+)\s*(on|off|blink|stop)\s*([\d\.]+)?(?:\s*duration\s)?([\d\.]+)?/)
|
54
|
+
|
55
|
+
if r then
|
56
|
+
index, state, seconds, raw_duration = r.captures
|
57
|
+
duration = raw_duration ? raw_duration.to_f : nil
|
58
|
+
|
59
|
+
a = case state
|
60
|
+
|
61
|
+
when 'on'
|
62
|
+
[:on, duration]
|
63
|
+
|
64
|
+
when 'off'
|
65
|
+
[:off]
|
66
|
+
|
67
|
+
when 'blink'
|
68
|
+
seconds = seconds ? seconds.to_f : 0.5
|
69
|
+
[:blink, seconds, duration: duration]
|
70
|
+
|
71
|
+
when 'stop'
|
72
|
+
[:off]
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
@led[index.to_i].send(*a)
|
51
77
|
end
|
52
78
|
end
|
53
79
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|