Skip to content

Conversation

@xloem
Copy link
Owner

@xloem xloem commented May 10, 2023

jminardi#75

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.

@xloem xloem merged commit 459fa80 into xloem:main May 10, 2023
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.

1 participant