From f6731b0ab0f40e2ad7539a2ff5a3be23da06eaaf Mon Sep 17 00:00:00 2001 From: annabunches Date: Mon, 26 Jul 2021 15:13:03 -0400 Subject: [PATCH] Clean up UI and add TWR-lock that continues to give control over navigation. --- rocket/init.ks | 56 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/rocket/init.ks b/rocket/init.ks index 4fdd416..4b906c5 100644 --- a/rocket/init.ks +++ b/rocket/init.ks @@ -1,4 +1,5 @@ runoncepath("/lib/navigation"). +runoncepath("/lib/throttle"). function launchButtonPressed { // adjust torque settings here... @@ -54,14 +55,16 @@ set x:AddButton("NODE"):onClick to { run "/execnode". }. +set x:AddButton("TWR"):onClick to { + stk:ShowOnly(twrMenu). +}. + + local stk is interface:AddStack(). // Build launch menu local launchMenu is stk:AddVLayout(). -set btn to launchMenu:AddButton("Execute"). -set btn:onClick to launchButtonPressed@. - local launchConfig is launchMenu:AddScrollBox(). set sbox to launchConfig:AddHLayout(). @@ -88,23 +91,52 @@ set sbox to launchConfig:AddHLayout(). sbox:AddLabel("Gravity Turn Pitch"). local gravPitch is sbox:AddTextField("75"). -launchConfig:AddSpacing(5). - -set sbox to launchConfig:AddHLayout(). -sbox:AddLabel("Torque Epsilon Max"). -local maxEpsilon is sbox:AddTextField("0.001"). - -set sbox to launchConfig:AddHLayout(). -sbox:AddLabel("Max Stopping Time"). -local maxStopTime is sbox:AddTextField("2.0"). +set btn to launchMenu:AddButton("Execute"). +set btn:onClick to launchButtonPressed@. // End Launch Menu // Build conf menu +local confMenu is stk:AddVLayout(). +local confBox is confMenu:AddScrollbox(). + +set sbox to confBox:AddHLayout(). +sbox:AddLabel("Torque Epsilon Max"). +local maxEpsilon is sbox:AddTextField("0.001"). + +set sbox to confBox:AddHLayout(). +sbox:AddLabel("Max Stopping Time"). +local maxStopTime is sbox:AddTextField("2.0"). + +set btn to confMenu:AddButton("Apply"). +set btn:onClick to { + set STEERINGMANAGER:TORQUEEPSILONMAX to maxEpsilon:TEXT:ToNumber(). + set STEERINGMANAGER:MAXSTOPPINGTIME to maxStopTime:TEXT:ToNumber(). +}. // end conf menu +// twr menu +local twrMenu is stk:AddVLayout(). + +set sbox to twrMenu:AddHLayout(). +sbox:AddLabel("Target TWR"). +local twrLock is sbox:AddTextField("1.6"). + +set twrMenu:AddButton("Lock TWR"):onClick to { + local done is false. + on AG9 { + set done to true. + } + + local tgt is twrLock:TEXT:ToNumber(). + lock THROTTLE to ThrottleToTWR(tgt). + wait until done. +}. + +// end twr menu + interface:show(). wait until false.