Skip to content

Conversation

@fake-name
Copy link
Contributor

@fake-name fake-name commented Jan 6, 2022

Effectively the title.

LinuxCNC (and Tormach, as a result) have some fancy gcode features that REQUIRE parenthesis comments. This patch lets you use parenthesis by moving the comment formatting into it's own function.

Also, there are shorthand functions for emitting M00 (optional comment) and M01 (optional comment) gcode, as well as just inserting a comment as it's own line.

Tests are mostly passing. The test_printer calls seem to require a device to be connected (even with mock installed).

One of the matrix tests is also failing:

======================================================================
FAIL: test_multiple_matrix_operations (test_matrix.TestGMatrix)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Code\mecode\mecode\tests\test_matrix.py", line 63, in test_multiple_matrix_operations
    self.assert_output()
  File "C:\Code\mecode\mecode\tests\test_main.py", line 53, in assert_output
    self.assertListEqual(lines, self.expected)
AssertionError: Lists differ: ['G91[60 chars]00000', 'G1 X5.000000 Y0.000000', 'G1 X0.000000 Y-10.000000'] != ['G91[60 chars]00000', 'G1 X5.000000 Y-0.000000', 'G1 X-0.000000 Y-10.000000']

First differing element 3:
'G1 X5.000000 Y0.000000'
'G1 X5.000000 Y-0.000000'

  ['G91 ; relative',
   'G1 X-5.000000 Y0.000000',
   'G1 X0.000000 Y10.000000',
-  'G1 X5.000000 Y0.000000',
+  'G1 X5.000000 Y-0.000000',
?                 +

-  'G1 X0.000000 Y-10.000000']
+  'G1 X-0.000000 Y-10.000000']
?       +

but that just looks like a floating point weirdness that's not /really/ a problem, probably some vague difference in platform math libraries. It does mean that it'd probably be best to allow a epsilon error on the matrix test results, but implementing that would be a major pain (you'd have to parse the generated gcode to extract the actual values).

I also ran into the fact that efd_pico_pulse.py had mixed indentation (spaces/tabs) when trying to run the tests (sidenote: python setup.py test tries to import everything, but didn't actually run any tests). I'm assuming that file hasn't been touched since python 2. Anyways, I fixed that.

Connor Wolf added 5 commits January 5, 2022 20:49
@fake-name
Copy link
Contributor Author

I'm tempted to just coerce negative values smaller then the output formatting epsilon to zero. That would fix the weirdness which is outputting -0.

@fake-name
Copy link
Contributor Author

Oh, I forgot. there's also facilities in there for moving a 4th axis. Nothing to do with coordinated motion, but move_other_axis() is present and supports feed and rapid motion.

@xloem
Copy link
Collaborator

xloem commented May 10, 2023

I've merged this PR into https://github.com/xloem/mecode . Tests all pass after I removed some spurious whitespace from the expected output. The repository has automatic pull request merging enabled for the future.

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