Merge pull request #48 from Jazzmax/comments

Allow #comment lines in macros. Updated the Macros documentation.
This commit is contained in:
Reece Walsh 2023-06-29 11:57:50 -07:00 committed by GitHub
commit ce99f59cb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -43,6 +43,30 @@ L_STICK@+000+000 0.75s
1.0s
```
### Loops
A simple for-loop can be used to repeat a macro block a specified number of times. The below example loops through an indented macro block 100 times.
```
LOOP 100
B 0.1s
0.1s
```
Nested loops are also supported.
```
LOOP 100
B 0.1s
0.1s
# Nested loop
LOOP 5
A 0.1s
0.1s
```
Note, a macro line starting with `#` is ignored.
## Macro Control Values
| Macro Value | Control Name |

View file

@ -307,6 +307,7 @@ class InputParser():
parsed = macro.split("\n")
parsed = list(filter(lambda s: not s.strip() == "", parsed))
parsed = list(filter(lambda s: not s.strip().startswith("#"), parsed))
parsed = self.parse_loops(parsed)
return parsed