dbrady-switchy 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +64 -2
- data/lib/switchy.rb +0 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -78,7 +78,17 @@ TODO: Write me!
|
|
78
78
|
|
79
79
|
= TODO
|
80
80
|
|
81
|
-
|
81
|
+
|
82
|
+
* Circuit default lights at boot should light onboard LED and no other
|
83
|
+
outputs.
|
84
|
+
|
85
|
+
* Add blink feature to usb protocol. NOTE: This will entail setting up
|
86
|
+
a flasher register and timing/counters. For starters, just set it to
|
87
|
+
blink a hard-coded rate when "2" is sent, e.g "switchy 1 2" would
|
88
|
+
blink light 1 at some rate. Later we can attach different blink
|
89
|
+
rates and/or patterns to other numbers. For example, 3 might blink
|
90
|
+
at the same rate as 2 but out of phase, so "switchy 1 2 2 3" would
|
91
|
+
oscillate lights 1 and 2.
|
82
92
|
|
83
93
|
* There's an enable line on the 74ls244 driver chip. Use it. Device
|
84
94
|
should boot disabled. Once everything's had a chance to settle
|
@@ -89,4 +99,56 @@ TODO: Write me!
|
|
89
99
|
* Fork the circuit, make a version with just a little LED light bar
|
90
100
|
and no 120VAC switching. (Trust me. The little LEDs are VERY
|
91
101
|
compelling!)
|
92
|
-
|
102
|
+
* 4-LED Version. Fixed colors on all LEDS.
|
103
|
+
* Blue/White LED: Specs are running
|
104
|
+
* Green LED: Specs passed!
|
105
|
+
* Yellow LED: Specs were Pending!
|
106
|
+
* Red LED: Specs failed!
|
107
|
+
* 3-LED version. Fixed colors on all LEDS. LEDs blink when specs are
|
108
|
+
running. Version 1: blink green, or all 3, or cycle all 3, LEDs.
|
109
|
+
Version 2: blinking green means running, blinking yellow means
|
110
|
+
running but a pending spec was found, and blinking red means it's
|
111
|
+
still running but failures have occurred.
|
112
|
+
* Blinking: Specs are running.
|
113
|
+
* Green LED: Specs passed!
|
114
|
+
* Yellow LED: Specs were Pending!
|
115
|
+
* Red LED: Specs failed!
|
116
|
+
* 1-LED Version. Single RGB LED.
|
117
|
+
* Blinking (ooh, or throbbing) Blue/White: Specs running
|
118
|
+
* Green: Passed
|
119
|
+
* Yellow: Pending
|
120
|
+
* Red: Failed
|
121
|
+
* 1-LED Version. Single Bi-color. Same as RGB. Will need to
|
122
|
+
oscillate because red/green = orange.
|
123
|
+
* Blinking: Running
|
124
|
+
* Green: Passed
|
125
|
+
* Orange: Pending
|
126
|
+
* Red: Failed
|
127
|
+
|
128
|
+
* Expand the switch control logic. Need static on/off, Timers, and
|
129
|
+
blinkers. Note: if the board can handle infinite vs. countdown, then
|
130
|
+
implementing one-shot timers is easy: just set countdown to 1.
|
131
|
+
* Static on/off: Sit pin state and forget about it.
|
132
|
+
SET C4 1
|
133
|
+
* Blinker: set pin state for n milliseconds, toggle to other state
|
134
|
+
for m milliseconds. Repeat x times. (0 = infinite)
|
135
|
+
TMR C7 1 500 250 10
|
136
|
+
* Timer: set pin state for n milliseconds, then toggle it to other
|
137
|
+
state.
|
138
|
+
TMR C6 0 60000 250 1 # alarm timer, flashes C6 once for 250ms
|
139
|
+
after 60s
|
140
|
+
|
141
|
+
* Given the above switch control logic, the ruby app should now be
|
142
|
+
able to programmatically define compound events like:
|
143
|
+
* When program starts, turn off siren, green, yellow and red lights.
|
144
|
+
* When test runs, turn off siren, yellow and red lights, and blink
|
145
|
+
green light at 2Hz.
|
146
|
+
* If a spec is pending and green light is blinking, turn off green
|
147
|
+
link and blink yellow light at 2Hz.
|
148
|
+
* If a spec fails and red light is off, turn off green and yellow
|
149
|
+
lights, honk siren for 250ms, and blink red light at 2Hz.
|
150
|
+
* When specs all pass, turn on green light for 10 seconds.
|
151
|
+
* When specs fail, "blink" siren for 1 second every 60 seconds, turn
|
152
|
+
on red light and leave it on.
|
153
|
+
* Blink RGB yellow by seting Red and Green to blink. (Need to build
|
154
|
+
the system to permit synchronous blink rates.)
|
data/lib/switchy.rb
CHANGED
@@ -94,7 +94,6 @@ class Switchy
|
|
94
94
|
|
95
95
|
def connect
|
96
96
|
@sp = SerialPort.new @modem, @baud
|
97
|
-
puts "Connected"
|
98
97
|
end
|
99
98
|
|
100
99
|
def disconnect
|
@@ -104,13 +103,11 @@ class Switchy
|
|
104
103
|
# Set pin "b4", 1 # turn on pin b4
|
105
104
|
def set_pin(p, v)
|
106
105
|
cmd = "#{p.upcase}=#{v}\r\n"
|
107
|
-
puts cmd
|
108
106
|
@sp.write cmd
|
109
107
|
end
|
110
108
|
|
111
109
|
def set_light(l, v)
|
112
110
|
cmd = "C#{l+3}=#{v}\r\n"
|
113
|
-
puts cmd
|
114
111
|
@sp.write cmd
|
115
112
|
end
|
116
113
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbrady-switchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Brady
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|