2021-07-21 09:24:46 +00:00
|
|
|
runoncepath("/lib/navigation").
|
|
|
|
|
2021-07-18 23:32:45 +00:00
|
|
|
function launchButtonPressed {
|
2021-07-21 09:24:46 +00:00
|
|
|
// adjust torque settings here...
|
|
|
|
local oldEpsilon is STEERINGMANAGER:TORQUEEPSILONMAX.
|
|
|
|
set STEERINGMANAGER:TORQUEEPSILONMAX to maxEpsilon:TEXT:ToNumber().
|
|
|
|
|
|
|
|
local oldStopTime is STEERINGMANAGER:MAXSTOPPINGTIME.
|
|
|
|
set STEERINGMANAGER:MAXSTOPPINGTIME to maxStopTime:TEXT:ToNumber().
|
|
|
|
|
2021-07-23 20:04:26 +00:00
|
|
|
run "/launch"(
|
2021-07-19 07:43:07 +00:00
|
|
|
targetApo:TEXT:ToNumber(),
|
|
|
|
gravTurnStart:TEXT:ToNumber(),
|
2021-07-19 08:46:05 +00:00
|
|
|
gravPitch:TEXT:ToNumber(),
|
|
|
|
initialPitch:TEXT:ToNumber(),
|
|
|
|
minimumPitch:TEXT:ToNumber()
|
2021-07-19 04:54:32 +00:00
|
|
|
).
|
2021-07-21 09:24:46 +00:00
|
|
|
|
|
|
|
set STEERINGMANAGER:TORQUEEPSILONMAX to oldEpsilon.
|
|
|
|
set STEERINGMANAGER:MAXSTOPPINGTIME to oldStopTime..
|
2021-07-18 23:32:45 +00:00
|
|
|
}
|
|
|
|
|
2021-07-19 08:46:05 +00:00
|
|
|
// Main UI.
|
2021-07-21 09:24:46 +00:00
|
|
|
local interface is gui(250, 300).
|
2021-07-19 07:43:07 +00:00
|
|
|
set interface:X to 200.
|
2021-07-21 09:24:46 +00:00
|
|
|
set interface:Y to 700.
|
2021-07-18 23:32:45 +00:00
|
|
|
|
2021-07-21 09:24:46 +00:00
|
|
|
// Main menu elements in here.
|
2021-07-22 22:29:18 +00:00
|
|
|
local y is interface:AddVLayout().
|
|
|
|
local x is y:AddHLayout().
|
2021-07-19 04:54:32 +00:00
|
|
|
|
2021-07-22 22:29:18 +00:00
|
|
|
local btn is x:AddButton("TERM").
|
2021-07-21 09:24:46 +00:00
|
|
|
set btn:TOGGLE to true.
|
|
|
|
set btn:ONTOGGLE to {
|
|
|
|
parameter activate.
|
2021-07-19 08:46:05 +00:00
|
|
|
|
2021-07-21 09:24:46 +00:00
|
|
|
if activate {
|
|
|
|
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
|
|
|
} else {
|
|
|
|
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Close Terminal").
|
2021-07-22 22:29:18 +00:00
|
|
|
}
|
2021-07-21 09:24:46 +00:00
|
|
|
}.
|
2021-07-19 04:54:32 +00:00
|
|
|
|
2021-07-22 22:29:18 +00:00
|
|
|
set x:AddButton("CONF"):onClick to {
|
|
|
|
stk:ShowOnly(confMenu).
|
|
|
|
}.
|
2021-07-19 04:54:32 +00:00
|
|
|
|
2021-07-22 22:29:18 +00:00
|
|
|
set x to y:AddHLayout().
|
|
|
|
|
|
|
|
set x:AddButton("LNCH"):onClick to {
|
|
|
|
stk:ShowOnly(launchmenu).
|
|
|
|
}.
|
|
|
|
set x:AddButton("NODE"):onClick to {
|
2021-07-23 20:04:26 +00:00
|
|
|
run "/execnode".
|
2021-07-22 22:29:18 +00:00
|
|
|
}.
|
2021-07-19 04:54:32 +00:00
|
|
|
|
2021-07-21 09:24:46 +00:00
|
|
|
local stk is interface:AddStack().
|
2021-07-19 07:43:07 +00:00
|
|
|
|
2021-07-22 22:29:18 +00:00
|
|
|
// Build launch menu
|
2021-07-21 09:24:46 +00:00
|
|
|
local launchMenu is stk:AddVLayout().
|
2021-07-20 01:36:04 +00:00
|
|
|
|
2021-07-21 09:24:46 +00:00
|
|
|
set btn to launchMenu:AddButton("Execute").
|
|
|
|
set btn:onClick to launchButtonPressed@.
|
|
|
|
|
|
|
|
local launchConfig is box:AddScrollBox().
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Target Apoapsis").
|
|
|
|
local targetApo is sbox:AddTextField("80000").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Atmo TWR").
|
|
|
|
local targetTWR is sbox:AddTextField("1.6").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Initial Pitch").
|
|
|
|
local initialPitch is sBox:AddTextField("85").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Minimum Pitch").
|
|
|
|
local minimumPitch is sbox:AddTextField("5").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Gravity Turn Alt").
|
|
|
|
local gravTurnStart is sbox:AddTextField("8000").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Gravity Turn Pitch").
|
|
|
|
local gravPitch is sbox:AddTextField("75").
|
|
|
|
|
|
|
|
launchConfig:AddSpacing(5).
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Torque Epsilon Max").
|
|
|
|
local maxEpsilon is sbox:AddTextField("0.001").
|
|
|
|
|
2021-07-22 21:42:34 +00:00
|
|
|
set sbox to launchConfig:AddHLayout().
|
2021-07-21 09:24:46 +00:00
|
|
|
sbox:AddLabel("Max Stopping Time").
|
|
|
|
local maxStopTime is sbox:AddTextField("2.0").
|
|
|
|
|
|
|
|
// End Launch Menu
|
2021-07-20 06:38:29 +00:00
|
|
|
|
2021-07-22 22:29:18 +00:00
|
|
|
// Build conf menu
|
|
|
|
|
|
|
|
|
|
|
|
// end conf menu
|
|
|
|
|
2021-07-18 23:32:45 +00:00
|
|
|
interface:show().
|
|
|
|
|
|
|
|
wait until false.
|