Skip to content

Commit

Permalink
Add python
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Sep 14, 2024
1 parent 88ce536 commit 676b2df
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions openc3-cosmos-script-runner-api/app/models/running_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ def self.line_delay
end

def self.line_delay=(value)
@@instance.scriptrunner_puts("set_line_delay(#{value})")
@@line_delay = value
end

Expand Down Expand Up @@ -1108,7 +1107,7 @@ def run_text(text,
unless close_on_complete
output = "Starting script: #{File.basename(@filename)}"
output += " in DISCONNECT mode" if $disconnect
output += "\nget_line_delay() #=> #{@@line_delay}"
output += ", line_delay = #{@@line_delay}"
scriptrunner_puts(output)
end
handle_output_io()
Expand Down
1 change: 1 addition & 0 deletions openc3-cosmos-script-runner-api/scripts/running_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ def run_thread_body(
output = f"Starting script: {os.path.basename(self.filename)}"
if RunningScript.disconnect:
output += " in DISCONNECT mode"
output += f", line_delay = {RunningScript.line_delay}"
self.scriptrunner_puts(output)
self.handle_output_io()

Expand Down
5 changes: 3 additions & 2 deletions openc3/lib/openc3/script/api_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,9 @@ def disable_instrumentation
end

def set_line_delay(delay)
if defined? RunningScript
RunningScript.line_delay = delay if delay >= 0.0
if defined? RunningScript and delay >= 0.0
RunningScript.line_delay = delay
puts "set_line_delay(#{delay})"
end
end

Expand Down
1 change: 1 addition & 0 deletions openc3/python/openc3/script/api_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ def disable_instrumentation():
def set_line_delay(delay):
if openc3.script.RUNNING_SCRIPT and delay >= 0.0:
openc3.script.RUNNING_SCRIPT.line_delay = delay
print(f"set_line_delay({delay})")


def get_line_delay():
Expand Down

0 comments on commit 676b2df

Please sign in to comment.