Skip to content

Conversation

@classicrocker883
Copy link
Contributor

@classicrocker883 classicrocker883 commented Mar 20, 2025

Description

Update Python scripts with exception to \buildroot\bin\use_example_configs.

Some changes are simple, like remove a typo or import [missing module].

Any formal formatting has moved here #27503.

  • Added debug info
  • Updated pinsformat.py with some "-h"/"--help" options.
  • Updated schema.py, "-h"/"--help" gave "Unknown Option".
  • Removed languageUtil.py, moved to languageExport.py.
  • Improved g29_auto.py, which removed errors, added color in print() messages + debugging, also include G0 moves.
  • Updated svg2cpp.py, had typo and errors, plus outdated instructions, and it now automatically outputs a file utilizing the header.

Requirements

Benefits

Configurations

Related Issues

Unsure About:

  • In g29_auto.py, is this meant to read G-code files with lowercase commands?
g29_keyword = 'g29'
g29_keyword = g29_keyword.upper()

- fix this error in share/scripts/g29_auto.py:

"None" is not iterable
  "__iter__" method not defined

    while len(gcode) > i:
-       try:
-           z, i = find_z(gcode, i + 1)
-       except TypeError:
-           break

    while len(gcode) > i:
+       result = find_z(gcode, i + 1)

+       if result is None:
+           break

+       z, i = result
-start, end = get_lines(gcode, min_g1)

+layer_range = get_lines(gcode, min_g1)

+if layer_range is None:
+   print("Error: Unable to determine layer range. Exiting.")
+   exit(1)

+start, end = layer_range

Note

Doesnt have to say "Error: Unable to determine layer range. Exiting." per say, or to exit,
but its suggested


also, near the end of this file, you will see

out_file = open(output_file, 'w')
in_file = open(input_file, 'r')

# other code ....

file.close()
out_file.close()

previously, file.close() should be in_file.close(), but the code has since been improved.



  • In pinsformat.py, is this correct?
    src_file = args.infile or 'stdin'
    dst_file = args.outfile or None

This was added along with argparse to add "help".
Also, I'm unsure of what the purpose is when running
the file with no arguments, because it stalls.
so with Ctrl+C:

 line 76, in format_pins
    file_text = sys.stdin.read()
                ^^^^^^^^^^^^^^^^
KeyboardInterrupt 
________________________
and debugging gives me :

FileNotFoundError: [Errno 2] No such file or directory: 'stdin'

@classicrocker883
Copy link
Contributor Author

classicrocker883 commented Mar 20, 2025

@thinkyhead i noticed Marlin\src\HAL\LPC1768\upload_extra_script.py could possibly be moved like we did with STM32F1_build_flags.py

also, see Related Issues

@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 3 times, most recently from 4354891 to efa1758 Compare March 28, 2025 01:57
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 3 times, most recently from 3791e7d to 6ea4a16 Compare June 2, 2025 21:51
@thinkyhead thinkyhead added PR: Improvement T: Development Makefiles, PlatformIO, Python scripts, etc. labels Aug 13, 2025
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x-March6 branch from e2fad3e to 08874a6 Compare August 13, 2025 17:28
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x-March6 branch from 08874a6 to 2d2fecd Compare August 13, 2025 17:31
@thinkyhead thinkyhead merged commit 4fb984e into MarlinFirmware:bugfix-2.1.x Aug 13, 2025
66 checks passed
JohnnyTheOne added a commit to JohnnyTheOne/MarlinJTO that referenced this pull request Aug 16, 2025
commit a35a0cb
Merge: 9b1b58d a020a09
Author: Johnny Eshak <info@johnnytheone.com>
Date:   Wed Aug 13 23:46:00 2025 +0200

    Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x

commit a020a09
Author: thinkyhead <thinkyhead@users.noreply.github.com>
Date:   Wed Aug 13 18:34:14 2025 +0000

    [cron] Bump distribution date (2025-08-13)

commit 6361146
Author: Marcio T. <mlt4356-github@yahoo.com>
Date:   Wed Aug 13 11:37:23 2025 -0600

    🩹 Fix FILAMENT_MOTION_SENSOR + MarlinUI build (MarlinFirmware#27994)

commit 4fb984e
Author: Andrew <18502096+classicrocker883@users.noreply.github.com>
Date:   Wed Aug 13 13:33:09 2025 -0400

    🔨 Clean up and improve some Python scripts (MarlinFirmware#27752)

commit 081458a
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Thu Aug 14 05:26:51 2025 +1200

    🔧 Support more CONTROLLER_FAN pins (MarlinFirmware#27961)

commit 02fe1ff
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Thu Aug 14 05:04:16 2025 +1200

    🩹 Distinct types for LEDs 1/2 (MarlinFirmware#27959)
@classicrocker883 classicrocker883 deleted the bugfix-2.1.x-March6 branch September 17, 2025 01:29
bsdnomad pushed a commit to bsdnomad/Marlin that referenced this pull request Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Improvement T: Development Makefiles, PlatformIO, Python scripts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants