From 2ebec56b139ead9185278027e2d2638096d47fe8 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Sun, 29 Aug 2021 14:58:46 +0200 Subject: [PATCH 1/7] Set up aliases and defines --- automatic_canister_filler.ic10 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 automatic_canister_filler.ic10 diff --git a/automatic_canister_filler.ic10 b/automatic_canister_filler.ic10 new file mode 100644 index 0000000..4a04bc8 --- /dev/null +++ b/automatic_canister_filler.ic10 @@ -0,0 +1,15 @@ +# check for presence of canister +# check canister type in tank storage +# set target pressure accordingly +# run volume pump until target pressure in canister is reached +# stop volume pump + +alias canister_storage d0 +alias volume_pump d1 + +alias canister_present r0 +alias canister_hash r1 +alias canister_pressure r2 + +define canister 42280099 +define smart_canister -668314371 \ No newline at end of file From 671e6bc12a602ae321dbb3d54d0a47a2747d3f0d Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Sun, 29 Aug 2021 15:03:25 +0200 Subject: [PATCH 2/7] Delete automatic_canister_filler.ic10 --- automatic_canister_filler.ic10 | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 automatic_canister_filler.ic10 diff --git a/automatic_canister_filler.ic10 b/automatic_canister_filler.ic10 deleted file mode 100644 index 4a04bc8..0000000 --- a/automatic_canister_filler.ic10 +++ /dev/null @@ -1,15 +0,0 @@ -# check for presence of canister -# check canister type in tank storage -# set target pressure accordingly -# run volume pump until target pressure in canister is reached -# stop volume pump - -alias canister_storage d0 -alias volume_pump d1 - -alias canister_present r0 -alias canister_hash r1 -alias canister_pressure r2 - -define canister 42280099 -define smart_canister -668314371 \ No newline at end of file From 7633f6d1807b1e4bd76e54baee4cf4263dd439c0 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Sun, 29 Aug 2021 23:26:24 +0200 Subject: [PATCH 3/7] Fixed typos and comments --- automated_canister_filling.ic10 | 43 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/automated_canister_filling.ic10 b/automated_canister_filling.ic10 index 835fd47..03986e0 100644 --- a/automated_canister_filling.ic10 +++ b/automated_canister_filling.ic10 @@ -1,54 +1,53 @@ # automatic gas-canister filler. # only works with player-made cans, starter-cans # have different hashes that won't work -# !!! Remember to set volume pump to no more !!! -# !!! than 10l! I have mine at 2l for safety !!! +# !!! Remember to set volume pump to 10l !!! -alias canister_storage d0 +alias tank_storage d0 alias fill_pump d1 alias evac_pump d2 -alias analyzer d4 +alias analyzer d3 -alias canister_present r0 -alias canister_hash r1 +alias tank_present r0 +alias tank_hash r1 alias storage_pressure r2 alias gas_to_move r3 alias fill_pressure r4 alias pump_active r5 -define canister 42280099 -define smart_canister -668314371 +define canister_hash 42280099 +define smart_canister_hash -668314371 start: # check if canister is present -ls canister_present canister_storage 0 Occupied +ls tank_present tank_storage 0 Occupied # identify canister -ls canister_hash canister_storage 0 OccupantHash +ls tank_hash tank_storage 0 OccupantHash # set safe fill-pressure -beq canister_hash canister regular -beq canister_hash smart_canister smart +beq tank_hash canister_hash regular +beq tank_hash smart_canister_hash smart regular: -move fill_pressure 8000000 # regular can safe max +move fill_pressure 8000000 # regular tank safe max j fill # start filling smart: -move fill_pressure 18000000 # smart can safe max +move fill_pressure 18000000 # smart tank safe max j fill # start filling -fill: # fills canister if present and <8Mpa -# get canister pressure in Pa -ls storage_pressure canister_storage 0 Pressure -# is there room in the canister for more gas? +fill: # fills tank if present and has room +# get tank pressure in Pa +ls storage_pressure tank_storage 0 Pressure +# is there room in the tank for more gas? slt gas_to_move storage_pressure fill_pressure -# is there a can in the slot that has room? -and pump_active gas_to_move canister_present +# is there a tank in the slot that has room? +and pump_active gas_to_move tank_present # trigger fill pump s fill_pump On pump_active -beqz canister_present evac# break if no can +beqz tank_present evac # break if no tank j start -evac: # evacuates pipe on can removed and >0Pa +evac: # evacuates pipe on tank removed and >0Pa l storage_pressure analyzer Pressure # is there gas in the pipe? sgt gas_to_move storage_pressure 0 From 956a7790c8b9035c5861724464ca0b73784cb33c Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Sun, 29 Aug 2021 23:38:49 +0200 Subject: [PATCH 4/7] Found yet more outdated comments --- automated_canister_filling.ic10 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/automated_canister_filling.ic10 b/automated_canister_filling.ic10 index 03986e0..f2c3c85 100644 --- a/automated_canister_filling.ic10 +++ b/automated_canister_filling.ic10 @@ -1,6 +1,7 @@ -# automatic gas-canister filler. -# only works with player-made cans, starter-cans -# have different hashes that won't work +# needs two volume pumps and a pipe analyzer +# fill_pump points to the tank storage +# evac_pump points back to the gas-feed +# analyzer is on a pipe between punps and tank # !!! Remember to set volume pump to 10l !!! alias tank_storage d0 @@ -53,4 +54,4 @@ l storage_pressure analyzer Pressure sgt gas_to_move storage_pressure 0 # trigger evac pump s evac_pump On gas_to_move -j start \ No newline at end of file +j start From e4319e623669a5afea026dc321600e08c80d4ac0 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Mon, 30 Aug 2021 13:28:41 +0200 Subject: [PATCH 5/7] Slimmed code, made it less fancy and more robust --- automated_canister_filling.ic10 | 59 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/automated_canister_filling.ic10 b/automated_canister_filling.ic10 index f2c3c85..7210d8d 100644 --- a/automated_canister_filling.ic10 +++ b/automated_canister_filling.ic10 @@ -4,54 +4,51 @@ # analyzer is on a pipe between punps and tank # !!! Remember to set volume pump to 10l !!! -alias tank_storage d0 +alias tank_stor d0 alias fill_pump d1 alias evac_pump d2 alias analyzer d3 -alias tank_present r0 +alias tank_in r0 alias tank_hash r1 -alias storage_pressure r2 -alias gas_to_move r3 -alias fill_pressure r4 -alias pump_active r5 +alias stor_press r2 +alias gas_move r3 +alias fill_press r4 define canister_hash 42280099 define smart_canister_hash -668314371 start: -# check if canister is present -ls tank_present tank_storage 0 Occupied -# identify canister -ls tank_hash tank_storage 0 OccupantHash +ls tank_in tank_stor 0 Occupied # check tank in + +beqz tank_in evac +bgtz tank_in setpress + +evac: +l stor_press analyzer Pressure # get pipe pressure +s evac_pump On 1 # run evac_pump +s fill_pump On 0 # stop fill_pump +bgtz stor_press evac # pressure >0, evac more +# else, shut off evac_pump and go to start +s evac_pump On 0 +j start + +setpress: +ls tank_hash tank_stor 0 OccupantHash # ident tank # set safe fill-pressure beq tank_hash canister_hash regular beq tank_hash smart_canister_hash smart regular: -move fill_pressure 8000000 # regular tank safe max +move fill_press 8000000 # regular tank safe max j fill # start filling smart: -move fill_pressure 18000000 # smart tank safe max +move fill_press 18000000 # smart tank safe max j fill # start filling -fill: # fills tank if present and has room -# get tank pressure in Pa -ls storage_pressure tank_storage 0 Pressure -# is there room in the tank for more gas? -slt gas_to_move storage_pressure fill_pressure -# is there a tank in the slot that has room? -and pump_active gas_to_move tank_present -# trigger fill pump -s fill_pump On pump_active -beqz tank_present evac # break if no tank -j start - -evac: # evacuates pipe on tank removed and >0Pa -l storage_pressure analyzer Pressure -# is there gas in the pipe? -sgt gas_to_move storage_pressure 0 -# trigger evac pump -s evac_pump On gas_to_move -j start +fill: +ls stor_press tank_stor 0 Pressure # get tank press +slt gas_move stor_press fill_press # room for more? +s fill_pump On gas_move # trigger fill pump +j start \ No newline at end of file From 835ca77f5d623ff21ff773b98c2c420a4e8d4b6f Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Mon, 30 Aug 2021 14:10:37 +0200 Subject: [PATCH 6/7] Found some edge-cases that caused problems --- automated_canister_filling.ic10 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/automated_canister_filling.ic10 b/automated_canister_filling.ic10 index 7210d8d..6941551 100644 --- a/automated_canister_filling.ic10 +++ b/automated_canister_filling.ic10 @@ -19,19 +19,19 @@ define canister_hash 42280099 define smart_canister_hash -668314371 start: +s evac_pump On 0 # stop evac_pump +s fill_pump On 0 # stop fill_pump ls tank_in tank_stor 0 Occupied # check tank in - beqz tank_in evac bgtz tank_in setpress evac: +ls tank_in tank_stor 0 Occupied # check tank in +bgtz tank_in start l stor_press analyzer Pressure # get pipe pressure -s evac_pump On 1 # run evac_pump -s fill_pump On 0 # stop fill_pump -bgtz stor_press evac # pressure >0, evac more -# else, shut off evac_pump and go to start -s evac_pump On 0 -j start +beqz stor_press start # pressure =0, stop evac +s evac_pump On 1 +j evac setpress: ls tank_hash tank_stor 0 OccupantHash # ident tank @@ -48,7 +48,10 @@ move fill_press 18000000 # smart tank safe max j fill # start filling fill: +ls tank_in tank_stor 0 Occupied # check tank in +beqz tank_in start ls stor_press tank_stor 0 Pressure # get tank press slt gas_move stor_press fill_press # room for more? +bltz gas_move start # tank is full, go to start s fill_pump On gas_move # trigger fill pump -j start \ No newline at end of file +j fill \ No newline at end of file From f3d73f75fa422ae2228d59e41ee3c7d03528fb55 Mon Sep 17 00:00:00 2001 From: Snorre Selmer Date: Mon, 30 Aug 2021 17:28:11 +0200 Subject: [PATCH 7/7] script tested, works great --- storm_warning.ic10 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 storm_warning.ic10 diff --git a/storm_warning.ic10 b/storm_warning.ic10 new file mode 100644 index 0000000..c165d55 --- /dev/null +++ b/storm_warning.ic10 @@ -0,0 +1,41 @@ +# needs a Weather Station +# a siren and an announcer (2x Kit (Speaker)) +# and a display of some sort (Kit (Console)) + +alias weather d0 # Weather Station +alias readout d1 # Kit (Console) +alias announcer d2 # Kit (Speaker) +alias siren d3 # Kit (Speaker) + +alias storm_mode r0 +alias minutes r1 +alias siren_high r2 +alias siren_low r3 +alias siren_on r4 + +s announcer Mode 18 # "Storm Incoming!" +s siren Mode 10 # nice siren sound + +start: +l storm_mode weather Mode # check weather +s announcer On 0 # reset announcer +beq storm_mode 1 countdown # countdown if incoming +j start # else return to start + +countdown: +l storm_mode weather Mode # check weather +s announcer On 1 # announce storm +# get countdown value +l minutes weather NextWeatherEventTime +div minutes minutes 60 # convert to minutes +trunc minutes minutes # drop decimals +s readout Setting minutes # send to display +j warning + +warning: +sgt siren_high minutes 2 # got more than 2m59s? +slt siren_low minutes 1 # got less than 60s? +nor siren_on siren_high siren_low # sound siren? +s siren On siren_on # start siren if 1