brewer 0.0.60 → 0.0.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/brewer.gemspec +1 -1
  3. data/lib/brewer.rb +196 -15
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5572b66bef3ac9b8ffbb2206436e7f913169ac1
4
- data.tar.gz: 0dc67374ebdbea8ad2b074680062ba9e9ed47cd2
3
+ metadata.gz: 2c655c6d8ba7ce57f7c070c08ab1e91522bfbaca
4
+ data.tar.gz: 00e256b45d4a5c69d90f162e72a4204a00c8fbcf
5
5
  SHA512:
6
- metadata.gz: 7023e44fdaf9dae731af5be51870d49895e8bb0d1a63722d7569a7e4ccc88d2a710be613150d3acb324578ec2012238b6a335062241d07a73e7999f9347f5c7d
7
- data.tar.gz: a2fefa86d4c98b5c859a4a8faaa2934dd3eb196a1ba1658d1ae2acb94f76ee403c52d67ea0366f3dcde49f42c7db7db5ac47a6ba934b1dc09cd50776b335742d
6
+ metadata.gz: 4a1c5a24b3fcd10c61699c07581e0e9a61d59b26ddc18f17e413f4998a2e28b2444d181655ce2ad73e61b2d267085eb5603f0cfbbcc205815a997c63a5faa0ac
7
+ data.tar.gz: 012545ecda2b43f92014e6bbc226c6ec767e0461639a192f9220803f70d5ea8eeb4239fab439146e80683308ebc5c1445b497a36c0cbdeeec334177fe66cc1f7
@@ -2,7 +2,7 @@ require 'rake'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "brewer"
5
- s.version = "0.0.60"
5
+ s.version = "0.0.70"
6
6
  s.default_executable = "brewer"
7
7
 
8
8
  s.authors = ["Luke Sweeney"]
@@ -1,3 +1,4 @@
1
+ # TODO: Test monitor method
1
2
  require_relative 'helpers'
2
3
  require_relative 'adaptibrew'
3
4
  require_relative 'settings'
@@ -115,6 +116,7 @@ class Brewer
115
116
 
116
117
  def relay(relay, state)
117
118
  script("set_relay", "#{relay} #{state}")
119
+ wait(10)
118
120
  end
119
121
 
120
122
  def all_relays_status
@@ -133,13 +135,20 @@ class Brewer
133
135
 
134
136
  # :nocov:
135
137
  def watch
136
- until pv.to_i == sv.to_i do
138
+ until pv.to_f >= sv.to_f do
137
139
  wait(8)
138
140
  end
139
141
  true
140
142
  end
141
143
  # :nocov:
142
144
 
145
+ def monitor
146
+ while true do
147
+ ping("#{puts pid}")
148
+ wait(10)
149
+ end
150
+ end
151
+
143
152
  # WaterVolInQuarts, GrainMassInPounds, GrainTemp, MashTemp
144
153
  # :nocov:
145
154
  def get_strike_temp
@@ -169,66 +178,238 @@ class Brewer
169
178
  end
170
179
  # :nocov:
171
180
 
181
+ # Relays ----------
182
+ def rims_to(location)
183
+ if location == "mash"
184
+ # we ended up swapping this relay, so the name is backwards
185
+ relay($settings['rimsToMashRelay'], 0)
186
+ elsif location == "boil"
187
+ relay($settings['rimsToMashRelay'], 1)
188
+ end
189
+ true
190
+ end
191
+
192
+ def hlt_to(location)
193
+ if location == "mash"
194
+ relay($settings['spargeToMashRelay'], 0)
195
+ elsif location == "boil"
196
+ relay($settings['spargeToMashRelay'], 1)
197
+ end
198
+ true
199
+ end
200
+
201
+ def hlt(state)
202
+ if state == "open"
203
+ relay($settings['spargeRelay'], 1)
204
+ elsif state == "close"
205
+ relay($settings['spargeRelay'], 0)
206
+ end
207
+ true
208
+ end
209
+
172
210
  # Master Procedures -----------------------------------------------------
