move post-quit code outside of mainloop
This commit is contained in:
22
main.lua
22
main.lua
@@ -1072,17 +1072,6 @@ function Main()
|
||||
if keys.getName(key) == "q" then
|
||||
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
|
||||
else
|
||||
return
|
||||
@@ -1093,6 +1082,17 @@ function Main()
|
||||
|
||||
parallel.waitForAny(do_sleep, getTerminateEvent)
|
||||
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
|
||||
|
||||
-- Run the main function when the script starts
|
||||
|
||||
Reference in New Issue
Block a user