From dd3d741cff10be641a0841f52df8ddfd0c9947f0 Mon Sep 17 00:00:00 2001 From: annabunches Date: Sun, 29 Aug 2021 17:27:34 -0400 Subject: [PATCH] Improve re-entry code so that it works properly over water. --- lib/reentry.ks | 9 ++++++--- prog/launchpad.ks | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/reentry.ks b/lib/reentry.ks index a716832..a77a8fd 100644 --- a/lib/reentry.ks +++ b/lib/reentry.ks @@ -10,6 +10,10 @@ function PerformReentry { SAS off. print "Reentry mode activated. Control permanently locked.". + + local normal is VCrs(SHIP:SRFPROGRADE:FOREVECTOR, SHIP:UP:FOREVECTOR). + lock STEERING to normal. + wait until Vang(SHIP:FACING:FOREVECTOR, normal) < 5. // stage until only stage 0 remains. until STAGE:NUMBER <= 1 { @@ -22,9 +26,8 @@ function PerformReentry { Antennas(false). } - when SHIP:ALTITUDE - SHIP:GEOPOSITION:TERRAINHEIGHT < 2500 then { - CHUTES on. - } + wait until SHIP:ALTITUDE - Max(SHIP:GEOPOSITION:TERRAINHEIGHT, 0) < 2500. + CHUTES on. wait until false. } diff --git a/prog/launchpad.ks b/prog/launchpad.ks index 17b8ea7..ba4a2b6 100644 --- a/prog/launchpad.ks +++ b/prog/launchpad.ks @@ -41,7 +41,7 @@ function preLaunch { InfoTone(). wait 2. - + local duration is options["Spool-up Time"]:TEXT:ToNumber(). lock THROTTLE to 0. stage.