move post-quit code outside of mainloop

This commit is contained in:
2026-06-29 20:49:41 -05:00
parent 06a10ff0f9
commit 1de102e132

View File

@@ -1072,17 +1072,6 @@ function Main()
if keys.getName(key) == "q" then if keys.getName(key) == "q" then
print("Quit Input Received") print("Quit Input Received")
for _, t in pairs(Thrusters) do
if t.type == "rotator" then
SetThrusterPower(t, 0.0)
peripheral.wrap(t.transmission).releaseSignal() -- release control of transmissions on quit
else
SetThrusterPower(t, 0.0)
end
end
WriteConfigFiles()
sentinel = false sentinel = false
else else
return return
@@ -1093,6 +1082,17 @@ function Main()
parallel.waitForAny(do_sleep, getTerminateEvent) parallel.waitForAny(do_sleep, getTerminateEvent)
end end
for _, t in pairs(Thrusters) do
if t.type == "rotator" then
SetThrusterPower(t, 0.0)
peripheral.wrap(t.transmission).releaseSignal() -- release control of transmissions on quit
else
SetThrusterPower(t, 0.0)
end
end
WriteConfigFiles()
end end
-- Run the main function when the script starts -- Run the main function when the script starts