Skip to content

Process Execution ​

Process Execution saves a sequence of operations and runs them in order. A process can send commands, wait for the device to respond, and choose the next step based on the result. The result of each step is recorded in the execution log.

Process settings are also saved by group, and each group is one JSON configuration file. A group has two levels:

  • Step group: Groups related steps together, for example "Init" or "Read Parameters".
  • Step item: One step. It holds the data to send, a delay, and an optional comparison.

During execution, the program runs the step items in the order of their step groups.

Open Process Execution ​

Open the Process Execution panel in the device window to see the execute view. The Edit button (…) at the top of the panel opens the process editor.

Manage groups ​

The Select group drop-down at the top left of the editor lists all groups. You can:

  • Refresh: Reload the group list.
  • New group: Create a group named "Process 1", "Process 2", and so on.
  • Delete group: Delete the current group's configuration file. A confirmation dialog appears first.
  • Rename: Edit the name in the drop-down list and press Enter. The file is renamed to match.

If no group exists, the program creates a group named Default automatically.

Edit steps ​

The tree on the left of the editor lists the groups and steps. The panel on the right shows the settings for the selected node. When a step group is selected, you can change its Step group name and click Save to apply it.

Right-click a node in the tree to use these menu items:

Menu itemAvailable onFunction
Add Step GroupRoot nodeAdd a new step group at the end
Add Step ItemStep groupAdd a new step item at the end of that step group
CopyStep group, step itemPut the node on the clipboard
CutStep group, step itemSame as Copy, but the original node is deleted only after a successful paste. A cut can be pasted only once
PasteStep group (clipboard holds a step item), root node (clipboard holds a step group)Add the clipboard content at the end
InsertStep group (clipboard holds a step group), step item (clipboard holds a step item)Insert the clipboard content before the selected node
DeleteStep group, step itemDelete the node. A confirmation dialog appears first

Step item settings ​

When a step item is selected, these settings appear on the right. Click Save to apply your changes.

SettingDescription
Step nameThe name shown in the execute list
Send dataThe content sent when the step runs. You can use {variable} placeholders. The button on the right inserts a variable
Pop up input dialogWhen checked, an input dialog appears when the step runs. The Send data value is the default text. When checked, the Send data box is disabled
Delay (ms)How long to wait after sending, in milliseconds
Byte orderThe byte order used when a numeric variable is sent in HEX mode (big-endian or little-endian)
Compare, Comparison formulaWhen checked, the formula is evaluated after the delay. Its result decides whether the step passed or failed. See below
On pass jump toThe next step after success. Default: "Next step"
On fail jump toThe next step after failure. Default: "Next step"

A jump target can be "Next step", "End", or any step in the process.

A new step item must be saved once

A new step item stays incomplete until you save it for the first time. Incomplete steps are skipped during execution.

Comparison formula ​

The formula decides whether a step passes. Use {variable} to reference a variable from Global Variables. At run time, the placeholder is replaced with the variable's current value.

The formula is a Lua 5.4 expression, evaluated once each time the step runs. Before evaluation, the program converts some operators and provides the functions of the Lua standard library. For example, {voltage} >= 3.0 && {voltage} <= 3.6 passes when the variable voltage is between 3.0 and 3.6.

Operator conversion ​

The following forms are converted to Lua syntax before evaluation:

You writeConverted toDescription
!=~=Not equal
&&andLogical AND
||orLogical OR
!notLogical NOT
+ between strings..A + next to a string literal or string variable becomes concatenation, for example "v" + {name}

Lua forms such as ==, >, >=, <, <=, ~=, and, or, not, .., and # work directly. A + between numbers is still addition.

Symbols inside strings are also replaced

The conversion runs on the whole formula text, so !, &&, and || inside string literals are replaced too. For example, "Hi!" becomes "Hi not ". Avoid these symbols inside strings.

Variable substitution ​

Before evaluation, each {variable} is replaced with the variable's current value:

  • A numeric variable is replaced with a number. If its value is not a valid number, it is replaced with 0.
  • A string variable is replaced with a double-quoted string. Quotes and backslashes are escaped.
  • A Boolean variable is replaced with true or false. An empty value, 0, or false gives false. Any other value gives true.

Variable names may contain only letters, digits, and underscores. A brace pair that contains a single name, such as {1}, is also treated as a variable placeholder, and an error occurs if no such variable exists.

Available functions ​

The engine loads all standard libraries of Lua 5.4.2, including math, string, table, utf8, os, and io. Common examples:

