How do I make the current program abort on my command?

Tags
Question

6 Comments

  • Log in to leave a comment
  • Profile image

    Understood, the question can be considered closed

    4.7 years ago
  • Profile image
    Mod sflanker

    There is no one command that will abort any running program. The correct way to abort will depend on how your program is structured. You will need to break out of any running loops or wait until instructions, including those in event receivers, and stop execution from continuing after those instructions exit. One thing to note is that the break instruction can be used both to exit a while loop, and to exit a thread (a series of instructions connected to either a start block or a receive block). This can prevent you from having to have many nested if blocks if you have threads that have multiple successive loops. Without seeing your actual program it's hard to say how much of this you will have to worry about.

    There are also multiple ways to provide input to your program, but as @PointBreak points out, activation groups are a good one.


    Also, FYI, I investigated the possibility of simply deactivating the command pod that contains the running program, but unfortunately Flight Programs continue to run on command pods that are deactivated! I think it would be a good suggestion for a Flight Program to terminate when a command pod is deactivated, and when it is reactivated the Flight Program should "reboot" as if the craft just launched.

    Update: suggestion added: https://www.simplerockets.com/Feedback/View/yiIo3i/Flight-programs-should-terminate-when-the-command-pod-or-command-chip-they-are-ru

    4.7 years ago
  • Profile image

    @PointBreak You can show another example, but without variables

    4.7 years ago
  • Profile image
    1,092 PointBreak

    Like, this little program does its thing , but if you activate AG1 it stops.

    4.7 years ago
  • Profile image

    @PointBreak Could you tell me more about it?

    4.7 years ago
  • Profile image
    1,092 PointBreak

    Maybe have a while(AG1 off), and if/when you wanna abort, activate AG1

    4.7 years ago

1 Upvote

Log in in to upvote this post.