173
211
  # The main steps in the brewing proccess
174
212
  def boot
175
213
  # These are the states required for starting. Should be called on boot.
176
214
  # Print PID status at end
215
+ ping("booting...")
177
216
  pid(0)
178
217
  pump(0)
179
- relay($settings['rimsToMashRelay'], 1)
218
+ rims_to('mash')
219
+ hlt_to('mash')
180
220
  all_relays_status
181
221
  puts pid
182
222
 
183
223
  clear
184
224
  puts "Boot successful!"
185
- @out.unshift("successful boot")
225
+ @out.unshift("successful boot at #{Time.now}")
226
+ ping("🍺 boot successful 🍺")
186
227
  true
187
228
  end
188
229
 
189
230
  # :nocov:
190
231
  def heat_strike_water
232
+ puts "heat-strike-water procedure started"
233
+ # Confirm strike water is in the mash tun
191
234
  print "Is the strike water in the mash tun? "
235
+ # -> response
192
236
  confirm ? nil : abort
193
237
 
238
+ # confirm return manifold is in the mash tun
194
239
  print "Is the return manifold in the mash tun? "
240
+ # -> response
241
+ confirm ? nil : abort
242
+
243
+ print "Is the mash tun valve open? "
195
244
  confirm ? nil : abort
196
245
 
197
- relay($settings['rimsToMashRelay'], 1)
246
+ # confirm RIMS relay is on
247
+ rims_to('mash')
198
248
  puts "RIMS-to-mash relay is now on"
199
249
 
250
+ # turn on pump
200
251
  pump(1)
201
252
  puts "Pump is now on"
202
253
 
254
+ # wait ~30 seconds
203
255
  print "How long do you want to wait for the water to start circulating? (30) "
204
256
  time = gets.chomp
205
257
  if time == ""
206
258
  time = 30
207
259
  end
208
-
209
260
  puts "Waiting for #{time} seconds for strike water to start circulating"
210
- puts "(ctrl-c to stop now)"
261
+ puts "(ctrl-c to exit proccess now)"
211
262
  wait(time.to_i)
212
263
 
264
+ # confirm that strike water is circulating well
213
265
  print "Is the strike water circulating well? "
266
+ # -> response
214
267
  confirm ? nil : abort
215
268
 
216
- @temps['starting_strike_temp'] = pv.to_i
217
- puts "current strike water temp is #{pv}. Saved."
218
- puts "Warning: if you exit this brewer shell, the strike water temp will be lost"
219
- puts ""
220
- puts "--- Calculate strike temp ---"
221
- # this sets PID to strike temp
269
+
270
+ # calculate strike temp & set PID to strike temp
271
+ # this sets PID SV to calculated strike temp automagically
222
272
  get_strike_temp
223
- # turn on pid heater
273
+ # turn on RIMS heater
224
274
  pid(1)
225
275
 
226
- # when strike temp is reached, ping
276
+ # measure current strike water temp and save
277
+ @temps['starting_strike_temp'] = pv.to_i
278
+ puts "current strike water temp is #{pv}. Saved."
279
+ puts "Heating to #{sv}"
280
+
281
+ ping("Strike water beginning to heat. This may take a few minutes.")
282
+
283
+ # when strike temp is reached, ping slack
227
284
  watch
228
- ping("strike water is now at #{pv.echo} degrees")
285
+ ping("Strike water heated to #{pv}. Maintaining temperature.")
286
+ ping("Next step: dough in")
287
+ puts "Next step: dough in"
288
+ puts "command: brewer.dough_in"
229
289
 
230
290
  true
231
291
  end
232
292
  # :nocov:
233
293
 
