From 88eb455bdb535445da22479687aff660b75773da Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 21 Feb 2025 05:20:18 -0500 Subject: [PATCH] Fix EEPROM Editor Octoprint Plugin - M503 (#198) * Fix issues #196 + #168 * Update workflow versions * Remove "Mesh # Loaded" message from loading screen * Update Python scripts + format --- .github/workflows/compile-configs.yml | 288 ++++----- .github/workflows/compile-configs_Ender.yml | 224 +++---- Marlin/src/module/settings.cpp | 4 +- .../scripts/STM32F103RC_MEEB_3DP.py | 4 +- .../PlatformIO/scripts/STM32F1_build_flags.py | 10 +- .../scripts/STM32F1_create_variant.py | 2 +- .../share/PlatformIO/scripts/chitu_crypt.py | 2 +- .../PlatformIO/scripts/common-dependencies.py | 4 +- .../share/PlatformIO/scripts/configuration.py | 139 +++-- .../scripts/generic_create_variant.py | 12 +- buildroot/share/PlatformIO/scripts/lerdge.py | 2 +- buildroot/share/PlatformIO/scripts/marlin.py | 11 +- .../share/PlatformIO/scripts/mc-apply.py | 59 +- .../PlatformIO/scripts/offset_and_rename.py | 20 +- .../share/PlatformIO/scripts/open_explorer.py | 9 +- buildroot/share/PlatformIO/scripts/openblt.py | 18 +- buildroot/share/PlatformIO/scripts/pioutil.py | 3 +- .../PlatformIO/scripts/preflight-checks.py | 83 +-- .../share/PlatformIO/scripts/preprocessor.py | 38 +- buildroot/share/PlatformIO/scripts/proui.py | 2 +- buildroot/share/PlatformIO/scripts/schema.py | 271 +++++---- .../share/PlatformIO/scripts/signature.py | 554 ++++++++++++++---- .../share/PlatformIO/scripts/simulator.py | 26 +- .../PlatformIO/scripts/stm32_serialbuffer.py | 10 +- buildroot/share/dwin/bin/DWIN_ICO.py | 18 +- buildroot/share/dwin/bin/makeIco.py | 2 +- buildroot/share/dwin/bin/splitIco.py | 4 +- buildroot/share/fonts/buildhzk.py | 28 +- .../pin_interrupt_test/pin_interrupt_test.ino | 4 +- buildroot/share/scripts/g29_auto.py | 50 +- buildroot/share/scripts/get_test_targets.py | 2 +- buildroot/share/scripts/languageImport.py | 2 +- buildroot/share/scripts/pinsformat.py | 20 +- .../scripts/rle16_compress_cpp_image_data.py | 2 +- .../share/scripts/rle_compress_bitmap.py | 6 +- buildroot/share/scripts/upload.py | 76 +-- buildroot/share/scripts/validate_boards.py | 16 +- ini/stm32f1-maple.ini | 2 +- 38 files changed, 1203 insertions(+), 824 deletions(-) diff --git a/.github/workflows/compile-configs.yml b/.github/workflows/compile-configs.yml index 108c884de8..fee9bd51be 100644 --- a/.github/workflows/compile-configs.yml +++ b/.github/workflows/compile-configs.yml @@ -18,27 +18,27 @@ jobs: temp: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -80,8 +80,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -99,27 +99,27 @@ jobs: temp: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -161,8 +161,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -182,27 +182,27 @@ jobs: t13: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -223,15 +223,16 @@ jobs: cp configurations/Voxelab\ Aquila/UBL/Configuration_adv.h Marlin/Configuration_adv.h cp configurations/Voxelab\ Aquila/UBL/Version.h Marlin/Version.h sed -i "s/default_envs =.*/default_envs = ${AQUILA_VER}F103RC_voxelab_maple/" platformio.ini - if ($IS); then STEMP=; else STEMP='\/\/'; fi; + if ($IS); then STEMP=; CTEMP='\/\/'; else STEMP='\/\/'; CTEMP=; fi; sed -i "s/.*#define INPUT_SHAPING_X/${STEMP}#define INPUT_SHAPING_X/" Marlin/Configuration_adv.h sed -i "s/.*#define INPUT_SHAPING_Y/${STEMP}#define INPUT_SHAPING_Y/" Marlin/Configuration_adv.h sed -i "s/.*#define INPUT_SHAPING_Z/${STEMP}#define INPUT_SHAPING_Z/" Marlin/Configuration_adv.h + sed -i "s/.*#define EXTENDED_CAPABILITIES_REPORT/${CTEMP}#define EXTENDED_CAPABILITIES_REPORT/" Marlin/Configuration_adv.h if ($TP); then PTEMP='\/\/'; MTEMP=; else PTEMP=; MTEMP='\/\/'; fi; sed -i "0,/^#define PIDTEMP/ s/.*#define PIDTEMP/${PTEMP}#define PIDTEMP/" Marlin/Configuration.h sed -i "s/.*#define MPCTEMP/${MTEMP}#define MPCTEMP/" Marlin/Configuration.h sed -i "s/.*#define SHOW_SPEED_IND/${PTEMP}#define SHOW_SPEED_IND/" Marlin/Configuration.h - if [[ $IS && $TP ]]; then + if [ "$IS" = true ] && [ "$TP" = true ]; then sed -i "s/.*#define HAS_CUSTOM_COLORS 1/\/\/#define HAS_CUSTOM_COLORS 1/" Marlin/Configuration.h sed -i "s/.*#define MARLIN_SMALL_BUILD/#define MARLIN_SMALL_BUILD/" Marlin/Configuration_adv.h fi; @@ -263,8 +264,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -283,27 +284,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -323,15 +324,16 @@ jobs: cp configurations/Voxelab\ Aquila/UBL/Configuration_adv.h Marlin/Configuration_adv.h cp configurations/Voxelab\ Aquila/UBL/Version.h Marlin/Version.h sed -i "s/default_envs =.*/default_envs = ${AQUILA_VER}F103RC_voxelab_maple/" platformio.ini - if ($IS); then STEMP=; else STEMP='\/\/'; fi; + if ($IS); then STEMP=; CTEMP='\/\/'; else STEMP='\/\/'; CTEMP=; fi; sed -i "s/.*#define INPUT_SHAPING_X/${STEMP}#define INPUT_SHAPING_X/" Marlin/Configuration_adv.h sed -i "s/.*#define INPUT_SHAPING_Y/${STEMP}#define INPUT_SHAPING_Y/" Marlin/Configuration_adv.h sed -i "s/.*#define INPUT_SHAPING_Z/${STEMP}#define INPUT_SHAPING_Z/" Marlin/Configuration_adv.h + sed -i "s/.*#define EXTENDED_CAPABILITIES_REPORT/${CTEMP}#define EXTENDED_CAPABILITIES_REPORT/" Marlin/Configuration_adv.h if ($TP); then PTEMP='\/\/'; MTEMP=; else PTEMP=; MTEMP='\/\/'; fi; sed -i "0,/^#define PIDTEMP/ s/.*#define PIDTEMP/${PTEMP}#define PIDTEMP/" Marlin/Configuration.h sed -i "s/.*#define MPCTEMP/${MTEMP}#define MPCTEMP/" Marlin/Configuration.h sed -i "s/.*#define SHOW_SPEED_IND/${PTEMP}#define SHOW_SPEED_IND/" Marlin/Configuration.h - if [[ $IS && $TP ]]; then + if [ "$IS" = true ] && [ "$TP" = true ]; then sed -i "s/.*#define HAS_CUSTOM_COLORS 1/\/\/#define HAS_CUSTOM_COLORS 1/" Marlin/Configuration.h sed -i "s/.*#define MARLIN_SMALL_BUILD/#define MARLIN_SMALL_BUILD/" Marlin/Configuration_adv.h fi; @@ -360,8 +362,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -380,27 +382,27 @@ jobs: tjc: [true,false] t13: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -430,7 +432,7 @@ jobs: sed -i "0,/^#define PIDTEMP/ s/.*#define PIDTEMP/${PTEMP}#define PIDTEMP/" Marlin/Configuration.h sed -i "s/.*#define MPCTEMP/${MTEMP}#define MPCTEMP/" Marlin/Configuration.h sed -i "s/.*#define HAS_CUSTOM_COLORS 1/${PTEMP}#define HAS_CUSTOM_COLORS 1/" Marlin/Configuration.h - if [[ $IS && $TP ]]; then + if [ "$IS" = true ] && [ "$TP" = true ]; then sed -i "s/.*#define MARLIN_SMALL_BUILD/#define MARLIN_SMALL_BUILD/" Marlin/Configuration_adv.h fi; if ($TJC); then TJEMP=; REMP='\/\/'; else TJEMP='\/\/'; REMP=; fi; @@ -453,8 +455,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -472,27 +474,27 @@ jobs: temp: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -521,7 +523,7 @@ jobs: sed -i "0,/^#define PIDTEMP/ s/.*#define PIDTEMP/${PTEMP}#define PIDTEMP/" Marlin/Configuration.h sed -i "s/.*#define MPCTEMP/${MTEMP}#define MPCTEMP/" Marlin/Configuration.h sed -i "s/.*#define HAS_CUSTOM_COLORS 1/${PTEMP}#define HAS_CUSTOM_COLORS 1/" Marlin/Configuration.h - if [[ $IS && $TP ]]; then + if [ "$IS" = true ] && [ "$TP" = true ]; then sed -i "s/.*#define MARLIN_SMALL_BUILD/#define MARLIN_SMALL_BUILD/" Marlin/Configuration_adv.h fi; if ($TJC); then TJEMP=; REMP='\/\/'; else TJEMP='\/\/'; REMP=; fi; @@ -541,8 +543,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -562,27 +564,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -612,7 +614,7 @@ jobs: if ($TP); then PTEMP='\/\/'; MTEMP=; else PTEMP=; MTEMP='\/\/'; fi; sed -i "0,/^#define PIDTEMP/ s/.*#define PIDTEMP/${PTEMP}#define PIDTEMP/" Marlin/Configuration.h sed -i "s/.*#define MPCTEMP/${MTEMP}#define MPCTEMP/" Marlin/Configuration.h - if [[ $IS && $TP && $EX ]]; then + if [ "$IS" = true ] && [ "$TP" = true ] && [ "$EX" = true ]; then sed -i "s/.*#define HAS_CGCODE 1/\/\/#define HAS_CGCODE 1/" Marlin/Configuration.h fi; if ($TJC); then TJEMP=; REMP='\/\/'; else TJEMP='\/\/'; REMP=; fi; @@ -640,8 +642,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -658,27 +660,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -736,8 +738,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -753,27 +755,27 @@ jobs: chip: [V3_0,V2_0,V3_0_1] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -821,8 +823,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -840,27 +842,27 @@ jobs: temp: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -903,8 +905,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -922,27 +924,27 @@ jobs: temp: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -985,8 +987,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1006,27 +1008,27 @@ jobs: t13: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1083,8 +1085,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1103,27 +1105,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1176,8 +1178,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1196,27 +1198,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1268,8 +1270,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1285,27 +1287,27 @@ jobs: chip: [427,422] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1342,8 +1344,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1362,27 +1364,27 @@ jobs: temp: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1442,8 +1444,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1461,27 +1463,27 @@ jobs: inshape: [true,false] temp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1530,8 +1532,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.github/workflows/compile-configs_Ender.yml b/.github/workflows/compile-configs_Ender.yml index 2558f72e9a..8027b25d18 100644 --- a/.github/workflows/compile-configs_Ender.yml +++ b/.github/workflows/compile-configs_Ender.yml @@ -17,27 +17,27 @@ jobs: inshape: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -76,8 +76,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -94,27 +94,27 @@ jobs: inshape: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -153,8 +153,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -173,27 +173,27 @@ jobs: t13: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -246,8 +246,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -265,27 +265,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -334,8 +334,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -352,27 +352,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -416,8 +416,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -435,27 +435,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -503,8 +503,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -522,27 +522,27 @@ jobs: inshape: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -584,8 +584,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -603,27 +603,27 @@ jobs: inshape: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -665,8 +665,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -686,27 +686,27 @@ jobs: t13: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -762,8 +762,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -782,27 +782,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -854,8 +854,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -874,27 +874,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -945,8 +945,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -965,27 +965,27 @@ jobs: t13: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1038,8 +1038,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1057,27 +1057,27 @@ jobs: tjc: [true,false] bmp: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1126,8 +1126,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1144,27 +1144,27 @@ jobs: inshape: [true,false] tjc: [true,false] steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Setup node - uses: actions/setup-node@v4.0.4 + uses: actions/setup-node@v4.2.0 with: node-version: 20 - name: Cache pip - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v4.0.2 + uses: actions/cache@v4.2.1 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.4.0 with: - python-version: '3.10' + python-version: '3.12' - name: Install PlatformIO run: | python3 -m pip install --upgrade pip wheel platformio @@ -1203,8 +1203,8 @@ jobs: uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - uses: tanyagray/action-upload-release-asset@main + - name: Upload A Release Asset + uses: classicrocker883/upload-a-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index aca5752f5e..b93710cb93 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -3441,7 +3441,9 @@ void MarlinSettings::postprocess() { #if ENABLED(DWIN_LCD_PROUI) if (bedLevelTools.meshValidate()) { - ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), slot); + if (init_eeprom() || persistentStore.access_finish()) { + ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), slot); + } } else { status = true; diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index 76b65ac021..01ea80ef4a 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -14,5 +14,5 @@ if define[0] == "STM32_FLASH_SIZE": flash_size = define[1] - print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr)) - print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size)) + print("Use the {0:s} address as the marlin app entry point.".format(vect_tab_addr)) + print("Use the {0:d}KB flash version of stm32f103rct6 chip.".format(flash_size)) diff --git a/buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py b/buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py index dfce215348..447fae7765 100755 --- a/buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py +++ b/buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py @@ -15,19 +15,15 @@ "-Os", "-mcpu=cortex-m3", "-mthumb", - "-fsigned-char", "-fno-move-loop-invariants", "-fno-strict-aliasing", "-fsingle-precision-constant", - "--specs=nano.specs", "--specs=nosys.specs", - - "-MMD", "-MP", - + "-MMD", + "-MP", "-IMarlin/src/HAL/STM32F1", - "-DTARGET_STM32F1", "-DARDUINO_ARCH_STM32", "-DPLATFORM_M997_SUPPORT" @@ -43,9 +39,7 @@ if pioutil.is_pio_build(): pioutil.env.Append( ARFLAGS=["rcs"], - ASFLAGS=["-x", "assembler-with-cpp"], - CXXFLAGS=[ "-fabi-version=0", "-fno-use-cxa-atexit", diff --git a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py index 6fa53ef57f..7998776783 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py @@ -38,6 +38,6 @@ else: # The following almost works, but __start__ (from wirish/start.S) is not seen by common.inc - board.update("build.variants_dir", source_root_str); + board.update("build.variants_dir", source_root_str) src = str(source_dir) env.Append(BUILD_FLAGS=[f"-I{src}", f"-L{src}/ld"]) # Add include path for variant diff --git a/buildroot/share/PlatformIO/scripts/chitu_crypt.py b/buildroot/share/PlatformIO/scripts/chitu_crypt.py index a6761b01d3..24b41332c4 100644 --- a/buildroot/share/PlatformIO/scripts/chitu_crypt.py +++ b/buildroot/share/PlatformIO/scripts/chitu_crypt.py @@ -73,7 +73,7 @@ def encrypt_file(input, output_file, file_length): # the input file is exepcted to be in chunks of 0x800 # so round the size while len(input_file) % block_size != 0: - input_file.extend(b'0x0') + input_file.extend(b"0x0") # write the file header output_file.write(struct.pack(">I", 0x443D2D3F)) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 7790015180..553fc4ddda 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -6,7 +6,7 @@ if pioutil.is_pio_build(): import os, re, fnmatch, glob - srcfilepattern = re.compile(r".*[.](cpp|c)$") + srcfilepattern = re.compile(r'.*[.](cpp|c)$') marlinbasedir = os.path.join(os.getcwd(), "Marlin/") env = pioutil.env @@ -218,7 +218,7 @@ def addentry(fullpath, info=None): # Add all the things from the pattern by GLOB. def srepl(matchi): g0 = matchi.group(0) - return r"**" + g0[1:] + return r'**' + g0[1:] gpattern = re.sub(r'[*]($|[^*])', srepl, plain) gpattern = os.path.join(marlinbasedir, gpattern) diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index 884e8d1434..c0ea22899f 100755 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -7,8 +7,10 @@ from pathlib import Path verbose = 0 -def blab(str,level=1): - if verbose >= level: print(f"[config] {str}") + +def blab(str, level=1): + if verbose >= level: + print(f"[config] {str}") def config_path(cpath): return Path("Marlin", cpath) @@ -16,7 +18,8 @@ def config_path(cpath): # Apply a single name = on/off ; name = value ; etc. # TODO: Limit to the given (optional) configuration def apply_opt(name, val, conf=None): - if name == "lcd": name, val = val, "on" + if name == "lcd": + name, val = val, "on" # Create a regex to match the option and capture parts of the line # 1: Indentation @@ -36,7 +39,7 @@ def apply_opt(name, val, conf=None): # Find and enable and/or update all matches for file in ("Configuration.h", "Configuration_adv.h"): fullpath = config_path(file) - lines = fullpath.read_text(encoding='utf-8').split('\n') + lines = fullpath.read_text(encoding="utf-8").split("\n") found = False for i in range(len(lines)): line = lines[i] @@ -51,17 +54,25 @@ def apply_opt(name, val, conf=None): newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line) else: # For options with values, enable and set the value - addsp = '' if match[5] else ' ' - newline = match[1] + match[3] + match[4] + match[5] + addsp + val + match[6] + addsp = "" if match[5] else " " + newline = ( + match[1] + + match[3] + + match[4] + + match[5] + + addsp + + val + + match[6] + ) if match[9]: - sp = match[8] if match[8] else ' ' + sp = match[8] if match[8] else " " newline += sp + match[9] lines[i] = newline blab(f"Set {name} to {val}") # If the option was found, write the modified lines if found: - fullpath.write_text('\n'.join(lines), encoding='utf-8') + fullpath.write_text("\n".join(lines), encoding="utf-8") break # If the option didn't appear in either config file, add it @@ -71,7 +82,7 @@ def apply_opt(name, val, conf=None): prefix = "" if val == "off": prefix, val = "//", "" # Item doesn't appear in config dump - #val = "false" # Item appears in config dump + # val = "false" # Item appears in config dump # Uppercase the option unless already mixed/uppercase added = name.upper() if name.islower() else name @@ -82,7 +93,7 @@ def apply_opt(name, val, conf=None): # Prepend the new option after the first set of #define lines fullpath = config_path("Configuration.h") - with fullpath.open(encoding='utf-8') as f: + with fullpath.open(encoding="utf-8") as f: lines = f.readlines() linenum = 0 gotdef = False @@ -95,7 +106,7 @@ def apply_opt(name, val, conf=None): linenum += 1 currtime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") lines.insert(linenum, f"{prefix}#define {added:30} // Added by config.ini {currtime}\n") - fullpath.write_text(''.join(lines), encoding='utf-8') + fullpath.write_text("".join(lines), encoding="utf-8") # Disable all (most) defined options in the configuration files. # Everything in the named sections. Section hint for exceptions may be added. @@ -106,15 +117,21 @@ def disable_all_options(): # Disable all enabled options in both Config files for file in ("Configuration.h", "Configuration_adv.h"): fullpath = config_path(file) - lines = fullpath.read_text(encoding='utf-8').split('\n') + lines = fullpath.read_text(encoding="utf-8").split("\n") found = False for i in range(len(lines)): line = lines[i] match = regex.match(line) if match: name = match[3].upper() - if name in ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXAMPLES_DIR'): continue - if name.startswith('_'): continue + if name in ( + "CONFIGURATION_H_VERSION", + "CONFIGURATION_ADV_H_VERSION", + "CONFIG_EXAMPLES_DIR" + ): + continue + if name.startswith("_"): + continue found = True # Comment out the define # TODO: Comment more lines in a multi-line define with \ continuation @@ -123,16 +140,19 @@ def disable_all_options(): # If the option was found, write the modified lines if found: - fullpath.write_text('\n'.join(lines), encoding='utf-8') + fullpath.write_text("\n".join(lines), encoding="utf-8") # Fetch configuration files from GitHub given the path. # Return True if any files were fetched. def fetch_example(url): - if url.endswith("/"): url = url[:-1] - if not url.startswith('http'): + if url.endswith("/"): + url = url[:-1] + if not url.startswith("http"): brch = "HEAD" - if '@' in url: url, brch = map(str.strip, url.split('@')) - if url == 'configurations': url = 'Andrew427' + if "@" in url: + url, brch = map(str.strip, url.split("@")) + if url == "configurations": + url = "Andrew427" url = f"https://raw.githubusercontent.com/classicrocker883/MRiscoCProUI/{brch}/configurations/{url}" url = url.replace("%", "%25").replace(" ", "%20") @@ -152,12 +172,18 @@ def fetch_example(url): # Try to fetch the remote files gotfile = False - for fn in ("Configuration.h", "Configuration_adv.h", "_Bootscreen.h", "_Statusscreen.h"): + for fn in ( + "Configuration.h", + "Configuration_adv.h", + "_Bootscreen.h", + "_Statusscreen.h" + ): if os.system(f"{fetch} wgot {url}/{fn} >/dev/null 2>&1") == 0: - shutil.move('wgot', config_path(fn)) + shutil.move("wgot", config_path(fn)) gotfile = True - if Path('wgot').exists(): shutil.rmtree('wgot') + if Path("wgot").exists(): + shutil.rmtree("wgot") return gotfile @@ -167,43 +193,43 @@ def section_items(cp, sectkey): # Apply all items from a config section. Ignore ini_ items outside of config:base and config:root. def apply_ini_by_name(cp, sect): iniok = True - if sect in ('config:base', 'config:root'): + if sect in ("config:base", "config:root"): iniok = False - items = section_items(cp, 'config:base') + section_items(cp, 'config:root') + items = section_items(cp, "config:base") + section_items(cp, "config:root") else: items = section_items(cp, sect) for item in items: - if iniok or not item[0].startswith('ini_'): + if iniok or not item[0].startswith("ini_"): apply_opt(item[0], item[1]) # Apply all config sections from a parsed file def apply_all_sections(cp): for sect in cp.sections(): - if sect.startswith('config:'): + if sect.startswith("config:"): apply_ini_by_name(cp, sect) # Apply certain config sections from a parsed file -def apply_sections(cp, ckey='all'): +def apply_sections(cp, ckey="all"): blab(f"Apply section key: {ckey}") - if ckey == 'all': + if ckey == "all": apply_all_sections(cp) else: # Apply the base/root config.ini settings after external files are done - if ckey in ('base', 'root'): - apply_ini_by_name(cp, 'config:base') + if ckey in ("base", "root"): + apply_ini_by_name(cp, "config:base") # Apply historically 'Configuration.h' settings everywhere - if ckey == 'basic': - apply_ini_by_name(cp, 'config:basic') + if ckey == "basic": + apply_ini_by_name(cp, "config:basic") # Apply historically Configuration_adv.h settings everywhere # (Some of which rely on defines in 'Conditionals-2-LCD.h') - elif ckey in ('adv', 'advanced'): - apply_ini_by_name(cp, 'config:advanced') + elif ckey in ("adv", "advanced"): + apply_ini_by_name(cp, "config:advanced") # Apply a specific config: section directly - elif ckey.startswith('config:'): + elif ckey.startswith("config:"): apply_ini_by_name(cp, ckey) # Apply settings from a top level config.ini @@ -211,51 +237,52 @@ def apply_config_ini(cp): blab("=" * 20 + " Gather 'config.ini' entries...") # Pre-scan for ini_use_config to get config_keys - base_items = section_items(cp, 'config:base') + section_items(cp, 'config:root') - config_keys = ['base'] + base_items = section_items(cp, "config:base") + section_items(cp, "config:root") + config_keys = ["base"] for ikey, ival in base_items: - if ikey == 'ini_use_config': - config_keys = map(str.strip, ival.split(',')) + if ikey == "ini_use_config": + config_keys = map(str.strip, ival.split(",")) # For each ini_use_config item perform an action for ckey in config_keys: addbase = False # For a key ending in .ini load and parse another .ini file - if ckey.endswith('.ini'): - sect = 'base' - if '@' in ckey: sect, ckey = map(str.strip, ckey.split('@')) + if ckey.endswith(".ini"): + sect = "base" + if "@" in ckey: + sect, ckey = map(str.strip, ckey.split("@")) cp2 = configparser.ConfigParser() - cp2.read(config_path(ckey), encoding='utf-8') + cp2.read(config_path(ckey), encoding="utf-8") apply_sections(cp2, sect) - ckey = 'base' + ckey = "base" # (Allow 'example/' as a shortcut for 'examples/') - elif ckey.startswith('configuration/'): - ckey = 'configurations' + ckey[7:] + elif ckey.startswith("configuration/"): + ckey = "configurations" + ckey[7:] # For 'examples/' fetch an example set from GitHub. # For https?:// do a direct fetch of the URL. - if ckey.startswith('configurations/') or ckey.startswith('http'): + if ckey.startswith("configurations/") or ckey.startswith("http"): fetch_example(ckey) - ckey = 'base' + ckey = "base" # # [flatten] Write out Configuration.h and Configuration_adv.h files with # just the enabled options and all other content removed. # - #if ckey == '[flatten]': + # if ckey == '[flatten]': # write_flat_configs() - if ckey == '[disable]': + if ckey == "[disable]": disable_all_options() - elif ckey == 'all': + elif ckey == "all": apply_sections(cp) else: # Apply keyed sections after external files are done - apply_sections(cp, 'config:' + ckey) + apply_sections(cp, "config:" + ckey) if __name__ == "__main__": # @@ -264,16 +291,16 @@ def apply_config_ini(cp): import sys, os args = sys.argv[1:] if len(args) > 0: - if args[0].endswith('.ini'): + if args[0].endswith(".ini"): ini_file = args[0] else: print("Usage: %s <.ini file>" % os.path.basename(sys.argv[0])) else: - ini_file = config_path('config.ini') + ini_file = config_path("config.ini") if ini_file: user_ini = configparser.ConfigParser() - user_ini.read(ini_file, encoding='utf-8') + user_ini.read(ini_file, encoding="utf-8") apply_config_ini(user_ini) else: @@ -283,7 +310,7 @@ def apply_config_ini(cp): import pioutil if pioutil.is_pio_build(): try: - verbose = int(pioutil.env.GetProjectOption('custom_verbose')) + verbose = int(pioutil.env.GetProjectOption("custom_verbose")) except: pass diff --git a/buildroot/share/PlatformIO/scripts/generic_create_variant.py b/buildroot/share/PlatformIO/scripts/generic_create_variant.py index d03e0ba1fb..17898659df 100644 --- a/buildroot/share/PlatformIO/scripts/generic_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/generic_create_variant.py @@ -20,7 +20,7 @@ platform = env.PioPlatform() from platformio.package.meta import PackageSpec - platform_packages = env.GetProjectOption('platform_packages') + platform_packages = env.GetProjectOption("platform_packages") # Remove all tool items from platform_packages platform_packages = [x for x in platform_packages if not x.startswith("platformio/tool-")] @@ -33,8 +33,8 @@ platform_name = framewords[platform.__class__.__name__] else: spec = PackageSpec(platform_packages[0]) - if spec.uri and '@' in spec.uri: - platform_name = re.sub(r'@.+', '', spec.uri) + if spec.uri and "@" in spec.uri: + platform_name = re.sub(r'@.+', "", spec.uri) else: platform_name = spec.name @@ -47,13 +47,13 @@ # board = env.BoardConfig() variant = board.get("build.variant") - #mcu_type = board.get("build.mcu")[:-2] - #series = mcu_type[:7].upper() + "xx" + # mcu_type = board.get("build.mcu")[:-2] + # series = mcu_type[:7].upper() + "xx" # Make sure the local variant sub-folder exists if marlin_variant_pattern.match(str(variant).lower()): here = Path.cwd() - variants_dir = here / 'buildroot' / 'share' / 'PlatformIO' / 'variants' + variants_dir = here / "buildroot" / "share" / "PlatformIO" / "variants" source_dir = variants_dir / variant assert source_dir.is_dir() board.update("build.variants_dir", str(variants_dir)) diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index 856ca611c9..d840bb78f7 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -39,7 +39,7 @@ def encrypt(source, target, env): enfile.close() os.remove(fwpath) - if 'crypt_lerdge' in board.get("build").keys(): + if "crypt_lerdge" in board.get("build").keys(): if board.get("build.crypt_lerdge") != "": marlin.add_post_action(encrypt) else: diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index 4a77651307..cb2241d1a2 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -16,11 +16,11 @@ def copytree(src, dst, symlinks=False, ignore=None): shutil.copy2(item, dst / item.name) def replace_define(field, value): - envdefs = env['CPPDEFINES'].copy() + envdefs = env["CPPDEFINES"].copy() for define in envdefs: if define[0] == field: - env['CPPDEFINES'].remove(define) - env['CPPDEFINES'].append((field, value)) + env["CPPDEFINES"].remove(define) + env["CPPDEFINES"].append((field, value)) # Relocate the firmware to a new address, such as "0x08005000" def relocate_firmware(address): @@ -48,7 +48,8 @@ def encrypt_mks(source, target, env, new_name): # If FIRMWARE_BIN is defined by config, override all mf = env["MARLIN_FEATURES"] - if "FIRMWARE_BIN" in mf: new_name = mf["FIRMWARE_BIN"] + if "FIRMWARE_BIN" in mf: + new_name = mf["FIRMWARE_BIN"] fwpath = Path(target[0].path) fwfile = fwpath.open("rb") @@ -61,7 +62,7 @@ def encrypt_mks(source, target, env, new_name): if 320 <= position < 31040: byte = chr(ord(byte) ^ key[position & 31]) if sys.version_info[0] > 2: - byte = bytes(byte, 'latin1') + byte = bytes(byte, "latin1") enfile.write(byte) position += 1 finally: diff --git a/buildroot/share/PlatformIO/scripts/mc-apply.py b/buildroot/share/PlatformIO/scripts/mc-apply.py index 52d2ad6387..9ced8d899c 100755 --- a/buildroot/share/PlatformIO/scripts/mc-apply.py +++ b/buildroot/share/PlatformIO/scripts/mc-apply.py @@ -20,14 +20,15 @@ import argparse def report_version(conf): - if 'VERSION' in conf: - for k, v in sorted(conf['VERSION'].items()): - print(k + ': ' + v) + if "VERSION" in conf: + for k, v in sorted(conf["VERSION"].items()): + print(k + ": " + v) -def write_opt_file(conf, outpath='Marlin/apply_config.sh'): - with open(outpath, 'w') as outfile: +def write_opt_file(conf, outpath="Marlin/apply_config.sh"): + with open(outpath, "w") as outfile: for key, val in conf.items(): - if key in ('__INITIAL_HASH', 'VERSION'): continue + if key in ("__INITIAL_HASH", "VERSION"): + continue # Other keys are assumed to be configs if not type(val) is dict: @@ -36,56 +37,58 @@ def write_opt_file(conf, outpath='Marlin/apply_config.sh'): # Write config commands to the script file lines = [] for k, v in sorted(val.items()): - if v != '': - v.replace('"', '\\"').replace("'", "\\'").replace(' ', '\\ ') - lines += [f'opt_set {k} {v}'] + if v != "": + v.replace('"', '\\"').replace("'", "\\'").replace(" ", "\\ ") + lines += [f"opt_set {k} {v}"] else: - lines += [f'opt_enable {k}'] + lines += [f"opt_enable {k}"] + + outfile.write("\n".join(lines)) - outfile.write('\n'.join(lines)) + print("Config script written to: " + outpath) - print('Config script written to: ' + outpath) def back_up_config(name): # Back up the existing file before modifying it - conf_path = 'Marlin/' + name - with open(conf_path, 'r') as f: + conf_path = "Marlin/" + name + with open(conf_path, "r") as f: # Write a filename.bak#.ext retaining the original extension - parts = conf_path.split('.') - nr = '' + parts = conf_path.split(".") + nr = "" while True: - bak_path = '.'.join(parts[:-1]) + f'.bak{nr}.' + parts[-1] + bak_path = ".".join(parts[:-1]) + f".bak{nr}." + parts[-1] if os.path.exists(bak_path): - nr = 1 if nr == '' else nr + 1 + nr = 1 if nr == "" else nr + 1 continue - with open(bak_path, 'w') as b: + with open(bak_path, "w") as b: b.writelines(f.readlines()) break def apply_config(conf): for key in conf: - if key in ('__INITIAL_HASH', 'VERSION'): continue + if key in ("__INITIAL_HASH", "VERSION"): + continue back_up_config(key) for k, v in conf[key].items(): if v: - config.set('Marlin/' + key, k, v) + config.set("Marlin/" + key, k, v) else: - config.enable('Marlin/' + key, k) + config.enable("Marlin/" + key, k) def main(): - parser = argparse.ArgumentParser(description='Process Marlin firmware configuration.') - parser.add_argument('--opt', action='store_true', help='Output as an option setting script.') - parser.add_argument('config_file', nargs='?', default='marlin_config.json', help='Path to the configuration file.') + parser = argparse.ArgumentParser(description="Process Marlin firmware configuration.") + parser.add_argument("--opt", action="store_true", help="Output as an option setting script.") + parser.add_argument("config_file", nargs="?", default="marlin_config.json", help="Path to the configuration file.") args = parser.parse_args() try: - infile = open(args.config_file, 'r') + infile = open(args.config_file, "r") except: - print(f'No {args.config_file} found.') + print(f"No {args.config_file} found.") sys.exit(1) conf = json.load(infile) @@ -96,5 +99,5 @@ def main(): else: apply_config(conf) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index eb53c7fede..d3c87e775d 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -19,13 +19,13 @@ # # For build.offset define LD_FLASH_OFFSET, used by ldscript.ld # - if 'offset' in board_keys: + if "offset" in board_keys: LD_FLASH_OFFSET = board.get("build.offset") marlin.relocate_vtab(LD_FLASH_OFFSET) # Flash size maximum_flash_size = board.get("upload.maximum_size") // 1024 - marlin.replace_define('STM32_FLASH_SIZE', maximum_flash_size) + marlin.replace_define("STM32_FLASH_SIZE", maximum_flash_size) # Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json) maximum_ram_size = board.get("upload.maximum_ram_size") @@ -39,7 +39,7 @@ # # For build.encrypt_mks rename and encode the firmware file. # - if 'encrypt_mks' in board_keys: + if "encrypt_mks" in board_keys: # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt_mks def encrypt(source, target, env): @@ -51,23 +51,25 @@ def encrypt(source, target, env): # # For build.rename simply rename the firmware file. # - if 'rename' in board_keys: + if "rename" in board_keys: # If FIRMWARE_BIN is defined by config, override all mf = env["MARLIN_FEATURES"] - if "FIRMWARE_BIN" in mf: new_name = mf["FIRMWARE_BIN"] - else: new_name = board.get("build.rename") + if "FIRMWARE_BIN" in mf: + new_name = mf["FIRMWARE_BIN"] + else: + new_name = board.get("build.rename") def rename_target(source, target, env): from pathlib import Path from datetime import datetime from os import path - _newtarget = Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S'))) - _newsource = Path(source[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S').replace('.bin', '.elf'))) + _newtarget = Path(target[0].dir.path, datetime.now().strftime(new_name.replace("{date}", "%Y%m%d").replace("{time}", "%H%M%S"))) + _newsource = Path(source[0].dir.path, datetime.now().strftime(new_name.replace("{date}", "%Y%m%d").replace("{time}", "%H%M%S").replace(".bin", ".elf"))) BIN_NAME = Path(target[0].path).replace(_newtarget) ELF_NAME = Path(source[0].path).replace(_newsource) - env['PROGNAME'] = path.splitext(_newtarget)[0] + env["PROGNAME"] = path.splitext(_newtarget)[0] print("FIRMWARE ELF: %s" % ELF_NAME) print("FIRMWARE BIN: %s" % BIN_NAME) diff --git a/buildroot/share/PlatformIO/scripts/open_explorer.py b/buildroot/share/PlatformIO/scripts/open_explorer.py index d9dcd3c6f1..28d165c04a 100644 --- a/buildroot/share/PlatformIO/scripts/open_explorer.py +++ b/buildroot/share/PlatformIO/scripts/open_explorer.py @@ -5,18 +5,19 @@ def open_file_explorer(): import subprocess from pathlib import Path from SCons.Script import DefaultEnvironment + env = DefaultEnvironment() - BUILD_PATH = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) + BUILD_PATH = Path(env["PROJECT_BUILD_DIR"], env["PIOENV"]) script = f"{BUILD_PATH}" import platform current_OS = platform.system() - if current_OS == 'Windows': + if current_OS == "Windows": try: subprocess.run(["start", " ", script], shell=True) except Exception as e: print(f"Could not open File Explorer, an error occurred: {e}") - elif current_OS == 'Linux': + elif current_OS == "Linux": try: subprocess.run(["xdg-open", script]) except Exception as e: - print(f"Could not open File Explorer, an error occurred: {e}") \ No newline at end of file + print(f"Could not open File Explorer, an error occurred: {e}") diff --git a/buildroot/share/PlatformIO/scripts/openblt.py b/buildroot/share/PlatformIO/scripts/openblt.py index 35b9a19486..ece0e037bb 100644 --- a/buildroot/share/PlatformIO/scripts/openblt.py +++ b/buildroot/share/PlatformIO/scripts/openblt.py @@ -8,11 +8,19 @@ board = env.BoardConfig() board_keys = board.get("build").keys() - if 'encode' in board_keys: + if "encode" in board_keys: env.AddPostAction( join("$BUILD_DIR", "${PROGNAME}.bin"), - env.VerboseAction(" ".join([ - "$OBJCOPY", "-O", "srec", - "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encode")) + "\"" - ]), "Building " + board.get("build.encode")) + env.VerboseAction( + " ".join( + [ + "$OBJCOPY", + "-O", + "srec", + '"$BUILD_DIR/${PROGNAME}.elf"', + '"' + join("$BUILD_DIR", board.get("build.encode")) + '"' + ] + ), + "Building " + board.get("build.encode") + ) ) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py index 8a882d94bf..d7fb4b18ca 100644 --- a/buildroot/share/PlatformIO/scripts/pioutil.py +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -7,7 +7,8 @@ # Make sure 'vscode init' is not the current command def is_pio_build(): - if "IsCleanTarget" in dir(env) and env.IsCleanTarget(): return False + if "IsCleanTarget" in dir(env) and env.IsCleanTarget(): + return False return not env.IsIntegrationDump() def get_pio_version(): diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 1a4694b673..0c68682aff 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -13,33 +13,33 @@ def get_envs_for_board(board): ppath = Path("Marlin/src/pins/pins.h") with ppath.open() as file: - if sys.platform == 'win32': - envregex = r"(?:env|win):" - elif sys.platform == 'darwin': - envregex = r"(?:env|mac|uni):" - elif sys.platform == 'linux': - envregex = r"(?:env|lin|uni):" + if sys.platform == "win32": + envregex = r'(?:env|win):' + elif sys.platform == "darwin": + envregex = r'(?:env|mac|uni):' + elif sys.platform == "linux": + envregex = r'(?:env|lin|uni):' else: - envregex = r"(?:env):" + envregex = r'(?:env):' - r = re.compile(r"if\s+MB\((.+)\)") + r = re.compile(r'if\s+MB\((.+)\)') if board.startswith("BOARD_"): board = board[6:] for line in file: mbs = r.findall(line) - if mbs and board in re.split(r",\s*", mbs[0]): + if mbs and board in re.split(r',\s*', mbs[0]): line = file.readline() - found_envs = re.match(r"\s*#include .+" + envregex, line) + found_envs = re.match(r'\s*#include .+' + envregex, line) if found_envs: - envlist = re.findall(envregex + r"(\w+)", line) - return [ "env:"+s for s in envlist ] + envlist = re.findall(envregex + r'(\w+)', line) + return ["env:" + s for s in envlist] return [] def check_envs(build_env, board_envs, config): if build_env in board_envs: return True - ext = config.get(build_env, 'extends', default=None) + ext = config.get(build_env, "extends", default=None) if ext: if isinstance(ext, str): return check_envs(ext, board_envs, config) @@ -51,7 +51,7 @@ def check_envs(build_env, board_envs, config): def sanity_check_target(): # Sanity checks: - if 'PIOENV' not in env: + if "PIOENV" not in env: raise SystemExit("Error: PIOENV is not defined. This script is intended to be used with PlatformIO") # Require PlatformIO 6.1.1 or later @@ -59,11 +59,11 @@ def sanity_check_target(): if vers < [6, 1, 1]: raise SystemExit("Error: Marlin requires PlatformIO >= 6.1.1. Use 'pio upgrade' to get a newer version.") - if 'MARLIN_FEATURES' not in env: + if "MARLIN_FEATURES" not in env: raise SystemExit("Error: this script should be used after common Marlin scripts.") # Useful values - project_dir = Path(env['PROJECT_DIR']) + project_dir = Path(env["PROJECT_DIR"]) config_files = ("Configuration.h", "Configuration_adv.h") # @@ -73,31 +73,37 @@ def sanity_check_target(): for f in config_files: conf_path = project_dir / "Marlin" / f if conf_path.is_file(): - with open(conf_path, 'r', encoding="utf8") as file: + with open(conf_path, "r", encoding="utf8") as file: text = file.read() modified_text = text.replace("BOTH(", "ALL(").replace("EITHER(", "ANY(") if text != modified_text: conf_modified = True - with open(conf_path, 'w') as file: + with open(conf_path, "w") as file: file.write(modified_text) if conf_modified: - raise SystemExit('WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.') + raise SystemExit("WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.") - if len(env['MARLIN_FEATURES']) == 0: + if len(env["MARLIN_FEATURES"]) == 0: raise SystemExit("Error: Failed to parse Marlin features. See previous error messages.") - build_env = env['PIOENV'] - motherboard = env['MARLIN_FEATURES']['MOTHERBOARD'] + build_env = env["PIOENV"] + motherboard = env["MARLIN_FEATURES"]["MOTHERBOARD"] board_envs = get_envs_for_board(motherboard) config = env.GetProjectConfig() - result = check_envs("env:"+build_env, board_envs, config) + result = check_envs("env:" + build_env, board_envs, config) # Make sure board is compatible with the build environment. Skip for _test, # since the board is manipulated as each unit test is executed. if not result and build_env != "STM32F103RE_creality": - err = "Error: Build environment '%s' is incompatible with %s. Use one of these environments: %s" % \ - ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) ) + err = ( + "Error: Build environment '%s' is incompatible with %s. Use one of these environments: %s" + % ( + build_env, + motherboard, + ", ".join([e[4:] for e in board_envs if e.startswith("env:")]) + ) + ) raise SystemExit(err) # @@ -106,14 +112,14 @@ def sanity_check_target(): for p in (project_dir, project_dir / "config"): for f in config_files: if (p / f).is_file(): - err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p + err = ("ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p) raise SystemExit(err) # # Find the name.cpp.o or name.o and remove it # def rm_ofile(subdir, name): - build_dir = Path(env['PROJECT_BUILD_DIR'], build_env) + build_dir = Path(env["PROJECT_BUILD_DIR"], build_env) for outdir in (build_dir, build_dir / "debug"): for ext in (".cpp.o", ".o"): fpath = outdir / "src/src" / subdir / (name + ext) @@ -128,7 +134,7 @@ def rm_ofile(subdir, name): # # Rebuild 'settings.cpp' for EEPROM_INIT_NOW # - if 'EEPROM_INIT_NOW' in env['MARLIN_FEATURES']: + if "EEPROM_INIT_NOW" in env["MARLIN_FEATURES"]: rm_ofile("module", "settings") # @@ -136,27 +142,26 @@ def rm_ofile(subdir, name): # mixedin = [] p = project_dir / "Marlin/src/lcd/dogm" - for f in [ "ultralcd_DOGM.cpp", "ultralcd_DOGM.h" ]: + for f in ["ultralcd_DOGM.cpp", "ultralcd_DOGM.h"]: if (p / f).is_file(): - mixedin += [ f ] + mixedin += [f] p = project_dir / "Marlin/src/feature/bedlevel/abl" - for f in [ "abl.cpp", "abl.h" ]: + for f in ["abl.cpp", "abl.h"]: if (p / f).is_file(): - mixedin += [ f ] + mixedin += [f] if mixedin: - err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin) + err = ("ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin)) raise SystemExit(err) # # Check FILAMENT_RUNOUT_SCRIPT has a %c parammeter when required # - if 'FILAMENT_RUNOUT_SENSOR' in env['MARLIN_FEATURES'] and 'NUM_RUNOUT_SENSORS' in env['MARLIN_FEATURES']: - if env['MARLIN_FEATURES']['NUM_RUNOUT_SENSORS'].isdigit() and int(env['MARLIN_FEATURES']['NUM_RUNOUT_SENSORS']) > 1: - if 'FILAMENT_RUNOUT_SCRIPT' in env['MARLIN_FEATURES']: - frs = env['MARLIN_FEATURES']['FILAMENT_RUNOUT_SCRIPT'] + if ("FILAMENT_RUNOUT_SENSOR" in env["MARLIN_FEATURES"] and "NUM_RUNOUT_SENSORS" in env["MARLIN_FEATURES"]): + if (env["MARLIN_FEATURES"]["NUM_RUNOUT_SENSORS"].isdigit() and int(env["MARLIN_FEATURES"]["NUM_RUNOUT_SENSORS"]) > 1): + if "FILAMENT_RUNOUT_SCRIPT" in env["MARLIN_FEATURES"]: + frs = env["MARLIN_FEATURES"]["FILAMENT_RUNOUT_SCRIPT"] if "M600" in frs and "%c" not in frs: - err = "ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter (e.g., \"M600 T%c\") when NUM_RUNOUT_SENSORS is > 1" + err = 'ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter (e.g., "M600 T%c") when NUM_RUNOUT_SENSORS is > 1' raise SystemExit(err) - sanity_check_target() diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index efc3a6261e..15895b3d5e 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -17,29 +17,29 @@ def blab(str): preprocessor_cache = {} def run_preprocessor(env, fn=None): - filename = fn or 'buildroot/share/PlatformIO/scripts/common-dependencies.h' + filename = fn or "buildroot/share/PlatformIO/scripts/common-dependencies.h" if filename in preprocessor_cache: return preprocessor_cache[filename] # Process defines - build_flags = env.get('BUILD_FLAGS') + build_flags = env.get("BUILD_FLAGS") build_flags = env.ParseFlagsExtended(build_flags) cxx = search_compiler(env) cmd = ['"' + cxx + '"'] # Build flags from board.json - #if 'BOARD' in env: + # if 'BOARD' in env: # cmd += [env.BoardConfig().get("build.extra_flags")] - for s in build_flags['CPPDEFINES']: + for s in build_flags["CPPDEFINES"]: if isinstance(s, tuple): - cmd += ['-D' + s[0] + '=' + str(s[1])] + cmd += ["-D" + s[0] + "=" + str(s[1])] else: - cmd += ['-D' + s] + cmd += ["-D" + s] - cmd += ['-D__MARLIN_DEPS__ -w -dM -E -x c++'] - depcmd = cmd + [ filename ] - cmd = ' '.join(depcmd) + cmd += ["-D__MARLIN_DEPS__ -w -dM -E -x c++"] + depcmd = cmd + [filename] + cmd = " ".join(depcmd) blab(cmd) try: define_list = subprocess.check_output(cmd, shell=True).splitlines() @@ -58,12 +58,12 @@ def search_compiler(env): from pathlib import Path, PurePath - ENV_BUILD_PATH = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) + ENV_BUILD_PATH = Path(env["PROJECT_BUILD_DIR"], env["PIOENV"]) GCC_PATH_CACHE = ENV_BUILD_PATH / ".gcc_path" gccpath = None try: - gccpath = env.GetProjectOption('custom_gcc') + gccpath = env.GetProjectOption("custom_gcc") blab("Getting compiler from env") return gccpath except: @@ -74,18 +74,18 @@ def search_compiler(env): blab("Getting g++ path from cache") return GCC_PATH_CACHE.read_text() - path_separator = ':' - gcc_exe = '*g++' - if env['PLATFORM'] == 'win32': - path_separator = ';' + path_separator = ":" + gcc_exe = "*g++" + if env["PLATFORM"] == "win32": + path_separator = ";" gcc_exe += ".exe" - envpath = map(Path, env['ENV']['PATH'].split(path_separator)) + envpath = map(Path, env["ENV"]["PATH"].split(path_separator)) # Search for the compiler in PATH for ppath in envpath: # Use any item in $PATH corresponding to a platformio toolchain bin folder - if ppath.match(env['PROJECT_PACKAGES_DIR'] + "/**/bin"): + if ppath.match(env["PROJECT_PACKAGES_DIR"] + "/**/bin"): for gpath in ppath.glob(gcc_exe): # Skip '*-elf-g++' (crosstool-NG) except for xtensa32/xtensa-esp32 if not gpath.stem.endswith('-elf-g++') or "xtensa" in str(gpath): @@ -96,12 +96,12 @@ def search_compiler(env): for ppath in envpath: for gpath in ppath.glob(gcc_exe): # Skip macOS Clang - if not (gpath == 'usr/bin/g++' and env['PLATFORM'] == 'darwin'): + if not (gpath == "usr/bin/g++" and env["PLATFORM"] == "darwin"): gccpath = str(gpath.resolve()) break if not gccpath: - gccpath = env.get('CXX') + gccpath = env.get("CXX") blab("Couldn't find a compiler! Fallback to '%s'" % gccpath) nocache = 1 diff --git a/buildroot/share/PlatformIO/scripts/proui.py b/buildroot/share/PlatformIO/scripts/proui.py index 2434643a0a..ad60e36be3 100644 --- a/buildroot/share/PlatformIO/scripts/proui.py +++ b/buildroot/share/PlatformIO/scripts/proui.py @@ -63,6 +63,6 @@ def _GetMarlinEnv(marlinEnv, feature): # Copy correct library file if prouiex: - print('ProUI extension detected') + print("ProUI extension detected") libdestfile = libpath+arch+'libproui_'+lev+'.a' shutil.copy(libdestfile, libfile) diff --git a/buildroot/share/PlatformIO/scripts/schema.py b/buildroot/share/PlatformIO/scripts/schema.py index d23e5c4716..21e0e169b5 100755 --- a/buildroot/share/PlatformIO/scripts/schema.py +++ b/buildroot/share/PlatformIO/scripts/schema.py @@ -14,7 +14,7 @@ import re, json from pathlib import Path -def extend_dict(d:dict, k:tuple): +def extend_dict(d: dict, k: tuple): if len(k) >= 1 and k[0] not in d: d[k[0]] = {} if len(k) >= 2 and k[1] not in d[k[0]]: @@ -31,19 +31,21 @@ def extend_dict(d:dict, k:tuple): re.compile(r'^(HOTENDS|BED|PROBE|COOLER)$'), re.compile(r'^[XYZIJKUVW]M(IN|AX)$') ] + # If the indexed part of the option name matches a pattern # then add it to the dictionary. def find_grouping(gdict, filekey, sectkey, optkey, pindex): - optparts = optkey.split('_') + optparts = optkey.split("_") if 1 < len(optparts) > pindex: for patt in grouping_patterns: if patt.match(optparts[pindex]): subkey = optparts[pindex] - modkey = '_'.join(optparts) - optparts[pindex] = '*' - wildkey = '_'.join(optparts) - kkey = f'{filekey}|{sectkey}|{wildkey}' - if kkey not in gdict: gdict[kkey] = [] + modkey = "_".join(optparts) + optparts[pindex] = "*" + wildkey = "_".join(optparts) + kkey = f"{filekey}|{sectkey}|{wildkey}" + if kkey not in gdict: + gdict[kkey] = [] gdict[kkey].append((subkey, modkey)) # Build a list of potential groups. Only those with multiple items will be grouped. @@ -55,11 +57,11 @@ def group_options(schema): for optkey in s: find_grouping(found_groups, filekey, sectkey, optkey, pindex) - fkeys = [ k for k in found_groups.keys() ] + fkeys = [k for k in found_groups.keys()] for kkey in fkeys: items = found_groups[kkey] if len(items) > 1: - f, s, w = kkey.split('|') + f, s, w = kkey.split("|") extend_dict(schema, (f, s, w)) # Add wildcard group to schema for subkey, optkey in items: # Add all items to wildcard group schema[f][s][w][subkey] = schema[f][s][optkey] # Move non-wildcard item to wildcard group @@ -75,9 +77,10 @@ def load_boards(): for line in bfile: if line.startswith("#define BOARD_"): bname = line.split()[1] - if bname != "BOARD_UNKNOWN": boards.append(bname) + if bname != "BOARD_UNKNOWN": + boards.append(bname) return "['" + "','".join(boards) + "']" - return '' + return "" # # Extract the specified configuration files in the form of a structured schema. @@ -107,15 +110,15 @@ def extract_files(filekey): # Parsing states class Parse: - NORMAL = 0 # No condition yet - BLOCK_COMMENT = 1 # Looking for the end of the block comment - EOL_COMMENT = 2 # EOL comment started, maybe add the next comment? - SLASH_COMMENT = 3 # Block-like comment, starting with aligned // - GET_SENSORS = 4 # Gathering temperature sensor options - ERROR = 9 # Syntax error + NORMAL = 0 # No condition yet + BLOCK_COMMENT = 1 # Looking for the end of the block comment + EOL_COMMENT = 2 # EOL comment started, maybe add the next comment? + SLASH_COMMENT = 3 # Block-like comment, starting with aligned // + GET_SENSORS = 4 # Gathering temperature sensor options + ERROR = 9 # Syntax error # A JSON object to store the data - sch_out = { key:{} for key in filekey.values() } + sch_out = {key: {} for key in filekey.values()} # Regex for #define NAME [VALUE] [COMMENT] with sanitized line defgrep = re.compile(r'^(//)?\s*(#define)\s+([A-Za-z0-9_]+)\s*(.*?)\s*(//.+)?$') # Pattern to match a float value @@ -126,17 +129,17 @@ class Parse: sid = 0 # Loop through files and parse them line by line for fn, fk in filekey.items(): - with Path("Marlin", fn).open(encoding='utf-8') as fileobj: - section = 'none' # Current Settings section - line_number = 0 # Counter for the line number of the file - conditions = [] # Create a condition stack for the current file - comment_buff = [] # A temporary buffer for comments - prev_comment = '' # Copy before reset for an EOL comment - options_json = '' # A buffer for the most recent options JSON found - eol_options = False # The options came from end of line, so only apply once - join_line = False # A flag that the line should be joined with the previous one - line = '' # A line buffer to handle \ continuation - last_added_ref = {} # Reference to the last added item + with Path("Marlin", fn).open(encoding="utf-8") as fileobj: + section = "none" # Current Settings section + line_number = 0 # Counter for the line number of the file + conditions = [] # Create a condition stack for the current file + comment_buff = [] # A temporary buffer for comments + prev_comment = "" # Copy before reset for an EOL comment + options_json = "" # A buffer for the most recent options JSON found + eol_options = False # The options came from end of line, so only apply once + join_line = (False) # A flag that the line should be joined with the previous one + line = "" # A line buffer to handle \ continuation + last_added_ref = {} # Reference to the last added item # Loop through the lines in the file for the_line in fileobj.readlines(): line_number += 1 @@ -144,9 +147,9 @@ class Parse: # Clean the line for easier parsing the_line = the_line.strip() - if join_line: # A previous line is being made longer - line += (' ' if line else '') + the_line - else: # Otherwise, start the line anew + if join_line: # A previous line is being made longer + line += (" " if line else "") + the_line + else: # Otherwise, start the line anew line, line_start = the_line, line_number # If the resulting line ends with a \, don't process now. @@ -165,15 +168,15 @@ class Parse: # so we have to extend it if state == Parse.EOL_COMMENT: # If the line is not a comment, we're done with the EOL comment - if not defmatch and the_line.startswith('//'): + if not defmatch and the_line.startswith("//"): comment_buff.append(the_line[2:].strip()) else: state = Parse.NORMAL - cline = ' '.join(comment_buff) + cline = " ".join(comment_buff) comment_buff = [] - if cline != '': + if cline != "": # A (block or slash) comment was already added - cfield = 'notes' if 'comment' in last_added_ref else 'comment' + cfield = ("notes" if "comment" in last_added_ref else "comment") last_added_ref[cfield] = cline # @@ -189,28 +192,33 @@ def use_comment(c, opt, sec, bufref): sec - Section to return (if not updated) bufref - The comment buffer to add to ''' - sc = c.strip() # Strip for special patterns - if sc.startswith(':'): # If the comment starts with : then it has magic JSON - d = sc[1:].strip() # Strip the leading : and spaces + sc = c.strip() # Strip for special patterns + if sc.startswith(":"): # If the comment starts with : then it has magic JSON + d = sc[1:].strip() # Strip the leading : and spaces # Look for a JSON container - cbr = sc.rindex('}') if d.startswith('{') else sc.rindex(']') if d.startswith('[') else 0 + cbr = ( + sc.rindex("}") + if d.startswith("{") + else sc.rindex("]") if d.startswith("[") else 0 + ) if cbr: - opt, cmt = sc[1:cbr+1].strip(), sc[cbr+1:].strip() - if cmt != '': bufref.append(cmt) + opt, cmt = sc[1 : cbr + 1].strip(), sc[cbr + 1 :].strip() + if cmt != "": + bufref.append(cmt) else: - opt = sc[1:].strip() # Some literal value not in a JSON container? + opt = sc[1:].strip() # Some literal value not in a JSON container? else: - m = re.match(r'@section\s*(.+)', sc) # Start a new section? + m = re.match(r'@section\s*(.+)', sc) # Start a new section? if m: sec = m[1] - elif not sc.startswith('========'): - bufref.append(c) # Anything else is part of the comment + elif not sc.startswith("========"): + bufref.append(c) # Anything else is part of the comment return opt, sec # For slash comments, capture consecutive slash comments. # The comment will be applied to the next #define. if state == Parse.SLASH_COMMENT: - if not defmatch and the_line.startswith('//'): + if not defmatch and the_line.startswith("//"): options_json, section = use_comment(the_line[2:].strip(), options_json, section, comment_buff) continue else: @@ -219,15 +227,15 @@ def use_comment(c, opt, sec, bufref): # In a block comment, capture lines up to the end of the comment. # Assume nothing follows the comment closure. if state in (Parse.BLOCK_COMMENT, Parse.GET_SENSORS): - endpos = line.find('*/') + endpos = line.find("*/") if endpos < 0: cline = line else: - cline, line = line[:endpos].strip(), line[endpos+2:].strip() + cline, line = line[:endpos].strip(), line[endpos + 2 :].strip() # Temperature sensors are done if state == Parse.GET_SENSORS: - options_json = f'[ {options_json[:-2]} ]' + options_json = f"[ {options_json[:-2]} ]" state = Parse.NORMAL # Strip the leading '* ' from block comments @@ -252,8 +260,8 @@ def use_comment(c, opt, sec, bufref): elif state == Parse.NORMAL: # Skip a commented define when evaluating comment opening st = 2 if re.match(r'^//\s*#define', line) else 0 - cpos1 = line.find('/*') # Start a block comment on the line? - cpos2 = line.find('//', st) # Start an end of line comment on the line? + cpos1 = line.find("/*") # Start a block comment on the line? + cpos2 = line.find("//", st) # Start an end of line comment on the line? # Only the first comment starter gets evaluated cpos = -1 @@ -268,7 +276,7 @@ def use_comment(c, opt, sec, bufref): # Comment after a define may be continued on the following lines if defmatch is not None and cpos > 10: state = Parse.EOL_COMMENT - prev_comment = '\n'.join(comment_buff) + prev_comment = "\n".join(comment_buff) comment_buff = [] else: state = Parse.SLASH_COMMENT @@ -276,31 +284,34 @@ def use_comment(c, opt, sec, bufref): # Process the start of a new comment if cpos != -1: comment_buff = [] - cline, line = line[cpos+2:].strip(), line[:cpos].strip() + cline, line = line[cpos + 2 :].strip(), line[:cpos].strip() if state == Parse.BLOCK_COMMENT: # Strip leading '*' from block comments cline = re.sub(r'^\* ?', '', cline) else: # Expire end-of-line options after first use - if cline.startswith(':'): eol_options = True + if cline.startswith(":"): + eol_options = True # Buffer a non-empty comment start - if cline != '': + if cline != "": options_json, section = use_comment(cline, options_json, section, comment_buff) # If the line has nothing before the comment, go to the next line - if line == '': - options_json = '' + if line == "": + options_json = "" continue # Parenthesize the given expression if needed def atomize(s): - if s == '' \ - or re.match(r'^[A-Za-z0-9_]*(\([^)]+\))?$', s) \ - or re.match(r'^[A-Za-z0-9_]+ == \d+?$', s): + if ( + s == "" + or re.match(r'^[A-Za-z0-9_]*(\([^)]+\))?$', s) + or re.match(r'^[A-Za-z0-9_]+ == \d+?$', s) + ): return s - return f'({s})' + return f"({s})" # # The conditions stack is an array containing condition-arrays. @@ -312,42 +323,43 @@ def atomize(s): # ELSE/ELIF re-push the condition-array. # cparts = line.split() - iselif, iselse = cparts[0] == '#elif', cparts[0] == '#else' - if iselif or iselse or cparts[0] == '#endif': + iselif, iselse = cparts[0] == "#elif", cparts[0] == "#else" + if iselif or iselse or cparts[0] == "#endif": if len(conditions) == 0: - raise Exception(f'no #if block at line {line_number}') + raise Exception(f"no #if block at line {line_number}") # Pop the last condition-array from the stack prev = conditions.pop() if iselif or iselse: - prev[-1] = '!' + prev[-1] # Invert the last condition - if iselif: prev.append(atomize(line[5:].strip())) + prev[-1] = "!" + prev[-1] # Invert the last condition + if iselif: + prev.append(atomize(line[5:].strip())) conditions.append(prev) - elif cparts[0] == '#if': - conditions.append([ atomize(line[3:].strip()) ]) - elif cparts[0] == '#ifdef': - conditions.append([ f'defined({line[6:].strip()})' ]) - elif cparts[0] == '#ifndef': - conditions.append([ f'!defined({line[7:].strip()})' ]) + elif cparts[0] == "#if": + conditions.append([atomize(line[3:].strip())]) + elif cparts[0] == "#ifdef": + conditions.append([f"defined({line[6:].strip()})"]) + elif cparts[0] == "#ifndef": + conditions.append([f"!defined({line[7:].strip()})"]) # Handle a complete #define line elif defmatch is not None: # Get the match groups into vars - enabled, define_name, val = defmatch[1] is None, defmatch[3], defmatch[4] + enabled, define_name, val = (defmatch[1] is None, defmatch[3], defmatch[4]) # Increment the serial ID sid += 1 # Create a new dictionary for the current #define define_info = { - 'section': section, - 'name': define_name, - 'enabled': enabled, - 'line': line_start, - 'sid': sid + "section": section, + "name" : define_name, + "enabled": enabled, + "line" : line_start, + "sid" : sid } # Type is based on the value @@ -355,8 +367,8 @@ def atomize(s): 'switch' if val == '' \ else 'int' if re.match(r'^[-+]?\s*\d+$', val) \ else 'ints' if re.match(r'^([-+]?\s*\d+)(\s*,\s*[-+]?\s*\d+)+$', val) \ - else 'floats' if re.match(rf'({flt}(\s*,\s*{flt})+)', val) \ - else 'float' if re.match(f'^({flt})$', val) \ + else 'floats' if re.match(rf"({flt}(\s*,\s*{flt})+)", val) \ + else 'float' if re.match(f"^({flt})$", val) \ else 'string' if val[0] == '"' \ else 'char' if val[0] == "'" \ else 'bool' if val in ('true', 'false') \ @@ -373,54 +385,61 @@ def atomize(s): else float(val.replace('f','')) if value_type == 'float' \ else val - if val != '': define_info['value'] = val - if value_type != '': define_info['type'] = value_type + if val != "": + define_info["value"] = val + if value_type != "": + define_info["type"] = value_type # Join up accumulated conditions with && - if conditions: define_info['requires'] = '(' + ') && ('.join(sum(conditions, [])) + ')' + if conditions: + define_info["requires"] = ("(" + ") && (".join(sum(conditions, [])) + ")") # If the comment_buff is not empty, add the comment to the info if comment_buff: - full_comment = '\n'.join(comment_buff).strip() + full_comment = "\n".join(comment_buff).strip() # An EOL comment will be added later # The handling could go here instead of above if state == Parse.EOL_COMMENT: - define_info['comment'] = '' + define_info["comment"] = "" else: - define_info['comment'] = full_comment + define_info["comment"] = full_comment comment_buff = [] # If the comment specifies units, add that to the info units = re.match(r'^\(([^)]+)\)', full_comment) if units: units = units[1] - if units in ('s', 'sec'): units = 'seconds' - define_info['units'] = units + if units in ("s", "sec"): + units = "seconds" + define_info["units"] = units - if 'comment' not in define_info or define_info['comment'] == '': + if "comment" not in define_info or define_info["comment"] == "": if prev_comment: - define_info['comment'] = prev_comment - prev_comment = '' + define_info["comment"] = prev_comment + prev_comment = "" - if 'comment' in define_info and define_info['comment'] == '': - del define_info['comment'] + if "comment" in define_info and define_info["comment"] == "": + del define_info["comment"] # Set the options for the current #define - if define_name == "MOTHERBOARD" and boards != '': - define_info['options'] = boards - elif options_json != '': - define_info['options'] = options_json - if eol_options: options_json = '' + if define_name == "MOTHERBOARD" and boards != "": + define_info["options"] = boards + elif options_json != "": + define_info["options"] = options_json + if eol_options: + options_json = "" # Create section dict if it doesn't exist yet - if section not in sch_out[fk]: sch_out[fk][section] = {} + if section not in sch_out[fk]: + sch_out[fk][section] = {} # If define has already been seen... if define_name in sch_out[fk][section]: info = sch_out[fk][section][define_name] - if isinstance(info, dict): info = [ info ] # Convert a single dict into a list - info.append(define_info) # Add to the list + if isinstance(info, dict): + info = [info] # Convert a single dict into a list + info.append(define_info) # Add to the list else: # Add the define dict with name as key sch_out[fk][section][define_name] = define_info @@ -435,26 +454,27 @@ def atomize(s): # def extract(): # List of files to process, with shorthand - return extract_files({ 'Configuration.h':'basic', 'Configuration_adv.h':'advanced' }) + return extract_files({"Configuration.h": "basic", "Configuration_adv.h": "advanced"}) -def dump_json(schema:dict, jpath:Path): - with jpath.open('w', encoding='utf-8') as jfile: +def dump_json(schema: dict, jpath: Path): + with jpath.open("w", encoding="utf-8") as jfile: json.dump(schema, jfile, ensure_ascii=False, indent=2) -def dump_yaml(schema:dict, ypath:Path): +def dump_yaml(schema: dict, ypath: Path): import yaml # Custom representer for all multi-line strings def str_literal_representer(dumper, data): - if '\n' in data: # Check for multi-line strings + if "\n" in data: # Check for multi-line strings # Add a newline to trigger '|+' - if not data.endswith('\n'): data += '\n' - return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|') - return dumper.represent_scalar('tag:yaml.org,2002:str', data) + if not data.endswith("\n"): + data += "\n" + return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|") + return dumper.represent_scalar("tag:yaml.org,2002:str", data) yaml.add_representer(str, str_literal_representer) - with ypath.open('w', encoding='utf-8') as yfile: + with ypath.open("w", encoding="utf-8") as yfile: yaml.dump(schema, yfile, default_flow_style=False, width=120, indent=2) def main(): @@ -469,46 +489,49 @@ def main(): # Get the command line arguments after the script name import sys args = sys.argv[1:] - if len(args) == 0: args = ['some'] + if len(args) == 0: + args = ["some"] # Does the given array intersect at all with args? - def inargs(c): return len(set(args) & set(c)) > 0 + def inargs(c): + return len(set(args) & set(c)) > 0 # Help / Unknown option - unk = not inargs(['some','json','jsons','group','yml','yaml']) - if (unk): print(f"Unknown option: '{args[0]}'") - if inargs(['-h', '--help']) or unk: + unk = not inargs(["some", "json", "jsons", "group", "yml", "yaml"]) + if unk: + print(f"Unknown option: '{args[0]}'") + if inargs(["-h", "--help"]) or unk: print("Usage: schema.py [some|json|jsons|group|yml|yaml]...") print(" some = json + yml") print(" jsons = json + group") return # JSON schema - if inargs(['some', 'json', 'jsons']): + if inargs(["some", "json", "jsons"]): print("Generating JSON ...") - dump_json(schema, Path('schema.json')) + dump_json(schema, Path("schema.json")) # JSON schema (wildcard names) - if inargs(['group', 'jsons']): + if inargs(["group", "jsons"]): group_options(schema) - dump_json(schema, Path('schema_grouped.json')) + dump_json(schema, Path("schema_grouped.json")) # YAML - if inargs(['some', 'yml', 'yaml']): + if inargs(["some", "yml", "yaml"]): try: import yaml except ImportError: print("Installing YAML module ...") import subprocess try: - subprocess.run(['python3', '-m', 'pip', 'install', 'pyyaml']) + subprocess.run(["python3", "-m", "pip", "install", "pyyaml"]) import yaml except: print("Failed to install YAML module") return print("Generating YML ...") - dump_yaml(schema, Path('schema.yml')) + dump_yaml(schema, Path("schema.yml")) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py index a5c92cff17..c707e6cb5a 100755 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -34,7 +34,7 @@ def enabled_defines(filepath): ''' outdict = {} section = "user" - spatt = re.compile(r".*@section +([-a-zA-Z0-9_\s]+)$") # @section ... + spatt = re.compile(r'.*@section +([-a-zA-Z0-9_\s]+)$') # @section ... f = open(filepath, encoding="utf8").read().split("\n") @@ -42,15 +42,17 @@ def enabled_defines(filepath): for line in f: sline = line.strip() - m = re.match(spatt, sline) # @section ... - if m: section = m.group(1).strip() ; continue + m = re.match(spatt, sline) # @section ... + if m: + section = m.group(1).strip() + continue if incomment: - if '*/' in sline: + if "*/" in sline: incomment = False continue else: - mpos, spos = sline.find('/*'), sline.find('//') + mpos, spos = sline.find("/*"), sline.find("//") if mpos >= 0 and (spos < 0 or spos > mpos): incomment = True continue @@ -58,15 +60,15 @@ def enabled_defines(filepath): if sline[:7] == "#define": # Extract the key here (we don't care about the value) kv = sline[8:].strip().split() - outdict[kv[0]] = { 'name':kv[0], 'section': section } + outdict[kv[0]] = {"name": kv[0], "section": section} return outdict # Compute the SHA256 hash of a file def get_file_sha256sum(filepath): sha256_hash = hashlib.sha256() - with open(filepath,"rb") as f: + with open(filepath, "rb") as f: # Read and update hash string value in blocks of 4K - for byte_block in iter(lambda: f.read(4096),b""): + for byte_block in iter(lambda: f.read(4096), b""): sha256_hash.update(byte_block) return sha256_hash.hexdigest() @@ -75,10 +77,21 @@ def get_file_sha256sum(filepath): # import zipfile def compress_file(filepath, storedname, outpath): - with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_DEFLATED, allowZip64=False, compresslevel=9) as zipf: + with zipfile.ZipFile( + outpath, + "w", + compression=zipfile.ZIP_DEFLATED, + allowZip64=False, + compresslevel=9 + ) as zipf: zipf.write(filepath, arcname=storedname) -ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXAMPLES_DIR', 'CONFIG_EXPORT') +ignore = ( + "CONFIGURATION_H_VERSION", + "CONFIGURATION_ADV_H_VERSION", + "CONFIG_EXAMPLES_DIR", + "CONFIG_EXPORT" +) # # Compute a build signature and/or export the configuration @@ -90,13 +103,14 @@ def compute_build_signature(env): The signature can be reversed to get a 1:1 equivalent configuration file. Used by common-dependencies.py after filtering build files by feature. ''' - if 'BUILD_SIGNATURE' in env: return + if "BUILD_SIGNATURE" in env: + return env.Append(BUILD_SIGNATURE=1) - build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) - json_name = 'marlin_config.json' + build_path = Path(env["PROJECT_BUILD_DIR"], env["PIOENV"]) + json_name = "marlin_config.json" marlin_json = build_path / json_name - marlin_zip = build_path / 'mc.zip' + marlin_zip = build_path / "mc.zip" # ANSI colors green = "\u001b[32m" @@ -104,10 +118,10 @@ def compute_build_signature(env): red = "\u001b[31m" # Definitions from these files will be kept - header_paths = ('Marlin/Configuration.h', 'Marlin/Configuration_adv.h') + header_paths = ("Marlin/Configuration.h", "Marlin/Configuration_adv.h") # Check if we can skip processing - hashes = '' + hashes = "" for header in header_paths: hashes += get_file_sha256sum(header)[0:10] @@ -117,7 +131,7 @@ def compute_build_signature(env): try: with marlin_json.open() as infile: conf = json.load(infile) - same_hash = conf['__INITIAL_HASH'] == hashes + same_hash = conf["__INITIAL_HASH"] == hashes if same_hash: compress_file(marlin_json, json_name, marlin_zip) except: @@ -133,7 +147,7 @@ def compute_build_signature(env): # Get all unique define names into a flat array conf_names += defines.keys() # Remember which file these defines came from - conf_defines[hpath.split('/')[-1]] = defines + conf_defines[hpath.split("/")[-1]] = defines # Get enabled config options based on running GCC to preprocess the config files. # The result is a list of line strings, each starting with '#define'. @@ -141,39 +155,45 @@ def compute_build_signature(env): build_output = run_preprocessor(env) # Dumb regex to filter out some dumb macros - r = re.compile(r"\(+(\s*-*\s*_.*)\)+") + r = re.compile(r'\(+(\s*-*\s*_.*)\)+') # Extract all the #define lines in the build output as key/value pairs build_defines = {} for line in build_output: # Split the define from the value. - key_val = line[8:].strip().decode().split(' ') - key, value = key_val[0], ' '.join(key_val[1:]) + key_val = line[8:].strip().decode().split(" ") + key, value = key_val[0], " ".join(key_val[1:]) # Ignore values starting with two underscore, since it's low level - if len(key) > 2 and key[0:2] == "__": continue + if len(key) > 2 and key[0:2] == "__": + continue # Ignore values containing parentheses (likely a function macro) - if '(' in key and ')' in key: continue + if "(" in key and ")" in key: + continue # Then filter dumb values - if r.match(value): continue + if r.match(value): + continue build_defines[key] = value if len(value) else "" # # Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_EXPORT # - is_embed = 'CONFIGURATION_EMBEDDING' in build_defines - if not (is_embed or 'CONFIG_EXPORT' in build_defines): + is_embed = "CONFIGURATION_EMBEDDING" in build_defines + if not (is_embed or "CONFIG_EXPORT" in build_defines): return # Filter out useless macros from the output cleaned_build_defines = {} for key in build_defines: # Remove all boards now - if key.startswith("BOARD_") and key != "BOARD_INFO_NAME": continue + if key.startswith("BOARD_") and key != "BOARD_INFO_NAME": + continue # Remove all keys ending by "_T_DECLARED" as it's a copy of extraneous system stuff - if key.endswith("_T_DECLARED"): continue + if key.endswith("_T_DECLARED"): + continue # Remove keys that are not in the #define list in the Configuration list - if key not in conf_names + [ 'DETAILED_BUILD_VERSION', 'STRING_DISTRIBUTION_DATE' ]: continue + if key not in conf_names + ["DETAILED_BUILD_VERSION", "STRING_DISTRIBUTION_DATE"]: + continue # Add to a new dictionary for simplicity cleaned_build_defines[key] = build_defines[key] @@ -185,19 +205,28 @@ def compute_build_signature(env): real_config[header] = {} for key in cleaned_build_defines: if key in conf_defines[header]: - if key[0:2] == '__': continue + if key[0:2] == "__": + continue val = cleaned_build_defines[key] - real_config[header][key] = { 'file':header, 'name': key, 'value': val, 'section': conf_defines[header][key]['section']} + real_config[header][key] = { + "file" : header, + "name" : key, + "value" : val, + "section": conf_defines[header][key]["section"] + } def tryint(key): - try: return int(build_defines[key]) - except: return 0 + try: + return int(build_defines[key]) + except: + return 0 # Get the CONFIG_EXPORT value and do an extended dump if > 100 # For example, CONFIG_EXPORT 102 will make a 'config.ini' with a [config:] group for each schema @section - config_dump = tryint('CONFIG_EXPORT') + config_dump = tryint("CONFIG_EXPORT") extended_dump = config_dump > 100 - if extended_dump: config_dump -= 100 + if extended_dump: + config_dump -= 100 # Get the schema class for exports that require it if config_dump in (3, 4) or (extended_dump and config_dump in (2, 5)): @@ -207,32 +236,277 @@ def tryint(key): print(red + "Error: " + str(exc)) conf_schema = None - optorder = ('MOTHERBOARD','SERIAL_PORT','BAUDRATE','USE_WATCHDOG','THERMAL_PROTECTION_HOTENDS','THERMAL_PROTECTION_HYSTERESIS','THERMAL_PROTECTION_PERIOD','BUFSIZE','BLOCK_BUFFER_SIZE','MAX_CMD_SIZE','EXTRUDERS','TEMP_SENSOR_0','TEMP_HYSTERESIS','HEATER_0_MINTEMP','HEATER_0_MAXTEMP','PREHEAT_1_TEMP_HOTEND','BANG_MAX','PIDTEMP','PID_K1','PID_MAX','PID_FUNCTIONAL_RANGE','DEFAULT_KP','DEFAULT_KI','DEFAULT_KD','X_DRIVER_TYPE','Y_DRIVER_TYPE','Z_DRIVER_TYPE','E0_DRIVER_TYPE','X_BED_SIZE','X_MIN_POS','X_MAX_POS','Y_BED_SIZE','Y_MIN_POS','Y_MAX_POS','Z_MIN_POS','Z_MAX_POS','X_HOME_DIR','Y_HOME_DIR','Z_HOME_DIR','X_MIN_ENDSTOP_HIT_STATE','Y_MIN_ENDSTOP_HIT_STATE','Z_MIN_ENDSTOP_HIT_STATE','DEFAULT_AXIS_STEPS_PER_UNIT','AXIS_RELATIVE_MODES','DEFAULT_MAX_FEEDRATE','DEFAULT_MAX_ACCELERATION','HOMING_FEEDRATE_MM_M','HOMING_BUMP_DIVISOR','X_ENABLE_ON','Y_ENABLE_ON','Z_ENABLE_ON','E_ENABLE_ON','INVERT_X_DIR','INVERT_Y_DIR','INVERT_Z_DIR','INVERT_E0_DIR','STEP_STATE_E','STEP_STATE_X','STEP_STATE_Y','STEP_STATE_Z','DISABLE_X','DISABLE_Y','DISABLE_Z','DISABLE_E','PROPORTIONAL_FONT_RATIO','DEFAULT_NOMINAL_FILAMENT_DIA','JUNCTION_DEVIATION_MM','DEFAULT_ACCELERATION','DEFAULT_TRAVEL_ACCELERATION','DEFAULT_RETRACT_ACCELERATION','DEFAULT_MINIMUMFEEDRATE','DEFAULT_MINTRAVELFEEDRATE','MINIMUM_PLANNER_SPEED','MIN_STEPS_PER_SEGMENT','DEFAULT_MINSEGMENTTIME','BED_OVERSHOOT','BUSY_WHILE_HEATING','DEFAULT_EJERK','DEFAULT_KEEPALIVE_INTERVAL','DEFAULT_LEVELING_FADE_HEIGHT','DISABLE_OTHER_EXTRUDERS','DISPLAY_CHARSET_HD44780','EEPROM_BOOT_SILENT','EEPROM_CHITCHAT','ENDSTOPPULLUPS','EXTRUDE_MAXLENGTH','EXTRUDE_MINTEMP','HOST_KEEPALIVE_FEATURE','HOTEND_OVERSHOOT','JD_HANDLE_SMALL_SEGMENTS','LCD_INFO_SCREEN_STYLE','LCD_LANGUAGE','MAX_BED_POWER','MESH_INSET','MIN_SOFTWARE_ENDSTOPS','MAX_SOFTWARE_ENDSTOPS','MIN_SOFTWARE_ENDSTOP_X','MIN_SOFTWARE_ENDSTOP_Y','MIN_SOFTWARE_ENDSTOP_Z','MAX_SOFTWARE_ENDSTOP_X','MAX_SOFTWARE_ENDSTOP_Y','MAX_SOFTWARE_ENDSTOP_Z','PREHEAT_1_FAN_SPEED','PREHEAT_1_LABEL','PREHEAT_1_TEMP_BED','PREVENT_COLD_EXTRUSION','PREVENT_LENGTHY_EXTRUDE','PRINTJOB_TIMER_AUTOSTART','PROBING_MARGIN','SHOW_BOOTSCREEN','SOFT_PWM_SCALE','STRING_CONFIG_H_AUTHOR','TEMP_BED_HYSTERESIS','TEMP_BED_RESIDENCY_TIME','TEMP_BED_WINDOW','TEMP_RESIDENCY_TIME','TEMP_WINDOW','VALIDATE_HOMING_ENDSTOPS','XY_PROBE_FEEDRATE','Z_CLEARANCE_BETWEEN_PROBES','Z_CLEARANCE_DEPLOY_PROBE','Z_CLEARANCE_MULTI_PROBE','ARC_SUPPORT','AUTO_REPORT_TEMPERATURES','AUTOTEMP','AUTOTEMP_OLDWEIGHT','BED_CHECK_INTERVAL','DEFAULT_STEPPER_TIMEOUT_SEC','DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT','DISABLE_IDLE_X','DISABLE_IDLE_Y','DISABLE_IDLE_Z','DISABLE_IDLE_E','E0_AUTO_FAN_PIN','ENCODER_100X_STEPS_PER_SEC','ENCODER_10X_STEPS_PER_SEC','ENCODER_RATE_MULTIPLIER','EXTENDED_CAPABILITIES_REPORT','EXTRUDER_AUTO_FAN_SPEED','EXTRUDER_AUTO_FAN_TEMPERATURE','FANMUX0_PIN','FANMUX1_PIN','FANMUX2_PIN','FASTER_GCODE_PARSER','HOMING_BUMP_MM','MAX_ARC_SEGMENT_MM','MIN_ARC_SEGMENT_MM','MIN_CIRCLE_SEGMENTS','N_ARC_CORRECTION','SERIAL_OVERRUN_PROTECTION','SLOWDOWN','SLOWDOWN_DIVISOR','TEMP_SENSOR_BED','THERMAL_PROTECTION_BED_HYSTERESIS','THERMOCOUPLE_MAX_ERRORS','TX_BUFFER_SIZE','WATCH_BED_TEMP_INCREASE','WATCH_BED_TEMP_PERIOD','WATCH_TEMP_INCREASE','WATCH_TEMP_PERIOD') + optorder = ( + "MOTHERBOARD", + "SERIAL_PORT", + "BAUDRATE", + "USE_WATCHDOG", + "THERMAL_PROTECTION_HOTENDS", + "THERMAL_PROTECTION_HYSTERESIS", + "THERMAL_PROTECTION_PERIOD", + "BUFSIZE", + "BLOCK_BUFFER_SIZE", + "MAX_CMD_SIZE", + "EXTRUDERS", + "TEMP_SENSOR_0", + "TEMP_HYSTERESIS", + "HEATER_0_MINTEMP", + "HEATER_0_MAXTEMP", + "PREHEAT_1_TEMP_HOTEND", + "BANG_MAX", + "PIDTEMP", + "PID_K1", + "PID_MAX", + "PID_FUNCTIONAL_RANGE", + "DEFAULT_KP", + "DEFAULT_KI", + "DEFAULT_KD", + "X_DRIVER_TYPE", + "Y_DRIVER_TYPE", + "Z_DRIVER_TYPE", + "E0_DRIVER_TYPE", + "X_BED_SIZE", + "X_MIN_POS", + "X_MAX_POS", + "Y_BED_SIZE", + "Y_MIN_POS", + "Y_MAX_POS", + "Z_MIN_POS", + "Z_MAX_POS", + "X_HOME_DIR", + "Y_HOME_DIR", + "Z_HOME_DIR", + "X_MIN_ENDSTOP_HIT_STATE", + "Y_MIN_ENDSTOP_HIT_STATE", + "Z_MIN_ENDSTOP_HIT_STATE", + "DEFAULT_AXIS_STEPS_PER_UNIT", + "AXIS_RELATIVE_MODES", + "DEFAULT_MAX_FEEDRATE", + "DEFAULT_MAX_ACCELERATION", + "HOMING_FEEDRATE_MM_M", + "HOMING_BUMP_DIVISOR", + "X_ENABLE_ON", + "Y_ENABLE_ON", + "Z_ENABLE_ON", + "E_ENABLE_ON", + "INVERT_X_DIR", + "INVERT_Y_DIR", + "INVERT_Z_DIR", + "INVERT_E0_DIR", + "STEP_STATE_E", + "STEP_STATE_X", + "STEP_STATE_Y", + "STEP_STATE_Z", + "DISABLE_X", + "DISABLE_Y", + "DISABLE_Z", + "DISABLE_E", + "PROPORTIONAL_FONT_RATIO", + "DEFAULT_NOMINAL_FILAMENT_DIA", + "JUNCTION_DEVIATION_MM", + "DEFAULT_ACCELERATION", + "DEFAULT_TRAVEL_ACCELERATION", + "DEFAULT_RETRACT_ACCELERATION", + "DEFAULT_MINIMUMFEEDRATE", + "DEFAULT_MINTRAVELFEEDRATE", + "MINIMUM_PLANNER_SPEED", + "MIN_STEPS_PER_SEGMENT", + "DEFAULT_MINSEGMENTTIME", + "BED_OVERSHOOT", + "BUSY_WHILE_HEATING", + "DEFAULT_EJERK", + "DEFAULT_KEEPALIVE_INTERVAL", + "DEFAULT_LEVELING_FADE_HEIGHT", + "DISABLE_OTHER_EXTRUDERS", + "DISPLAY_CHARSET_HD44780", + "EEPROM_BOOT_SILENT", + "EEPROM_CHITCHAT", + "ENDSTOPPULLUPS", + "EXTRUDE_MAXLENGTH", + "EXTRUDE_MINTEMP", + "HOST_KEEPALIVE_FEATURE", + "HOTEND_OVERSHOOT", + "JD_HANDLE_SMALL_SEGMENTS", + "LCD_INFO_SCREEN_STYLE", + "LCD_LANGUAGE", + "MAX_BED_POWER", + "MESH_INSET", + "MIN_SOFTWARE_ENDSTOPS", + "MAX_SOFTWARE_ENDSTOPS", + "MIN_SOFTWARE_ENDSTOP_X", + "MIN_SOFTWARE_ENDSTOP_Y", + "MIN_SOFTWARE_ENDSTOP_Z", + "MAX_SOFTWARE_ENDSTOP_X", + "MAX_SOFTWARE_ENDSTOP_Y", + "MAX_SOFTWARE_ENDSTOP_Z", + "PREHEAT_1_FAN_SPEED", + "PREHEAT_1_LABEL", + "PREHEAT_1_TEMP_BED", + "PREVENT_COLD_EXTRUSION", + "PREVENT_LENGTHY_EXTRUDE", + "PRINTJOB_TIMER_AUTOSTART", + "PROBING_MARGIN", + "SHOW_BOOTSCREEN", + "SOFT_PWM_SCALE", + "STRING_CONFIG_H_AUTHOR", + "TEMP_BED_HYSTERESIS", + "TEMP_BED_RESIDENCY_TIME", + "TEMP_BED_WINDOW", + "TEMP_RESIDENCY_TIME", + "TEMP_WINDOW", + "VALIDATE_HOMING_ENDSTOPS", + "XY_PROBE_FEEDRATE", + "Z_CLEARANCE_BETWEEN_PROBES", + "Z_CLEARANCE_DEPLOY_PROBE", + "Z_CLEARANCE_MULTI_PROBE", + "ARC_SUPPORT", + "AUTO_REPORT_TEMPERATURES", + "AUTOTEMP", + "AUTOTEMP_OLDWEIGHT", + "BED_CHECK_INTERVAL", + "DEFAULT_STEPPER_TIMEOUT_SEC", + "DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT", + "DISABLE_IDLE_X", + "DISABLE_IDLE_Y", + "DISABLE_IDLE_Z", + "DISABLE_IDLE_E", + "E0_AUTO_FAN_PIN", + "ENCODER_100X_STEPS_PER_SEC", + "ENCODER_10X_STEPS_PER_SEC", + "ENCODER_RATE_MULTIPLIER", + "EXTENDED_CAPABILITIES_REPORT", + "EXTRUDER_AUTO_FAN_SPEED", + "EXTRUDER_AUTO_FAN_TEMPERATURE", + "FANMUX0_PIN", + "FANMUX1_PIN", + "FANMUX2_PIN", + "FASTER_GCODE_PARSER", + "HOMING_BUMP_MM", + "MAX_ARC_SEGMENT_MM", + "MIN_ARC_SEGMENT_MM", + "MIN_CIRCLE_SEGMENTS", + "N_ARC_CORRECTION", + "SERIAL_OVERRUN_PROTECTION", + "SLOWDOWN", + "SLOWDOWN_DIVISOR", + "TEMP_SENSOR_BED", + "THERMAL_PROTECTION_BED_HYSTERESIS", + "THERMOCOUPLE_MAX_ERRORS", + "TX_BUFFER_SIZE", + "WATCH_BED_TEMP_INCREASE", + "WATCH_BED_TEMP_PERIOD", + "WATCH_TEMP_INCREASE", + "WATCH_TEMP_PERIOD" + ) def optsort(x, optorder): - return optorder.index(x) if x in optorder else float('inf') + return optorder.index(x) if x in optorder else float("inf") # # CONFIG_EXPORT 102 = config.ini, 105 = Config.h # Get sections using the schema class # if extended_dump and config_dump in (2, 5): - if not conf_schema: exit(1) + if not conf_schema: + exit(1) # Start with a preferred @section ordering - preorder = ('test','custom','info','machine','eeprom','stepper drivers','multi stepper','idex','extruder','geometry','homing','kinematics','motion','motion control','endstops','filament runout sensors','probe type','probes','bltouch','leveling','temperature','hotend temp','mpctemp','pid temp','mpc temp','bed temp','chamber temp','fans','tool change','advanced pause','calibrate','calibration','media','lcd','lights','caselight','interface','custom main menu','custom config menu','custom buttons','develop','debug matrix','delta','scara','tpara','polar','polargraph','cnc','nozzle park','nozzle clean','gcode','serial','host','filament width','i2c encoders','i2cbus','joystick','multi-material','nanodlp','network','photo','power','psu control','reporting','safety','security','servos','stats','tmc/config','tmc/hybrid','tmc/serial','tmc/smart','tmc/spi','tmc/stallguard','tmc/status','tmc/stealthchop','tmc/tmc26x','units','volumetrics','extras') + preorder = ( + "test", + "custom", + "info", + "machine", + "eeprom", + "stepper drivers", + "multi stepper", + "idex", + "extruder", + "geometry", + "homing", + "kinematics", + "motion", + "motion control", + "endstops", + "filament runout sensors", + "probe type", + "probes", + "bltouch", + "leveling", + "temperature", + "hotend temp", + "mpctemp", + "pid temp", + "mpc temp", + "bed temp", + "chamber temp", + "fans", + "tool change", + "advanced pause", + "calibrate", + "calibration", + "media", + "lcd", + "lights", + "caselight", + "interface", + "custom main menu", + "custom config menu", + "custom buttons", + "develop", + "debug matrix", + "delta", + "scara", + "tpara", + "polar", + "polargraph", + "cnc", + "nozzle park", + "nozzle clean", + "gcode", + "serial", + "host", + "filament width", + "i2c encoders", + "i2cbus", + "joystick", + "multi-material", + "nanodlp", + "network", + "photo", + "power", + "psu control", + "reporting", + "safety", + "security", + "servos", + "stats", + "tmc/config", + "tmc/hybrid", + "tmc/serial", + "tmc/smart", + "tmc/spi", + "tmc/stallguard", + "tmc/status", + "tmc/stealthchop", + "tmc/tmc26x", + "units", + "volumetrics", + "extras" + ) - sections = { key:{} for key in preorder } + sections = {key: {} for key in preorder} # Group options by schema @section for header in real_config: for name in real_config[header]: - #print(f" name: {name}") - if name in ignore: continue + # print(f" name: {name}") + if name in ignore: + continue ddict = real_config[header][name] - #print(f" real_config[{header}][{name}]:", ddict) - sect = ddict['section'] - if sect not in sections: sections[sect] = {} + # print(f" real_config[{header}][{name}]:", ddict) + sect = ddict["section"] + if sect not in sections: + sections[sect] = {} sections[sect][name] = ddict # @@ -241,53 +515,59 @@ def optsort(x, optorder): if config_dump == 2: print(yellow + "Generating config.ini ...") - ini_fmt = '{0:40} = {1}' - ext_fmt = '{0:40} {1}' + ini_fmt = "{0:40} = {1}" + ext_fmt = "{0:40} {1}" if extended_dump: # Extended export will dump config options by section # We'll use Schema class to get the sections - if not conf_schema: exit(1) + if not conf_schema: + exit(1) # Then group options by schema @section sections = {} for header in real_config: for name in real_config[header]: - #print(f" name: {name}") + # print(f" name: {name}") if name not in ignore: ddict = real_config[header][name] - #print(f" real_config[{header}][{name}]:", ddict) - sect = ddict['section'] - if sect not in sections: sections[sect] = {} + # print(f" real_config[{header}][{name}]:", ddict) + sect = ddict["section"] + if sect not in sections: + sections[sect] = {} sections[sect][name] = ddict # Get all sections as a list of strings, with spaces and dashes replaced by underscores - long_list = [ re.sub(r'[- ]+', '_', x).lower() for x in sections.keys() ] + long_list = [re.sub(r'[- ]+', "_", x).lower() for x in sections.keys()] # Make comma-separated lists of sections with 64 characters or less sec_lines = [] while len(long_list): - line = long_list.pop(0) + ', ' + line = long_list.pop(0) + ", " while len(long_list) and len(line) + len(long_list[0]) < 64 - 1: - line += long_list.pop(0) + ', ' + line += long_list.pop(0) + ", " sec_lines.append(line.strip()) - sec_lines[-1] = sec_lines[-1][:-1] # Remove the last comma + sec_lines[-1] = sec_lines[-1][:-1] # Remove the last comma else: - sec_lines = ['all'] + sec_lines = ["all"] # Build the ini_use_config item - sec_list = ini_fmt.format('ini_use_config', sec_lines[0]) - for line in sec_lines[1:]: sec_list += '\n' + ext_fmt.format('', line) - - config_ini = build_path / 'config.ini' - with config_ini.open('w') as outfile: - filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' } + sec_list = ini_fmt.format("ini_use_config", sec_lines[0]) + for line in sec_lines[1:]: + sec_list += "\n" + ext_fmt.format("", line) + + config_ini = build_path / "config.ini" + with config_ini.open("w") as outfile: + filegrp = { + "Configuration.h" : "config:basic", + "Configuration_adv.h": "config:advanced" + } vers = build_defines["CONFIGURATION_H_VERSION"] dt_string = datetime.now().strftime("%Y-%m-%d at %H:%M:%S") outfile.write( -f'''# +f"""# # Marlin Firmware # config.ini - Options to apply before the build # @@ -334,36 +614,41 @@ def optsort(x, optorder): # {sec_list} {ini_fmt.format('ini_config_vers', vers)} -''' ) +""" + ) if extended_dump: # Loop through the sections for skey in sorted(sections): - #print(f" skey: {skey}") - sani = re.sub(r'[- ]+', '_', skey).lower() + # print(f" skey: {skey}") + sani = re.sub(r'[- ]+', "_", skey).lower() outfile.write(f"\n[config:{sani}]\n") opts = sections[skey] opts_keys = sorted(opts.keys(), key=lambda x: optsort(x, optorder)) for name in opts_keys: - if name in ignore: continue - val = opts[name]['value'] - if val == '': val = 'on' - #print(f" {name} = {val}") - outfile.write(ini_fmt.format(name.lower(), val) + '\n') + if name in ignore: + continue + val = opts[name]["value"] + if val == "": + val = "on" + # print(f" {name} = {val}") + outfile.write(ini_fmt.format(name.lower(), val) + "\n") else: # Standard export just dumps config:basic and config:advanced sections for header in real_config: - outfile.write(f'\n[{filegrp[header]}]\n') + outfile.write(f"\n[{filegrp[header]}]\n") opts = real_config[header] opts_keys = sorted(opts.keys(), key=lambda x: optsort(x, optorder)) for name in opts_keys: - if name in ignore: continue - val = opts[name]['value'] - if val == '': val = 'on' - outfile.write(ini_fmt.format(name.lower(), val) + '\n') + if name in ignore: + continue + val = opts[name]["value"] + if val == "": + val = "on" + outfile.write(ini_fmt.format(name.lower(), val) + "\n") # # CONFIG_EXPORT 5 or 105 = Config.h @@ -371,48 +656,68 @@ def optsort(x, optorder): if config_dump == 5: print(yellow + "Generating Config-export.h ...") - config_h = Path('Marlin', 'Config-export.h') - with config_h.open('w') as outfile: - filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' } + config_h = Path("Marlin", "Config-export.h") + with config_h.open("w") as outfile: + filegrp = { + "Configuration.h" : "config:basic", + "Configuration_adv.h": "config:advanced" + } vers = build_defines["CONFIGURATION_H_VERSION"] dt_string = datetime.utcnow().strftime("%Y-%m-%d at %H:%M:%S") - out_text = f'''/** + out_text = f"""/** * Config.h - Marlin Firmware distilled configuration * Usage: Place this file in the 'Marlin' folder with the name 'Config.h'. * * Exported by Marlin build on {dt_string}. */ -''' - - subs = (('Bltouch','BLTouch'),('hchop','hChop'),('Eeprom','EEPROM'),('Gcode','G-code'),('lguard','lGuard'),('Idex','IDEX'),('Lcd','LCD'),('Mpc','MPC'),('Pid','PID'),('Psu','PSU'),('Scara','SCARA'),('Spi','SPI'),('Tmc','TMC'),('Tpara','TPARA')) - define_fmt = '#define {0:40} {1}' +""" + + subs = ( + ("Bltouch", "BLTouch"), + ("hchop", "hChop"), + ("Eeprom", "EEPROM"), + ("Gcode", "G-code"), + ("lguard", "lGuard"), + ("Idex", "IDEX"), + ("Lcd", "LCD"), + ("Mpc", "MPC"), + ("Pid", "PID"), + ("Psu", "PSU"), + ("Scara", "SCARA"), + ("Spi", "SPI"), + ("Tmc", "TMC"), + ("Tpara", "TPARA") + ) + define_fmt = "#define {0:40} {1}" if extended_dump: # Loop through the sections for skey in sections: - #print(f" skey: {skey}") + # print(f" skey: {skey}") opts = sections[skey] headed = False opts_keys = sorted(opts.keys(), key=lambda x: optsort(x, optorder)) for name in opts_keys: - if name in ignore: continue - val = opts[name]['value'] + if name in ignore: + continue + val = opts[name]["value"] if not headed: head = reduce(lambda s, r: s.replace(*r), subs, skey.title()) out_text += f"\n//\n// {head}\n//\n" headed = True - out_text += define_fmt.format(name, val).strip() + '\n' + out_text += define_fmt.format(name, val).strip() + "\n" else: # Dump config options in just two sections, by file for header in real_config: - out_text += f'\n/**\n * Overrides for {header}\n */\n' + out_text += f"\n/**\n * Overrides for {header}\n */\n" opts = real_config[header] opts_keys = sorted(opts.keys(), key=lambda x: optsort(x, optorder)) for name in opts_keys: - if name in ignore: continue - val = opts[name]['value'] - out_text += define_fmt.format(name, val).strip() + '\n' + if name in ignore: + continue + val = opts[name]["value"] + out_text += define_fmt.format(name, val).strip() + "\n" outfile.write(out_text) @@ -427,10 +732,10 @@ def optsort(x, optorder): # if config_dump in (3, 13): print(yellow + "Generating schema.json ...") - schema.dump_json(conf_schema, build_path / 'schema.json') + schema.dump_json(conf_schema, build_path / "schema.json") if config_dump == 13: schema.group_options(conf_schema) - schema.dump_json(conf_schema, build_path / 'schema_grouped.json') + schema.dump_json(conf_schema, build_path / "schema_grouped.json") # # 4 = schema.yml @@ -442,17 +747,17 @@ def optsort(x, optorder): except ImportError: env.Execute(env.VerboseAction( '$PYTHONEXE -m pip install "pyyaml"', - "Installing YAML for schema.yml export", + "Installing YAML for schema.yml export" )) import yaml - schema.dump_yaml(conf_schema, build_path / 'schema.yml') + schema.dump_yaml(conf_schema, build_path / "schema.yml") # # Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_EXPORT == 1 or 101 # Skip if an identical JSON file was already present. # if not same_hash and (config_dump == 1 or is_embed): - with marlin_json.open('w') as outfile: + with marlin_json.open("w") as outfile: json_data = {} if extended_dump: @@ -461,40 +766,43 @@ def optsort(x, optorder): confs = real_config[header] json_data[header] = {} for name in confs: - if name in ignore: continue + if name in ignore: + continue c = confs[name] - s = c['section'] - if s not in json_data[header]: json_data[header][s] = {} - json_data[header][s][name] = c['value'] + s = c["section"] + if s not in json_data[header]: + json_data[header][s] = {} + json_data[header][s][name] = c["value"] else: for header in real_config: json_data[header] = {} conf = real_config[header] - #print(f"real_config[{header}]", conf) + # print(f"real_config[{header}]", conf) for name in conf: - if name in ignore: continue - json_data[header][name] = conf[name]['value'] + if name in ignore: + continue + json_data[header][name] = conf[name]["value"] - json_data['__INITIAL_HASH'] = hashes + json_data["__INITIAL_HASH"] = hashes # Append the source code version and date - json_data['VERSION'] = { - 'DETAILED_BUILD_VERSION': cleaned_build_defines['DETAILED_BUILD_VERSION'], - 'STRING_DISTRIBUTION_DATE': cleaned_build_defines['STRING_DISTRIBUTION_DATE'] + json_data["VERSION"] = { + "DETAILED_BUILD_VERSION" : cleaned_build_defines["DETAILED_BUILD_VERSION"], + "STRING_DISTRIBUTION_DATE": cleaned_build_defines["STRING_DISTRIBUTION_DATE"] } try: curver = subprocess.check_output(["git", "describe", "--match=NeVeRmAtCh", "--always"]).strip() - json_data['VERSION']['GIT_REF'] = curver.decode() + json_data["VERSION"]["GIT_REF"] = curver.decode() except: pass - json.dump(json_data, outfile, separators=(',', ':')) + json.dump(json_data, outfile, separators=(",", ":")) # # The rest only applies to CONFIGURATION_EMBEDDING # if not is_embed: - (build_path / 'mc.zip').unlink(missing_ok=True) + (build_path / "mc.zip").unlink(missing_ok=True) return # Compress the JSON file as much as we can @@ -502,20 +810,22 @@ def optsort(x, optorder): compress_file(marlin_json, json_name, marlin_zip) # Generate a C source file containing the entire ZIP file as an array - with open('Marlin/src/mczip.h','wb') as result_file: + with open("Marlin/src/mczip.h", "wb") as result_file: result_file.write( - b'#ifndef NO_CONFIGURATION_EMBEDDING_WARNING\n' - + b' #warning "Generated file \'mc.zip\' is embedded (Define NO_CONFIGURATION_EMBEDDING_WARNING to suppress this warning.)"\n' - + b'#endif\n' - + b'const unsigned char mc_zip[] PROGMEM = {\n ' + b"#ifndef NO_CONFIGURATION_EMBEDDING_WARNING\n" + + b" #warning \"Generated file 'mc.zip' is embedded (Define NO_CONFIGURATION_EMBEDDING_WARNING to suppress this warning.)\"\n" + + b"#endif\n" + + b"const unsigned char mc_zip[] PROGMEM = {\n " ) count = 0 - for b in (build_path / 'mc.zip').open('rb').read(): - result_file.write(b' 0x%02X,' % b) + for b in (build_path / "mc.zip").open("rb").read(): + result_file.write(b" 0x%02X," % b) count += 1 - if count % 16 == 0: result_file.write(b'\n ') - if count % 16: result_file.write(b'\n') - result_file.write(b'};\n') + if count % 16 == 0: + result_file.write(b"\n ") + if count % 16: + result_file.write(b"\n") + result_file.write(b"};\n") if __name__ == "__main__": # Build required. From command line just explain usage. diff --git a/buildroot/share/PlatformIO/scripts/simulator.py b/buildroot/share/PlatformIO/scripts/simulator.py index 2b30ec32c0..79cd6be4cd 100644 --- a/buildroot/share/PlatformIO/scripts/simulator.py +++ b/buildroot/share/PlatformIO/scripts/simulator.py @@ -13,7 +13,6 @@ # # Give the binary a distinctive name # - env['PROGNAME'] = "MarlinSimulator" # @@ -21,25 +20,23 @@ # emsg = '' fatal = 0 + import sys if sys.platform == 'darwin': - import shutil gcc = shutil.which('gcc') - if gcc == '' or gcc == '/usr/bin/gcc': - if gcc == '': + if not gcc or gcc == '/usr/bin/gcc': + if not gcc: emsg = "\u001b[31mNo GCC found in your configured shell PATH." elif gcc == '/usr/bin/gcc': emsg = "\u001b[31mCan't build Marlin Native on macOS using the included version of GCC (clang)." emsg += "\n\u001b[31mSee 'native.ini' for instructions to install GCC with MacPorts or Homebrew." fatal = 1 - else: - # # Silence half of the ranlib warnings. (No equivalent for 'ARFLAGS') # - env['RANLIBFLAGS'] += [ "-no_warning_for_no_symbols" ] + env['RANLIBFLAGS'] += ["-no_warning_for_no_symbols"] # Default paths for Xcode and a lucky GL/gl.h dropped by Mesa xcode_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" @@ -48,22 +45,19 @@ import os.path if os.path.exists(xcode_path): - - env['BUILD_FLAGS'] += [ "-F" + xcode_path ] + env['BUILD_FLAGS'] += ["-F" + xcode_path] emsg = "\u001b[33mUsing OpenGL framework headers from Xcode.app" - elif os.path.exists(mesa_path): - - env['BUILD_FLAGS'] += [ '-D__MESA__' ] + env['BUILD_FLAGS'] += ['-D__MESA__'] emsg = f"\u001b[33mUsing OpenGL header from {mesa_path}" - else: - emsg = "\u001b[31mNo OpenGL headers found. Install Xcode for matching headers, or use 'sudo port install mesa' to get a GL/gl.h." fatal = 1 # Print error message, if any - if emsg: print(f"\n\n{emsg}\n\n") + if emsg: + print(f"\n\n{emsg}\n\n") # Break out of the PIO build immediately - if fatal: sys.exit(1) + if fatal: + sys.exit(1) diff --git a/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py b/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py index f02e1b579d..59853e4f65 100644 --- a/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py +++ b/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py @@ -15,9 +15,11 @@ def getBuildFlagValue(name): # Get an overriding buffer size for RX or TX from the build flags def getInternalSize(side): - return getBuildFlagValue(f"MF_{side}_BUFFER_SIZE") or \ - getBuildFlagValue(f"SERIAL_{side}_BUFFER_SIZE") or \ - getBuildFlagValue(f"USART_{side}_BUF_SIZE") + return ( + getBuildFlagValue(f"MF_{side}_BUFFER_SIZE") + or getBuildFlagValue(f"SERIAL_{side}_BUFFER_SIZE") + or getBuildFlagValue(f"USART_{side}_BUF_SIZE") + ) # Get the largest defined buffer size for RX or TX def getBufferSize(side, default): @@ -47,7 +49,7 @@ def tryAddFlag(name, value): # # If MF_*_BUFFER_SIZE, SERIAL_*_BUFFER_SIZE, USART_*_BUF_SIZE, are # defined, the first of these values will be used as the minimum. - build_flags = env.ParseFlags(env.get('BUILD_FLAGS'))["CPPDEFINES"] + build_flags = env.ParseFlags(env.get("BUILD_FLAGS"))["CPPDEFINES"] mf = env["MARLIN_FEATURES"] # Get the largest defined buffer sizes for RX or TX, using defaults for undefined diff --git a/buildroot/share/dwin/bin/DWIN_ICO.py b/buildroot/share/dwin/bin/DWIN_ICO.py index d132000db6..b855dc079e 100644 --- a/buildroot/share/dwin/bin/DWIN_ICO.py +++ b/buildroot/share/dwin/bin/DWIN_ICO.py @@ -90,7 +90,7 @@ def _parseHeader(self, infile): count += 1 def _splitEntryData(self, infile, outDir): - print('Splitting Entry Data...') + print("Splitting Entry Data...") if 0 == len(self.entries): raise RuntimeError('.ico file is not loaded yet') @@ -111,7 +111,7 @@ def _splitEntryData(self, infile, outDir): blob = infile.read(entry.length) outfile.write(blob) # Seek file position, read length bytes, and write to new output file. - print('(%3d: width=%3d height=%3d offset=%6d len=%4d) ... %s' % + print("(%3d: width=%3d height=%3d offset=%6d len=%4d) ... %s" % (count, entry.width, entry.height, entry.offset, entry.length, os.path.basename(outfilename))) count += 1 @@ -127,17 +127,17 @@ def createFile(self, iconDir, filename): """ self.entries = [Entry() for i in range(0,256)] # 1. Scan icon directory and record all valid files - print('Scanning icon directory', iconDir) + print("Scanning icon directory", iconDir) count = 0 for dirEntry in os.scandir(iconDir): if not dirEntry.is_file(): - print('...Ignoring', dirEntry.path) + print("...Ignoring", dirEntry.path) continue # process each file: try: index = int(dirEntry.name[0:3]) if not (0 <= index <= 255): - print('...Ignoring invalid index on', dirEntry.path) + print("...Ignoring invalid index on", dirEntry.path) continue # dirEntry.path is iconDir/name w,h = getJpegResolution(dirEntry.path) @@ -149,16 +149,16 @@ def createFile(self, iconDir, filename): e.filename = dirEntry.path count += 1 except Exception as e: - print('Whoops: ', e) + print("Whoops: ", e) pass - print('...Scanned %d icon files' % (count)) + print("...Scanned %d icon files" % (count)) # 2. Scan over valid header entries and update offsets self._updateHeaderOffsets() # 3. Write out header to .ico file, the append each icon file self._combineAndWriteIcoFile(filename) - print('Scanning done. %d icons included.' % (count)) + print("Scanning done. %d icons included." % (count)) def _updateHeaderOffsets(self): """Iterate over all header entries and update their offsets. @@ -170,7 +170,7 @@ def _updateHeaderOffsets(self): continue e.offset = offset offset += e.length - # print('%03d: (%d x %d) len=%d off=%d' % + # print("%03d: (%d x %d) len=%d off=%d" % # (i, e.width, e.height, e.length, e.offset)) def _combineAndWriteIcoFile(self, filename): diff --git a/buildroot/share/dwin/bin/makeIco.py b/buildroot/share/dwin/bin/makeIco.py index b69b046a1e..cd16f62fae 100755 --- a/buildroot/share/dwin/bin/makeIco.py +++ b/buildroot/share/dwin/bin/makeIco.py @@ -46,4 +46,4 @@ ico.createFile(iconDir, filename) except Exception as e: - print('Error: ', e) + print("Error: ", e) diff --git a/buildroot/share/dwin/bin/splitIco.py b/buildroot/share/dwin/bin/splitIco.py index a1a20971b7..a5cdfece8d 100755 --- a/buildroot/share/dwin/bin/splitIco.py +++ b/buildroot/share/dwin/bin/splitIco.py @@ -41,9 +41,9 @@ if os.path.exists(outputDir): raise RuntimeError("Output directory '%s' already exists." % (outputDir)) - print('Splitting %s into dir %s' % (filename, outputDir)) + print("Splitting %s into dir %s" % (filename, outputDir)) ico = DWIN_ICO.DWIN_ICO_File() ico.splitFile(filename, outputDir) except Exception as e: - print('Error: ', e) + print("Error: ", e) diff --git a/buildroot/share/fonts/buildhzk.py b/buildroot/share/fonts/buildhzk.py index 2b59980f66..d82b8737a2 100644 --- a/buildroot/share/fonts/buildhzk.py +++ b/buildroot/share/fonts/buildhzk.py @@ -30,22 +30,22 @@ def glyph_bits(size_x, size_y, font, glyph_ord): def marlin_font_hzk(): fonts = [ - [6,12,'marlin-6x12-3.bdf'], - [8,16,'marlin-8x16.bdf'], - [10,20,'marlin-10x20.bdf'], - [12,24,'marlin-12x24.bdf'], - [14,28,'marlin-14x28.bdf'], - [16,32,'marlin-16x32.bdf'], - [20,40,'marlin-20x40.bdf'], - [24,48,'marlin-24x48.bdf'], - [28,56,'marlin-28x56.bdf'], - [32,64,'marlin-32x64.bdf'] + [ 6, 12, 'marlin-6x12-3.bdf'], + [ 8, 16, 'marlin-8x16.bdf'], + [10, 20, 'marlin-10x20.bdf'], + [12, 24, 'marlin-12x24.bdf'], + [14, 28, 'marlin-14x28.bdf'], + [16, 32, 'marlin-16x32.bdf'], + [20, 40, 'marlin-20x40.bdf'], + [24, 48, 'marlin-24x48.bdf'], + [28, 56, 'marlin-28x56.bdf'], + [32, 64, 'marlin-32x64.bdf'] ] - with open('marlin_fixed.hzk','wb') as output: + with open('marlin_fixed.hzk', 'wb') as output: for f in fonts: with open(f[2], 'rb') as file: - print(f'{f[0]}x{f[1]}') + print(f"{f[0]}x{f[1]}") font = bdflib.reader.read_bdf(file) for glyph in range(128): bits = glyph_bits(f[0], f[1], font, glyph) @@ -56,8 +56,8 @@ def marlin_font_hzk(): z = b.to_bytes(glyph_bytes, 'big') output.write(z) except OverflowError: - print('Overflow') - print(f'{glyph}') + print("Overflow") + print(f"{glyph}") print(font[glyph]) for b in bits: print(f'{b:0{f[0]}b}') return diff --git a/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino b/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino index 6dcfb67c54..8aab3be971 100644 --- a/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino +++ b/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino @@ -15,12 +15,12 @@ void setup() { if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) { for (int j = 0; j < NUM_ANALOG_INPUTS; j++) { if (analogInputToDigitalPin(j) == i) { - Serial.print('A'); + Serial.print("A"); Serial.print(j); Serial.print(" = "); } } - Serial.print('D'); + Serial.print("D"); Serial.println(i); } } diff --git a/buildroot/share/scripts/g29_auto.py b/buildroot/share/scripts/g29_auto.py index 5cf27b9968..b864223804 100755 --- a/buildroot/share/scripts/g29_auto.py +++ b/buildroot/share/scripts/g29_auto.py @@ -107,10 +107,12 @@ def z_parse(gcode, start_at_line=0, end_at_line=0): last_i = -1 while len(gcode) > i: - try: - z, i = find_z(gcode, i + 1) - except TypeError: - break + result = find_z(gcode, i + 1) + + if result is None: + break # Exit loop if find_z() returns None + + z, i = result # Now safe to unpack all_z.append(z) z_at_line.append(i) @@ -119,7 +121,7 @@ def z_parse(gcode, start_at_line=0, end_at_line=0): # last_z = z last_i = i if 0 < end_at_line <= i or temp_line >= min_g1: - # print('break at line {} at height {}'.format(i, z)) + # print("break at line {} at height {}"".format(i, z)) break line_between_z = line_between_z[1:] @@ -133,7 +135,7 @@ def get_lines(gcode, minimum): for count in line_between_z: i += 1 if count > minimum: - # print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i])) + # print("layer: {}:{}".format(z_at_line[i-1], z_at_line[i])) return z_at_line[i - 1], z_at_line[i] @@ -147,21 +149,28 @@ def get_lines(gcode, minimum): gcode.append(line) file.close() -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 + for i in range(start, end): set_mima(gcode[i]) -print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y)) +print("x_min:{} x_max:{}\ny_min:{} y_max:{}".format(min_x, max_x, min_y, max_y)) # resize min/max - values for minimum scan if max_x - min_x < min_size: offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up - # print('min_x! with {}'.format(int(max_x - min_x))) + # print("min_x! with {}".format(int(max_x - min_x))) min_x = int(min_x) - offset_x max_x = int(max_x) + offset_x if max_y - min_y < min_size: offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up - # print('min_y! with {}'.format(int(max_y - min_y))) + # print("min_y! with {}".format(int(max_y - min_y))) min_y = int(min_y) - offset_y max_y = int(max_y) + offset_y @@ -172,17 +181,12 @@ def get_lines(gcode, minimum): max_y, probing_points) -out_file = open(output_file, 'w') -in_file = open(input_file, 'r') - -for line in in_file: - if line[:len(g29_keyword)].upper() == g29_keyword: - out_file.write(new_command) - print('write G29') - else: - out_file.write(line) - -file.close() -out_file.close() +with open(input_file, 'r') as in_file, open(output_file, 'w') as out_file: + for line in in_file: + if line.strip().upper().startswith(g29_keyword): # Improved condition + out_file.write(new_command) + print("write G29") + else: + out_file.write(line) -print('auto G29 finished') +print("auto G29 finished") diff --git a/buildroot/share/scripts/get_test_targets.py b/buildroot/share/scripts/get_test_targets.py index b187de9cac..2054ffb079 100644 --- a/buildroot/share/scripts/get_test_targets.py +++ b/buildroot/share/scripts/get_test_targets.py @@ -12,4 +12,4 @@ github_configuration = yaml.safe_load(f) # Print out the test platforms -print(' '.join(github_configuration['jobs']['test_builds']['strategy']['matrix']['test-platform'])) +print(" ".join(github_configuration['jobs']['test_builds']['strategy']['matrix']['test-platform'])) diff --git a/buildroot/share/scripts/languageImport.py b/buildroot/share/scripts/languageImport.py index 7341afbeab..8f4570a351 100755 --- a/buildroot/share/scripts/languageImport.py +++ b/buildroot/share/scripts/languageImport.py @@ -62,7 +62,7 @@ gothead = True numcols = len(row) if row[0] != 'name': - print('Error: first column should be "name"') + print("Error: first column should be 'name'") exit(1) # The rest of the columns are language codes and names for i in range(1, numcols): diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py index 0260d3174e..99defac172 100755 --- a/buildroot/share/scripts/pinsformat.py +++ b/buildroot/share/scripts/pinsformat.py @@ -37,13 +37,13 @@ def concat_with_space(s1, s2): # Pin patterns mpatt = [ r'-?\d{1,3}', r'P[A-I]\d+', r'P\d_\d+', r'Pin[A-Z]\d\b' ] mstr = '|'.join(mpatt) -mexpr = [ re.compile(f'^{m}$') for m in mpatt ] +mexpr = [ re.compile(f"^{m}$") for m in mpatt ] # Corrsponding padding for each pattern ppad = [ 3, 4, 5, 5 ] # Match a define line -definePinPatt = re.compile(rf'^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+?_PIN\s+({mstr})\s*(//.*)?$') +definePinPatt = re.compile(rf"^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+?_PIN\s+({mstr})\s*(//.*)?$") def format_pins(argv): src_file = 'stdin' @@ -74,7 +74,7 @@ def format_pins(argv): with open(src_file, 'r') as rf: file_text = rf.read() if len(file_text) == 0: - print('No text to process') + print("No text to process") return # Read from file or STDIN until it terminates @@ -110,7 +110,7 @@ def process_text(txt): if patt == None: return txt pmatch = patt['match'] - pindefPatt = re.compile(rf'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+({pmatch})\s*(//.*)?$') + pindefPatt = re.compile(rf"^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+({pmatch})\s*(//.*)?$") noPinPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(-1)\s*(//.*)?$') skipPatt1 = re.compile(r'^(\s*(//)?#define)\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|ERROR|EXTRUDERS|FREQ|ITEM|MKS_BASE_VERSION|MODULE|NAME|ONLY|ORIENTATION|PERIOD|RANGE|RATE|READ_RETRIES|SERIAL|SIZE|SPI|STATE|STEP|TIMER|VERSION))\s+(.+)\s*(//.*)?$') skipPatt2 = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\s*(//.*)?$') @@ -142,7 +142,7 @@ def tryPindef(d): if r == None: return False logmsg("pin:", line) pinnum = r[4] if r[4][0] == 'P' else lpad(r[4], patt['pad']) - line = f'{r[1]} {r[3]}' + line = f"{r[1]} {r[3]}" line = concat_with_space(rpad(line, col_value_lj), pinnum) if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line @@ -156,7 +156,7 @@ def tryNoPin(d): r = noPinPatt.match(line) if r == None: return False logmsg("pin -1:", line) - line = f'{r[1]} {r[3]}' + line = f"{r[1]} {r[3]}" line = concat_with_space(rpad(line, col_value_lj), '-1') if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line @@ -186,7 +186,7 @@ def tryAlias(d): r = aliasPatt.match(line) if r == None: return False logmsg("alias:", line) - line = f'{r[1]} {r[3]}' + line = f"{r[1]} {r[3]}" line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) if r[5]: line = concat_with_space(rpad(line, col_comment), r[5]) d['line'] = line @@ -200,7 +200,7 @@ def trySwitch(d): r = switchPatt.match(line) if r == None: return False logmsg("switch:", line) - line = f'{r[1]} {r[3]}' + line = f"{r[1]} {r[3]}" if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line d['check_comment_next'] = True @@ -214,7 +214,7 @@ def tryDef(d): r = defPatt.match(line) if r == None: return False logmsg("def:", line) - line = f'{r[1]} {r[3]} ' + line = f"{r[1]} {r[3]}" line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) if r[5]: line = rpad(line, col_comment - 1) + ' ' + r[5] d['line'] = line @@ -228,7 +228,7 @@ def tryUndef(d): r = undefPatt.match(line) if r == None: return False logmsg("undef:", line) - line = f'{r[1]} {r[3]}' + line = f"{r[1]} {r[3]}" if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line return True diff --git a/buildroot/share/scripts/rle16_compress_cpp_image_data.py b/buildroot/share/scripts/rle16_compress_cpp_image_data.py index ed0c640fb8..ca93be5606 100755 --- a/buildroot/share/scripts/rle16_compress_cpp_image_data.py +++ b/buildroot/share/scripts/rle16_compress_cpp_image_data.py @@ -29,7 +29,7 @@ def addCompressedData(input_file, output_file): c_footer = True if c_data_section: - cleaned = re.sub(r"\s|,|\n", "", line) + cleaned = re.sub(r'\s|,|\n', "", line) as_list = cleaned.split("0x") as_list.pop(0) raw_data += [int(x, 16) for x in as_list] diff --git a/buildroot/share/scripts/rle_compress_bitmap.py b/buildroot/share/scripts/rle_compress_bitmap.py index d33f7be280..4dd5bc2074 100755 --- a/buildroot/share/scripts/rle_compress_bitmap.py +++ b/buildroot/share/scripts/rle_compress_bitmap.py @@ -34,7 +34,7 @@ def addCompressedData(input_file, output_file): c_footer = True if c_data_section: - cleaned = re.sub(r"\s|,|\n", "", line) + cleaned = re.sub(r'\s|,|\n', "", line) mat = re.match(r'(0b|B)[01]{8}', cleaned) if mat: as_list = cleaned.split(mat[1]) @@ -181,11 +181,11 @@ def rle_emit(ofile, arrname, rledata, rawsize, isext): checkdata = bitwise_rle_decode(isext, rledata) for i in range(0, len(checkdata)): if raw_data[i] != checkdata[i]: - print(f'Data mismatch at byte offset {i} (should be {raw_data[i]} but got {checkdata[i]})') + print(f"Data mismatch at byte offset {i} (should be {raw_data[i]} but got {checkdata[i]})") break if len(sys.argv) <= 2: - print('Usage: rle_compress_bitmap.py INPUT_FILE OUTPUT_FILE') + print("Usage: rle_compress_bitmap.py INPUT_FILE OUTPUT_FILE") exit(1) output_h = sys.argv[2] diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index 4e7b6d2316..91bf4b64cd 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -55,7 +55,7 @@ def _ClosePort(): debugPrint('OK') def _Send(data): - debugPrint(f'>> {data}') + debugPrint(f">> {data}") strdata = bytearray(data, 'utf8') + b'\n' port.write(strdata) time.sleep(0.010) @@ -68,7 +68,7 @@ def _Recv(): try: clean_response = Resp.decode('utf8').rstrip().lstrip() clean_responses.append(clean_response) - debugPrint(f'<< {clean_response}') + debugPrint(f"<< {clean_response}") except: pass return clean_responses @@ -112,7 +112,7 @@ def _FilterFirmwareFiles(FirmwareList, UseLongFilenames): return Firmwares def _RemoveFirmwareFile(FirmwareFile): - _Send(f'M30 /{FirmwareFile}') + _Send(f"M30 /{FirmwareFile}") Responses = _Recv() Removed = len(Responses) >= 1 and any('File deleted' in r for r in Responses) if not Removed: @@ -127,7 +127,7 @@ def _RollbackUpload(FirmwareFile): time.sleep(1) # Remount SD card _CheckSDCard() - print(' OK' if _RemoveFirmwareFile(FirmwareFile) else ' Error!') + print(" OK" if _RemoveFirmwareFile(FirmwareFile) else " Error!") _ClosePort() @@ -199,29 +199,29 @@ def _RollbackUpload(FirmwareFile): # Dump some debug info if Debug: - print('Upload using:') - print('---- Marlin -----------------------------------') - print(f' PIOENV : {marlin_pioenv}') - print(f' SHORT_BUILD_VERSION : {marlin_short_build_version}') - print(f' STRING_CONFIG_H_AUTHOR : {marlin_string_config_h_author}') - print(f' MOTHERBOARD : {marlin_motherboard}') - print(f' BOARD_INFO_NAME : {marlin_board_info_name}') - print(f' CUSTOM_BUILD_FLAGS : {marlin_board_custom_build_flags}') - print(f' FIRMWARE_BIN : {marlin_firmware_bin}') - print(f' LONG_FILENAME_HOST_SUPPORT : {marlin_long_filename_host_support}') - print(f' LONG_FILENAME_WRITE_SUPPORT : {marlin_longname_write}') - print(f' CUSTOM_FIRMWARE_UPLOAD : {marlin_custom_firmware_upload}') - print('---- Upload parameters ------------------------') - print(f' Source : {upload_firmware_source_path}') - print(f' Target : {upload_firmware_target_name}') - print(f' Port : {upload_port} @ {upload_speed} baudrate') - print(f' Timeout : {upload_timeout}') - print(f' Block size : {upload_blocksize}') - print(f' Compression : {upload_compression}') - print(f' Error ratio : {upload_error_ratio}') - print(f' Test : {upload_test}') - print(f' Reset : {upload_reset}') - print('-----------------------------------------------') + print("Upload using:") + print("---- Marlin -----------------------------------") + print(f" PIOENV : {marlin_pioenv}") + print(f" SHORT_BUILD_VERSION : {marlin_short_build_version}") + print(f" STRING_CONFIG_H_AUTHOR : {marlin_string_config_h_author}") + print(f" MOTHERBOARD : {marlin_motherboard}") + print(f" BOARD_INFO_NAME : {marlin_board_info_name}") + print(f" CUSTOM_BUILD_FLAGS : {marlin_board_custom_build_flags}") + print(f" FIRMWARE_BIN : {marlin_firmware_bin}") + print(f" LONG_FILENAME_HOST_SUPPORT : {marlin_long_filename_host_support}") + print(f" LONG_FILENAME_WRITE_SUPPORT : {marlin_longname_write}") + print(f" CUSTOM_FIRMWARE_UPLOAD : {marlin_custom_firmware_upload}") + print("---- Upload parameters ------------------------") + print(f" Source : {upload_firmware_source_path}") + print(f" Target : {upload_firmware_target_name}") + print(f" Port : {upload_port} @ {upload_speed} baudrate") + print(f" Timeout : {upload_timeout}") + print(f" Block size : {upload_blocksize}") + print(f" Compression : {upload_compression}") + print(f" Error ratio : {upload_error_ratio}") + print(f" Test : {upload_test}") + print(f" Reset : {upload_reset}") + print("-----------------------------------------------") # Custom implementations based on board parameters # Generate a new 8.3 random filename @@ -246,17 +246,17 @@ def _RollbackUpload(FirmwareFile): FirmwareFiles = _GetFirmwareFiles(marlin_long_filename_host_support) if Debug: for FirmwareFile in FirmwareFiles: - print(f'Found: {FirmwareFile}') + print(f"Found: {FirmwareFile}") # Get all 1st level firmware files (to remove) OldFirmwareFiles = _FilterFirmwareFiles(FirmwareFiles[1:len(FirmwareFiles)-2], marlin_long_filename_host_support) # Skip header and footers of list if len(OldFirmwareFiles) == 0: - print('No old firmware files to delete') + print("No old firmware files to delete") else: print(f"Remove {len(OldFirmwareFiles)} old firmware file{'s' if len(OldFirmwareFiles) != 1 else ''}:") for OldFirmwareFile in OldFirmwareFiles: print(f" -Removing- '{OldFirmwareFile}'...") - print(' OK' if _RemoveFirmwareFile(OldFirmwareFile) else ' Error!') + print(" OK" if _RemoveFirmwareFile(OldFirmwareFile) else " Error!") # Close serial _ClosePort() @@ -281,9 +281,9 @@ def _RollbackUpload(FirmwareFile): protocol.send_ascii('M117 Firmware uploaded' if transferOK else 'M117 Firmware upload failed') # Remount SD card - print('Wait for SD card release...') + print("Wait for SD card release...") time.sleep(1) - print('Remount SD card') + print("Remount SD card") protocol.send_ascii('M21') # Transfer failed? @@ -293,15 +293,15 @@ def _RollbackUpload(FirmwareFile): else: # Trigger firmware update if upload_reset: - print('Trigger firmware update...') + print("Trigger firmware update...") protocol.send_ascii('M997', True) protocol.shutdown() - print('Firmware update completed' if transferOK else 'Firmware update failed') + print("Firmware update completed" if transferOK else "Firmware update failed") return 0 if transferOK else -1 except KeyboardInterrupt: - print('Aborted by user') + print("Aborted by user") if filetransfer: filetransfer.abort() if protocol: protocol.disconnect() @@ -312,7 +312,7 @@ def _RollbackUpload(FirmwareFile): except serial.SerialException as se: # This exception is raised only for send_ascii data (not for binary transfer) - print(f'Serial excepion: {se}, transfer aborted') + print(f"Serial excepion: {se}, transfer aborted") if protocol: protocol.disconnect() protocol.shutdown() @@ -321,7 +321,7 @@ def _RollbackUpload(FirmwareFile): raise Exception(se) except MarlinBinaryProtocol.FatalError: - print('Too many retries, transfer aborted') + print("Too many retries, transfer aborted") if protocol: protocol.disconnect() protocol.shutdown() @@ -336,7 +336,7 @@ def _RollbackUpload(FirmwareFile): protocol.shutdown() _RollbackUpload(upload_firmware_target_name) _ClosePort() - print('Firmware not updated') + print("Firmware not updated") raise # Attach custom upload callback diff --git a/buildroot/share/scripts/validate_boards.py b/buildroot/share/scripts/validate_boards.py index 8d5650d6c6..e4869c8904 100755 --- a/buildroot/share/scripts/validate_boards.py +++ b/buildroot/share/scripts/validate_boards.py @@ -65,10 +65,10 @@ def boards_checks(argv): if number != last_number + 1: if int(number / 100) != int(last_number / 100): if number % 100 != 0 and number < 9900: - err(board, f'is {number} (should be {group * 100}?)') + err(board, f"is {number} (should be {group * 100}?)") ERRS += 1 elif number > 1040: - err(board, f'is {number} but previous board is {last_number}') + err(board, f"is {number} but previous board is {last_number}") ERRS += 1 if not comment: err(board, ' has no comment') @@ -77,7 +77,7 @@ def boards_checks(argv): cshor = bshort(board) cbore = cshor.replace('_', '') if comment == board or comment == cshor or comment == cbore: - warn(board, f'comment needs more detail') + warn(board, f"comment needs more detail") last_number = number last_group = number % 100 @@ -103,20 +103,20 @@ def boards_checks(argv): boards_boards = [b[0] for b in boards] if set(pins_boards) != set(boards_boards): ERRS += 1 - print(f'[ERROR] Boards in pins.h do not match boards.h') + print(f"[ERROR] Boards in pins.h do not match boards.h") # Show the differences only for b in boards: if b[0] not in pins_boards: - print(f' pins.h missing: {b[0]}') + print(f" pins.h missing: {b[0]}") for b in pins_boards: if b not in boards_boards: - print(f' boards.h missing: {b}') + print(f" boards.h missing: {b}") # Check that boards_boards and pins_boards are in the same order for i in range(len(boards_boards)): if boards_boards[i] != pins_boards[i]: ERRS += 1 - print(f'[ERROR] Non-matching boards order in pins.h. Expected {bshort(boards_boards[i])} but got {bshort(pins_boards[i])}') + print(f"[ERROR] Non-matching boards order in pins.h. Expected {bshort(boards_boards[i])} but got {bshort(pins_boards[i])}") break return ERRS @@ -124,5 +124,5 @@ def boards_checks(argv): if __name__ == '__main__': ERR_COUNT = boards_checks(sys.argv[1:]) if ERR_COUNT: - print(f'\nFound {ERR_COUNT} errors') + print(f"\nFound {ERR_COUNT} errors") sys.exit(1) diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 0bf8d9eda4..4ef8f09cea 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -23,7 +23,7 @@ # HAL/STM32F1 Common Environment values # [STM32F1_maple] -platform = ststm32@~18.0.0 +platform = ststm32@~19.0.0 board_build.core = maple build_flags = !python buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py ${common.build_flags} -DARDUINO_ARCH_STM32 -DMAPLE_STM32F1 -DPLATFORM_M997_SUPPORT