FunctionExampleDescription
math.abs(x)math.abs({offset}) <= 0.5Absolute value
math.floor(x), math.ceil(x)math.floor({value}) == 10Round down, round up
math.max(...), math.min(...)math.max({a}, {b}) < 100Maximum, minimum
math.sqrt(x)math.sqrt({area}) > 2Square root
string.len(s) or #s#{text} == 4String length
string.sub(s, i, j)string.sub({code}, 1, 2) == "AB"Substring. Positions start at 1
string.find(s, p)string.find({msg}, "OK") ~= nilFinds a substring. Returns the position, or nil if not found
string.format(fmt, ...)string.format("%.1f", {v}) == "3.3"Formats a value as a string
tonumber(s)tonumber({text}) > 10Converts a string to a number, or returns nil if conversion fails

Evaluation rules ​

  • Each evaluation creates a new Lua environment. Global variables and functions defined earlier are not kept.
  • The formula must be a single expression. The program wraps it as _RESULT_ = <formula>; return _RESULT_, so local, assignment statements, and multiple statements are not allowed.
  • Output from print does not appear in the execution log. Do not use it for debugging.
  • The program also registers Qt bridge functions such as invokeMethod and getProperty. The formula has no Qt objects it can access, so these functions have no practical use here.

Pass or fail ​

  • The step fails if the result is the number 0 (including 0.0), the Boolean false, nil, or the string "0" or "false".
  • All other results pass, including true, non-zero numbers, and empty strings.
  • If the formula raises a runtime error, for example by comparing nil, the step fails and the execution log shows the error.

Results from and and or

and and or return one of their operands, which is not always a Boolean. For example, with {a} > 1 and 5, the result is 5 when {a} is greater than 1, and the step passes. Otherwise the result is false, and the step fails.

Checks on save ​

When you save a step, the program runs the converted formula once to check its syntax and variables. Functions with side effects, such as os.execute or io.open, therefore run at save time. A formula with a syntax error, or one that references a missing variable, cannot be saved.

Use only trusted formulas

A formula can call the os and io libraries, for example to read or write files or run system commands. Use only process files that you wrote or have reviewed.

Run a process ​

The execute view contains these elements:

  • Process drop-down: Selects the process to run.
  • Edit (…) and Refresh (…) buttons: Open the editor, or reload the process list.
  • Step list: Each row is one step, shown in three columns:
    • Breakpoint column: Click to add or remove a breakpoint. A breakpoint shows as a red ●.
    • Execution column: The step that is running shows →.
    • Name column: Shows "number.name". A step with a jump shows ↪ after its name. Hover over it to see the jump targets. Unchecked or incomplete steps appear gray.
  • Execution log: Records the start and result of each step, and the overall result of the process. The log is cleared each time you start from the first step.
  • Control buttons: Start, Pause, Stop, Step.
ButtonFunction
StartRuns from the first step. After a pause, the button changes to "Continue" and resumes from where the process paused
PausePauses after the current step finishes, including its delay
StopEnds the process and interrupts any delay in progress. Clicking Start again runs from the first step
StepAvailable only when paused. Advances the process one step at a time

Breakpoints ​

Click the breakpoint column to set a breakpoint. When execution reaches that step, it pauses before the step runs. Click Continue to run the step. Breakpoints are cleared when you switch to another process file.

Execution rules ​

  1. Step items run in the order of their step groups.
  2. An unchecked or incomplete step is skipped and recorded as "skipped". Execution then moves to the next step. A skipped step does not trigger a jump.
  3. To run a step, the program does the following in order:
    1. If Pop up input dialog is checked, it shows an input dialog. The entered text is sent as the data. If the input is empty or you cancel, the process ends.
    2. It sends the data. Variables are replaced with their current values, and the same rules as the send area apply (HEX sending and checksum). If the data is empty, nothing is sent, and only the delay and comparison run.
    3. It waits for the delay.
    4. If Compare is checked, it evaluates the formula.
    5. It marks the step as passed or failed.
  4. A passed step jumps to its On pass jump to target. A failed step jumps to its On fail jump to target. A jump to "End" ends the process immediately.

When the process ends, the log shows the number of passed, failed, and skipped steps.

Notes ​

Editing is locked while running

While a process runs, the execute view cannot switch process files, and the Edit button is disabled. If a device is running a process file, the editor locks its steps and blocks deletion and renaming.

  • Changes made in the editor are written to the file only after you click Save. Unsaved changes do not affect execution.
  • When you save while a device is running the process, the program asks whether to stop it first. The file is saved and refreshed only after you confirm.