Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============== GateDoor AirLock ==================#
- # by Senpasi #
- # based on AirLock ICS by swagman #
- # schema - https://yadi.sk/i/4CB5KBejq0uCpw #
- #===================================== 13.01.2021 =#
- define pressLeft 0 #outer (Vent0) pressure set 0 kPa
- define pressRight 50 #inner (Vent1) pressure set 50 kPa
- alias DoorLeft d0 # memory -> batch writer "Open" to outer gates
- alias ButtonsLeft d1 # logic "max" from buttons on outer gates
- #alias GSens d2 # replace it by command lb
- alias DoorRight d3 # memory -> batch writer "Open" to inner gates
- alias ButtonsRight d4 # logic "max" from buttons on inner gates
- alias Vent d5 # memory, vent modes. 0 - off, 1 - vacuuming to outer, 2 - pressurize from inner, -1 - pressurize from outer, -2 - vacuuming to inner.
- #you need 3 constants in memory units - 0, 1 and 2
- #choose vent mode with 2 compare units >0 (out) and <0 (in),
- #choose vent on/off with unary math unit "abs" then 2 compare units (1 for outer and 2 for inner network)
- alias state r15
- alias route r14
- alias press r13 #current pressure
- alias targp r12 #target pressure
- alias btrev r11 #button revers direction
- alias btpas r10 #button pass direction
- move state st1 #init state for first loop
- loop:#--main loop
- yield
- select targp route pressLeft pressRight
- select r9 route 0 3 #DoorLeft DoorRight - door for open after pressurize
- select r8 route 3 0 #DoorRight DoorLeft - door for close before vacuuming
- select r5 route 1 4 #ButtonsLeft ButtonsRight - door for open after pressurize
- select r4 route 4 1 #ButtonsRight ButtonsLeft - door for close before vacuuming
- select r6 route -2 1 #Vent mode - vacuuming
- select r7 route -1 2 #Vent mode - pressurize
- #l press GSens Setting
- lb press -1252983604 Pressure 0
- l btpas dr5 Setting
- l btrev dr4 Setting
- s db Setting state #debug
- j state
- st1: #--door opened
- l r0 DoorLeft Setting
- l route DoorRight Setting
- xor r0 route r0
- beqz r0 end #simultaneous access, goto end
- beqz btpas end #door is allready opened, goto end
- s dr8 Setting 0 #close door
- move state st2 #start vacuuming
- j end
- st2: #--vacuuming
- xor route route btrev #person change mind
- select state btrev st3 st2
- sgtz r0 press
- select r6 r0 r6 0 #if vacuum set mode=0
- s Vent Setting r6
- select state r0 state st3
- j end
- st3: #--pressurize
- xor route route btrev #person change mind
- select state btrev st2 st3
- slt r0 press targp
- select r0 btpas 0 r0
- select r7 r0 r7 0 #if pressurized set mode=0
- s Vent Setting r7
- bgtz r0 end
- s dr9 Setting 1
- xor route route 1
- move state st1
- end:#--airlock
- j loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement