Actions

Difference between revisions of "Custom Airlock IC10"

From Unofficial Stationeers Wiki

m (Category:MIPS Programming)
(Use proper/better category -> IC10)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[Category:MIPS Programming]]
+
[[Category:IC10 Programming]]
 
[[File:Airlockscreen.jpg|thumb]]
 
[[File:Airlockscreen.jpg|thumb]]
  
Line 139: Line 139:
 
dePressurize_end:<br>
 
dePressurize_end:<br>
 
s LedLight On 1<br>
 
s LedLight On 1<br>
 +
yield<br>
 
j ra<br>
 
j ra<br>
 
<br>
 
<br>
Line 149: Line 150:
 
pressurize_end:<br>
 
pressurize_end:<br>
 
s LedLight On 1<br>
 
s LedLight On 1<br>
 +
yield<br>
 
j ra<br>
 
j ra<br>
 
<br>
 
<br>
Line 160: Line 162:
 
j _monitorTrigger<br>
 
j _monitorTrigger<br>
 
monitorTrigger_end:<br>
 
monitorTrigger_end:<br>
 +
yield<br>
 
j ra<br>
 
j ra<br>
 
|}
 
|}

Latest revision as of 12:07, 23 May 2024

Airlockscreen.jpg

Contents[edit]

This script controls all functions of an airlock that consists of the following:

Assembly[edit]

Set up a standard airlock for atmosphere on both sides. Configure the pressures in the first two lines of the script. Before exporting the script or resetting the IC, make sure the airlock is cycled to the outside (inner door closed, outer open). The LED serves as trigger for both cycling the airlock and skipping each phase, hence should be placed inside the airlock. The airlock should be a single frame to avoid leftover atmosphere after depressurization. For larger airlocks place the sensor on the far side from the vents. The script supports Blast Doors, but since they lack a door handle you will need a button on each side (outside) of the airlock. Connect a Logic Writer to each button and use it to toggle the LED.

IC10 pin layout:

D0 Interior Door
D1 Exterior Door
D2 Interior Vent
D3 Exterior Vent
D4 Gas Sensor
D5 LED Light

Usage[edit]

The airlock can be cycled by interacting with either door, or turning the LED off. During cycling the doors are locked, and the LED can be used to skip both depressurize (red) and pressurize (yellow) phases.

Source Code

Source code:

define Int.Pressure 100
define Ext.Pressure 0

alias Int.Door d0
alias Ext.Door d1
alias Int.Vent d2
alias Ext.Vent d3
alias Sensor d4
alias LedLight d5

define Color.Red 4
define Color.Yellow 5
define Color.Green 2
define Mode.Out 1
define Mode.In 0

alias rT r0
alias rT2 r1
alias rTarPressure r2

Init:
s Int.Vent On 0
s Ext.Vent On 0
s Ext.Door Mode 1 #Logic mode
s Int.Door Mode 1 #Logic mode
s LedLight Color Color.Green
s LedLight On 1
s Int.Door Open 0
s Ext.Door Open 1
yield

main:
jal _monitorTrigger
jal _cycleToInt
jal _monitorTrigger
jal _cycleToExt
j main

_cycleToInt:
push ra
s Ext.Door Lock 1
s Int.Door Lock 1
s Ext.Door Open 0
s Ext.Vent Mode Mode.Out
s Ext.Vent On 1
s LedLight Color Color.Red
s LedLight On 1
jal _dePressurize
s Ext.Vent On 0
s Int.Vent Mode Mode.In
s Int.Vent PressureExternal Int.Pressure
move rTarPressure Int.Pressure
s Int.Vent On 1
s LedLight Color Color.Yellow
jal _pressurize
s LedLight Color Color.Green
s Int.Vent On 0
s Int.Door Open 1
s Ext.Door Lock 0
s Int.Door Lock 0
pop ra
j ra

_cycleToExt:
push ra
s Int.Door Lock 1
s Ext.Door Lock 1
s Int.Door Open 0
s Int.Vent Mode Mode.Out
s Int.Vent On 1
s LedLight Color Color.Red
s LedLight On 1
jal _dePressurize
s Int.Vent On 0
s Ext.Vent Mode Mode.In
s Ext.Vent PressureExternal Ext.Pressure
move rTarPressure Ext.Pressure
s Ext.Vent On 1
s LedLight Color Color.Yellow
jal _pressurize
s LedLight Color Color.Green
s Ext.Vent On 0
s Ext.Door Open 1
s Int.Door Lock 0
s Ext.Door Lock 0
pop ra
j ra

_dePressurize:
l rT Sensor Pressure
beqz rT dePressurize_end
l rT LedLight On
beqz rT dePressurize_end
j _dePressurize
dePressurize_end:
s LedLight On 1
yield
j ra

_pressurize:
l rT Sensor Pressure
bge rT rTarPressure pressurize_end
l rT LedLight On
beqz rT pressurize_end
j _pressurize
pressurize_end:
s LedLight On 1
yield
j ra

_monitorTrigger:
l rT Int.Door Setting
l rT2 Ext.Door Setting
beq rT rT2 monitorTrigger_end
l rT LedLight On
beqz rT monitorTrigger_end
yield
j _monitorTrigger
monitorTrigger_end:
yield
j ra