limitless-led 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/limitless_led.rb +1 -1
- data/lib/limitless_led/bridge.rb +18 -6
- data/lib/limitless_led/logger.rb +1 -1
- data/lib/limitless_led/version.rb +1 -1
- data/limitless_led.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa1ba16ac8fc123b0f8f433de1f54b3c266ec2f
|
4
|
+
data.tar.gz: d0ce26cf2bb3e727257a0136127b4ce9ecfaf428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d8809d24f2921be6ee05b0edeae2091f7024796e1622c6150372bfaefd2eb734fba64f2b002047ee32807ad3e776496a921d57e582fc5e1ed7bf3bba282ec4
|
7
|
+
data.tar.gz: e061ad0d1a1d47d8530066562434227ed0f8230f268021d5e8b8d56d9cef4dd4429a610872dfcb0065ef9d7188ed05afbe1d5f5dbb63b23513f31658843b9a32
|
data/lib/limitless_led.rb
CHANGED
data/lib/limitless_led/bridge.rb
CHANGED
@@ -22,19 +22,24 @@ module LimitlessLed
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# this sends the actual bytes to the real bridge/led over the UDP socket method
|
25
26
|
def send_packet(packet)
|
26
27
|
socket.send packet, 0
|
27
28
|
end
|
28
29
|
|
30
|
+
# This method dispatches the raw command in bytes to the proper method used
|
31
|
+
# to run commands for the led the first byte in the command code tells the
|
32
|
+
# real led which command to expect, most commands are 3-4 bytes long total
|
33
|
+
# and always end with 0x55
|
29
34
|
def run(input)
|
30
35
|
command = input.bytes
|
31
36
|
|
32
37
|
case command.first
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
when 64
|
39
|
+
color command[1]
|
40
|
+
when 65..77
|
36
41
|
raise 'command not implemented'
|
37
|
-
|
42
|
+
else
|
38
43
|
log "invalid command received: #{command.first}: #{command}"
|
39
44
|
end
|
40
45
|
|
@@ -42,10 +47,15 @@ module LimitlessLed
|
|
42
47
|
|
43
48
|
private
|
44
49
|
|
45
|
-
#
|
50
|
+
# this receives and integer as the color value from 0-255, this value
|
51
|
+
# maps directly to the dial on the limitless-led controller and app where
|
52
|
+
# the color at 12 o'clock is 0, the colors are mapped clockwise around
|
53
|
+
# the dial with 255 being almost the same color as 0, this is because the
|
54
|
+
# color space we are using is HSL.
|
46
55
|
def color(color)
|
47
56
|
|
48
|
-
# Turn second byte
|
57
|
+
# Turn second byte int a value out of 360, this is because HSL color maps
|
58
|
+
# the hue on a radial scale so the first and last values are the same color
|
49
59
|
color = color.to_f / 255.0 * 360.0
|
50
60
|
|
51
61
|
# Rotate 90 degrees and flip to match dial ui on device
|
@@ -54,6 +64,8 @@ module LimitlessLed
|
|
54
64
|
# Return the color
|
55
65
|
color = Color::HSL.new( hue, 90, 50)
|
56
66
|
|
67
|
+
# log the color that the device would be set to
|
68
|
+
# TODO: this should only happen with the bridge is initialized with the verbose parameter as true
|
57
69
|
log_color color
|
58
70
|
|
59
71
|
end
|
data/lib/limitless_led/logger.rb
CHANGED
data/limitless_led.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "rake"
|
22
22
|
spec.add_development_dependency "rspec"
|
23
23
|
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.
|
24
|
+
spec.add_dependency "eventmachine"
|
25
|
+
spec.add_dependency "color"
|
26
|
+
spec.add_dependency "rainbow"
|
27
27
|
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limitless-led
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Silvashy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|