294
+ def dough_in
295
+ ping("dough-in procedure started")
296
+ puts "dough-in procedure started"
297
+ # turn pump off
298
+ # turn PID off
299
+ pump(0)
300
+ ping("Ready to dough in")
301
+ puts "Ready to dough in"
302
+
303
+ print "Confirm when you're done with dough-in (y): "
304
+ confirm ? nil : abort
305
+
306
+ ping("next step: mash")
307
+ puts "Next step: mash"
308
+ puts "command: brewer.mash"
309
+ # pour in grain
310
+ true
311
+ end
312
+
313
+ def mash
314
+ print "Enter mash temperature (#{@temps['desired_mash'].to_s} F): "
315
+ temp = gets.chomp
316
+
317
+ if temp != ""
318
+ @temps['desired_mash'] = temp.to_i
319
+ end
320
+
321
+ sv(@temps['desired_mash'])
322
+
323
+ print "Enter mash time in seconds (3600 seconds for 1 hour). This timer will start once mash temp has been reached: "
324
+ mash_time_input = gets.chomp
325
+
326
+ puts "This will take a while. You'll get a slack message next time you need to do something."
327
+ ping("Mash started. This will take a while. You'll get a slack message next time you need to do something.")
328
+
329
+ if mash_time_input == ""
330
+ mash_time = 3600
331
+ else
332
+ mash_time = mash_time_input.to_i
333
+ end
334
+
335
+ rims_to('mash')
336
+
337
+ pump(1)
338
+ pid(1)
339
+
340
+ watch
341
+ ping("Mash temp (#{pv} F) reached. Starting timer for #{mash_time} seconds. You'll get a slack message next time you need to do something.")
342
+ puts "Mash temp (#{pv} F) reached. Starting timer for #{mash_time} seconds. You'll get a slack message next time you need to do something."
343
+ wait(mash_time)
344
+ ping("🍺 Mash complete 🍺. Check for starch conversion. Next step: mashout")
345
+ puts "Mash complete"
346
+ puts "Check for starch conversion"
347
+ puts "next step: mashout"
348
+ puts "command: brewer.mashout"
349
+ end
350
+
351
+ def mashout
352
+ puts "mashout procedure started"
353
+
354
+ print "Enter mashout temp (172 F): "
355
+ mashout_temp_input = gets.chomp
356
+
357
+ ping("Start heating sparge water")
358
+
359
+ if mashout_temp_input == ""
360
+ mashout_temp = 172.0
361
+ else
362
+ mashout_temp == mashout_temp_input.to_f
363
+ end
364
+
365
+ sv(mashout_temp)
366
+
367
+ pump(1)
368
+ pid(1)
369
+
370
+ ping("Heating to #{sv}... this could take a few minutes.")
371
+ watch
372
+ ping("Mashout temperature (#{pv}) reached. Mashout complete.")
373
+ end
374
+
375
+ def sparge
376
+ print "Is the sparge water heated to the correct temperature? "
377
+ confirm ? nil : abort
378
+
379
+ hlt_to('mash')
380
+ hlt('open')
381
+
382
+ puts "Waiting for 30 seconds. Regulate sparge balance."
383
+ puts "(ctrl-c to abort proccess)"
384
+ wait(30)
385
+
386
+ rims_to('boil')
387
+ pump(1)
388
+
389
+ ping("Please check the sparge balance and ignite boil tun burner")
390
+
391
+ puts "Waiting until intervention to turn off pump (y): "
392
+ confirm ? nil : abort
393
+
394
+ pid(0)
395
+ pump(0)
396
+
397
+ hlt('close')
398
+
399
+ ping("Sparge complete")
400
+ end
401
+
402
+ def top_off
403
+ hlt_to('boil')
404
+
405
+ hlt('open')
406
+
407
+ print "waiting for intervention to turn off hlt (y): "
408
+ confirm ? nil : abort
409
+
410
+ hlt('close')
411
+
412
+ ping('Topping off completed')
413
+ end
414
+
234
415
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.60
4
+ version: 0.0.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Sweeney