This nearly mostly works!

This commit is contained in:
Kenwood 2021-04-11 22:22:06 -04:00
parent 88250d0170
commit 6b5b88286b
4 changed files with 58 additions and 0 deletions

35
RadarrSeries/boot.ks Normal file
View File

@ -0,0 +1,35 @@
// Written based off CheersKevin's youtube series
// On programming in KOS
// This script is the boot script for the Radarr
// series of surface scanning probes.
// This method prints in big letters something on the screen.
FUNCTION NOTIFY {
PARAMETER message.
PARAMETER duration IS 5.
PARAMETER color IS WHITE.
HUDTEXT("kOS: " + message, duration, 2, 50, color, false).
PRINT message.
}
NOTIFY("Boot sequence complete, prepare to load and compile the flight scripts.").
IF true { // Set this to false to avoid compiling ascent code.
COMPILE "0:/RadarrSeries/radarr_kerbin.ks" TO "1:/ascent.ksm". // Compile the flight code into a ksm object.
} ELSE {
COPYPATH("0:/RadarrSeries/radarr_kerbin.ks", "1:/ascent.ks"). // Copy over our launch script from the archive at ksc
}
// I changed this!
NOTIFY("Program compiled and ready to run.").
IF alt:radar < 100 { // If our radar alt is lower than 10
WAIT 5.
RUN ascent.ks. // Run the ascent stage!
} ELSE {
NOTIFY("System booted but did not pass pre-flight checks, aborting excecution!").
}

View File

@ -30,6 +30,8 @@ IF true { // Set this to false to avoid compiling ascent code.
COPYPATH("0:/RadarrSeries/radarr_kerbin.ks", "1:/ascent.ks"). // Copy over our launch script from the archive at ksc COPYPATH("0:/RadarrSeries/radarr_kerbin.ks", "1:/ascent.ks"). // Copy over our launch script from the archive at ksc
} }
// I changed this!
NOTIFY("Program compiled and ready to run."). NOTIFY("Program compiled and ready to run.").
IF alt:radar < 100 { // If our radar alt is lower than 10 IF alt:radar < 100 { // If our radar alt is lower than 10

18
boot/tagBoot.ks Normal file
View File

@ -0,0 +1,18 @@
// Idea from JonnyOThan#0171
// On the kOS discord.
WAIT UNTIL ship:unpacked.
CLEARSCREEN.
// This line from CheersKevin on youtube
core:part:getmodule("kOSProcessor"):doevent("Open Terminal"). // Open the terminal on boot!
PRINT "Using TagBoot ver 1.0".
WAIT 5.
PRINT "Booting with tag " + core:part:tag + "...".
WAIT 5.
// reddit says the path cant be fully qualified (no 0:/)
COPYPATH("0:/" + core:part:tag + "/boot.ks", "1:/boot/boot.ks").
set core:bootfilename to "/boot/boot.ks".
reboot. // Reboot the FC

View File

@ -1,3 +1,6 @@
// A general abort script that prepares kOS to give up control of the rocket, and excecute the abort script. // A general abort script that prepares kOS to give up control of the rocket, and excecute the abort script.
PRINT "Program tried to abort but we dident write code to do that!". PRINT "Program tried to abort but we dident write code to do that!".
LOCK THROTTLE TO 0. // Throttle back
SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. // Protects the throttle from "jumping" when we hand control back to the pilot