Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SR line delay menu option and log line delay changes #1540

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,27 @@ export default {
this.editor.execCommand('replace')
},
},
{
label: 'Set Line Delay',
icon: 'mdi-invoice-text-clock',
disabled: this.scriptId,
command: () => {
this.$dialog.open({
title: 'Info',
text:
'You can set the line delay in seconds using the api method set_line_delay().<br/><br/>' +
'The default line delay is 0.1 seconds between lines. ' +
'Adding set_line_delay(0) to the top of your script will execute the script at maximum speed. ' +
'However, this can make it difficult to see and pause the script. ' +
'Executing set_line_delay(1) will cause a 1 second delay between lines.',
okText: 'OK',
okClass: 'primary',
validateText: null,
cancelText: null,
html: true,
})
},
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ export default {
(this.valueId.includes('PACKET_TIMEFORMATTED') ||
this.valueId.includes('RECEIVED_TIMEFORMATTED'))
) {
// Our dates have / rather than - which results in an invalid date on old browsers
// when they call new Date(value)
value = value.replaceAll('/', '-')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this on another program with an old browser

return this.formatUtcToLocal(new Date(value), this.timeZone)
}
// Convert json raw strings into the raw bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ def run_text(text,
unless close_on_complete
output = "Starting script: #{File.basename(@filename)}"
output += " in DISCONNECT mode" if $disconnect
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
Loading