# for developing 25mm arrays in the processing position
# assumes PS has ~1ml of sample in it with 1.5ml air above

#load SH2 puck on PS
# heat on to ~30C or slightly less
# delay ~2min = preheat
# continue heating @30 for duration of SH2

def sh2 fromTube = 1, signal=:sig1, toTube = 2

#load the sh2 puck
loadPuck fromTube, :processing

#get valving ready for preheat
PTV.to :puck
PBV.to :air

#start heating
PH.seek 18, 180   #warm up step
PH.hold '02:00:00', 22 #holds for a long time, we'll shut off when needed
delay 120         #warmup time

#deliver lystate to array
PTV.to :puck
PSV.to :PTV
PBV.to :waste1
PS.push 0.5
delay 3
PBV.dialBetween :PSV, :waste1
PS.to 0				#lysate in puck

Log.record 'beginning samplePassA'
#clean up
samplePassA :cleanCS  #add the cleaning of lysate from CS

delay '20:00' 			#this will be ~20 min for the real thing

recoverProcessReagent

addProcessReagent :wash
delay '2:00'			#this will be ~2 min for the real thing

recoverProcessReagent

Log.record 'Adding signal'
addProcessReagent signal
delay '10:00' 			#this will be ~10 min for the real thing

recoverProcessReagent

2.times {addProcessReagent :wash; delay '2:00'; recoverProcessReagent} # 2washes

Log.record 'Adding conjugate'
addProcessReagent :conjugate
delay '5:00' 			#this will be ~5 min for the real thing

recoverProcessReagent

3.times {addProcessReagent :wash; delay '2:00'; recoverProcessReagent} # 4washes
Sleepy.power :camera, :on  #turn camera Peltier cooler on about 3mins before use
addProcessReagent :wash; delay '2:00'; recoverProcessReagent


Log.record 'Mixing Substrates'
PSV.to PSR
PSR.select :sub1		#could be set as def
PS.pull 0.5
delay 2
PSR.select :sub2
PS.pull 0.5
delay 2
PSR.select :air
PS.fill				#mix sub 1 and 2
PSV.to :PTV
PBV.to :waste1
PS.push 0.5
delay 3
PBV.dialBetween :PSV, :waste1
PS.to 0		
delay 7

recoverProcessReagent

#gracefully turn heat off
PH.stop

# unload puck and go to camera seal, image
imagePuck :processing, toTube

PuckCamera.snap
Sleepy.power :camera, :off
finishImage

#clean up the Processing stage
psLoopFlush

end #end of sh2
