Add some print lines and a button to toggle terminal.

This commit is contained in:
Anna Rose 2021-07-19 21:36:04 -04:00
parent 642e5b17c5
commit d518d86bc2
3 changed files with 18 additions and 3 deletions

View File

@ -7,11 +7,13 @@ local t is BurnTime(n:MAG)/2.
lock STEERING to n:DELTAV.
wait until VectorAngle(SHIP:VELOCITY, STEERINGMANAGER:TARGET) <= 0.1.
print "Warping to node".
KUNIVERSE:WARP:WarpTo(n:TIME - t - 5).
wait until n:ETA <= t.
lock THROTTLE to 1.0.
wait until n:DELTAV:MAG <= 0.1.
wait until n:DELTAV:MAG <= 0.1. // todo: pid loop here or no?
unlock THROTTLE.
unlock STEERING.
print "Node Executed. Have a nice day."

View File

@ -11,7 +11,6 @@ parameter MINIMUM_PITCH is 5.
local ATMO_TWR is 1.6.
// Configure subsystems.
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
RCS off.
SAS off.

View File

@ -12,6 +12,17 @@ function nodeButtonPressed {
run "execnode".
}
local termOn is false.
function terminalButtonPressed {
if termOn {
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Close Terminal").
set termOn to false.
} else {
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
set termOn to true.
}
}
// Main UI.
local interface is gui(200).
set interface:X to 200.
@ -44,6 +55,9 @@ set launchButton:onClick to launchButtonPressed@.
local nodeButton is interface:AddButton("Execute Node").
set nodeButton:onClick to nodeButtonPressed@.
local termButton is interface:AddButton("Terminal").
set termButton:onClick to terminalButtonPressed@.
interface:show().
wait until false.