Reorganize code files.

This commit is contained in:
Anna Rose 2021-07-22 21:42:34 +00:00
parent c7438fcfe7
commit 41438700ad
4 changed files with 15 additions and 28 deletions

View File

@ -7,9 +7,9 @@ deletepath("/boot/rocket").
// Install software.
compile "0:/lib/navigation" to "1:/lib/navigation".
compile "0:/lib/throttle" to "1:/lib/throttle".
compile "0:/ui/rocket" to "1:/init".
compile "0:/launch" to "1:/launch".
copypath("0:/execnode", "1:/execnode"). // larger when compiled
compile "0:/rocket/ui" to "1:/init".
compile "0:/rocket/launch" to "1:/rocket/launch".
copypath("0:/rocket/execnode", "1:/rocket/execnode"). // larger when compiled
// Set OS to boot and restart.
set core:bootfilename to "/init".

View File

@ -1,4 +1,3 @@
// runoncepath("lib/sensors").
runoncepath("lib/throttle").
runoncepath("lib/navigation").
@ -48,10 +47,6 @@ wait until vectorangle(
// then wait until Prograde catches up (or passes us).
local targetPitch is GetPitch(STEERINGMANAGER:TARGET:FOREVECTOR).
wait until GetPitch(SHIP:SRFPROGRADE:FOREVECTOR) <= targetPitch.
// wait until vectorangle(
// SHIP:SRFPROGRADE:FOREVECTOR,
// STEERINGMANAGER:TARGET:FOREVECTOR)
// < 0.5.
print "Locking to prograde, letting gravity do the hard work.".
lock STEERING to GetAscentVector(MINIMUM_PITCH).
@ -66,10 +61,8 @@ wait 0.001. // make sure these control updates get applied
print "Target apoapsis acquired. Creating maneuver node.".
add CreateCircularizationNode().
runpath("/execnode").
runpath("/rocket/execnode").
print "Orbit acquired. Releasing controls. Good luck, Kerman.".
unlock THROTTLE.
unlock STEERING.
SAS on.
// todo - automatically execute the node

View File

@ -8,7 +8,7 @@ function launchButtonPressed {
local oldStopTime is STEERINGMANAGER:MAXSTOPPINGTIME.
set STEERINGMANAGER:MAXSTOPPINGTIME to maxStopTime:TEXT:ToNumber().
run "launch"(
run "/rocket/launch"(
targetApo:TEXT:ToNumber(),
gravTurnStart:TEXT:ToNumber(),
gravPitch:TEXT:ToNumber(),
@ -21,7 +21,7 @@ function launchButtonPressed {
}
function executeNode {
run "execnode".
run "/rocket/execnode".
}
function showLaunchMenu {
@ -34,7 +34,7 @@ set interface:X to 200.
set interface:Y to 700.
// Main menu elements in here.
local box is interface:AddVBox().
local box is interface:AddVLayout().
local btn is box:AddButton("TERM").
set btn:TOGGLE to true.
@ -51,9 +51,6 @@ set btn:ONTOGGLE to {
set btn to box:AddButton("LAUNCH").
set btn:onClick to showLaunchMenu@.
set btn to box:AddButton("CIRC").
set btn:onClick to { add CreateCircularizationNode(). }.
set btn to box:AddButton("EXECNODE").
set btn:onClick to executeNode@.
@ -69,37 +66,37 @@ local launchConfig is box:AddScrollBox().
// set launchConfig:STYLE:WIDTH to 300.
// set launchConfig:STYLE:HEIGHT to 800.
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Target Apoapsis").
local targetApo is sbox:AddTextField("80000").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Atmo TWR").
local targetTWR is sbox:AddTextField("1.6").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Initial Pitch").
local initialPitch is sBox:AddTextField("85").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Minimum Pitch").
local minimumPitch is sbox:AddTextField("5").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Gravity Turn Alt").
local gravTurnStart is sbox:AddTextField("8000").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Gravity Turn Pitch").
local gravPitch is sbox:AddTextField("75").
launchConfig:AddSpacing(5).
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Torque Epsilon Max").
local maxEpsilon is sbox:AddTextField("0.001").
set sbox to launchConfig:AddHBox().
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Max Stopping Time").
local maxStopTime is sbox:AddTextField("2.0").
@ -107,7 +104,4 @@ local maxStopTime is sbox:AddTextField("2.0").
interface:show().
wait until false.