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

Fix repeat of 0, O commands with larger integer values #1335

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

dymk
Copy link
Collaborator

@dymk dymk commented Sep 25, 2024

Two bugs that this fixes -

  1. o100 repeat [0] would fail. I think this was due to skipping being true by the time the parser got to the matching endrepeat, so it would effectively just end up skipping to the end of the file. The fix is to not check if we're skipping when we encounter an endrepeat I think, because we already check if the top of the stack is its matching repeat label.
  2. o300 if [1] would fail because the int value of 300 is cast to an int8_t, which is too small a type to contain 300. Upgraded int_value to int32_t to avoid this.

repeat tested with the following

--- (gcode ----
(print, start)
o100 repeat [0]
(print, fail repeat 0)
o100 endrepeat

#<count> = 0
o200 repeat [3]
#<count> = [#<count> + 1]
o200 endrepeat
(print, pass, count=%d#<count>)

o300 if [#<count> EQ 3]
(print, pass if)
o300 else
(print, fail if)
o300 endif

--- (output) ----
$LocalFS/Run=repeat.nc
ok
[MSG:INFO: PRINT, start]
[MSG:INFO: PRINT, pass, count=3]
[MSG:INFO: PRINT, pass if]

@dymk dymk merged commit 561006c into main Sep 26, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants