From f27f29ba998cb6a099ea1b09fb55edeb6474e8ea Mon Sep 17 00:00:00 2001 From: Mitch Bradley Date: Wed, 22 Apr 2020 14:51:48 -1000 Subject: [PATCH] Removed add-on configurations The new Spindle Class is a much better solution to the problem that add-on's were intended to address. --- Grbl_Esp32/machine.h | 14 -------------- build-all.ps1 | 14 ++------------ build-all.py | 6 +----- build-all.sh | 18 ++---------------- build-machine.py | 10 ++++------ builder.py | 16 ++++++---------- 6 files changed, 15 insertions(+), 63 deletions(-) diff --git a/Grbl_Esp32/machine.h b/Grbl_Esp32/machine.h index d57814c4..1f99481c 100644 --- a/Grbl_Esp32/machine.h +++ b/Grbl_Esp32/machine.h @@ -14,12 +14,6 @@ // from Machines/, for example: // #include "Machines/3axis_v4.h" -// Some configurations use two files, the first establishing a base -// configuration and the second providing additional customization, -// for example: -// #include "Machines/3axis_v4.h" -// #include "Machines/add_esc_spindle.h" - // === OEM Single File Configuration Option // OEMs that wish to publish source code that is configured for a // specific machine may put all of their configuration definitions @@ -49,14 +43,6 @@ #include MACHINE_PATHNAME_QUOTED(MACHINE_FILENAME) -// You can choose two-file configurations by also defining MACHINE_FILENAME2, -// for example: -// $env:PLATFORMIO_BUILD_FLAGS='-DMACHINE_FILENAME=3axis_v4.h -DMACHINE_FILENAME2=add_esc_spindle.h'; platformio run - -#ifdef MACHINE_FILENAME2 -#include MACHINE_PATHNAME_QUOTED(MACHINE_FILENAME2) -#endif - #endif // MACHINE_FILENAME #endif // _machine_h diff --git a/build-all.ps1 b/build-all.ps1 index a3f80810..113513d2 100644 --- a/build-all.ps1 +++ b/build-all.ps1 @@ -7,26 +7,16 @@ $env:PYTHONIOENCODING="utf-8" Function BuildMachine($names) { $basename = $names[0] - $addname = $names[1] $env:PLATFORMIO_BUILD_FLAGS = "-DMACHINE_FILENAME=$basename" $displayname = $basename - if ($addname -ne "") { - $env:PLATFORMIO_BUILD_FLAGS += " -DMACHINE_FILENAME2=$addname" - $displayname += " + $addname" - } Write-Output "Building machine $displayname" platformio run 2>&1 | Select-String error,Took Write-Output " " } -# First build all the base configurations with names that do not start with add_ -foreach ($filepath in Get-ChildItem -file .\Grbl_Esp32\Machines\* -Exclude add_*) { +# Build all the machines +foreach ($filepath in Get-ChildItem -file .\Grbl_Esp32\Machines\*) { BuildMachine($filepath.name, "") } -# Then build all of the add-ons on top of a single base -$base="3axis_v4.h" -foreach ($filepath in Get-ChildItem -file .\Grbl_Esp32\Machines\add_*) { - BuildMachine($base, $filepath.name) -} Remove-Item env:PLATFORMIO_BUILD_FLAGS diff --git a/build-all.py b/build-all.py index 24c646df..45f53df8 100755 --- a/build-all.py +++ b/build-all.py @@ -22,12 +22,8 @@ cmd = ['platformio','run'] verbose = '-v' in sys.argv numErrors = 0 -adderBase = '3axis_v4.h' for name in os.listdir('Grbl_Esp32/Machines'): - if name.startswith('add_'): - exitCode = buildMachine(adderBase, addName=name, verbose=verbose) - else: - exitCode = buildMachine(name, verbose=verbose) + exitCode = buildMachine(name, verbose=verbose) if exitCode != 0: numErrors += 1 diff --git a/build-all.sh b/build-all.sh index 7da6ca0a..f0644acf 100755 --- a/build-all.sh +++ b/build-all.sh @@ -17,14 +17,8 @@ NUM_ERRORS=0 BuildMachine () { basename=$1 - addname=$2 BF="\"-DMACHINE_FILENAME=$basename\"" displayname=$basename - if [ "$addname" != "" ] - then - BF="$BF \"-DMACHINE_FILENAME2=$addname\"" - displayname="$basename + $addname" - fi echo "Building machine $displayname" PLATFORMIO_BUILD_FLAGS=$BF platformio run 2>&1 | $FILTER local re=$? @@ -38,18 +32,10 @@ BuildMachine () { echo } -# First build all the base configurations with names that do not start with add_ -for file in `ls ./Grbl_Esp32/Machines/* | grep -v add_\*`; do +# Build all the machines +for file in `ls ./Grbl_Esp32/Machines/*`; do base=`basename $file` BuildMachine $base "" done -# Then build all of the add-ons on top of a single base -base="3axis_v4.h" -for file in `ls ./Grbl_Esp32/Machines/add_*` -do - adder=`basename $file` - BuildMachine $base $adder -done - exit $NUM_ERRORS diff --git a/build-machine.py b/build-machine.py index aa821e39..29f75597 100755 --- a/build-machine.py +++ b/build-machine.py @@ -26,13 +26,11 @@ if '-u' in sys.argv: exitCode = 255 if len(sys.argv) == 2: - exitCode = buildMachine(sys.argv[1], addName=None, verbose=verbose, extraArgs=extraArgs) -elif len(sys.argv) == 3: - exitCode = buildMachine(sys.argv[1], addName=sys.argv[2], verbose=verbose, extraArgs=extraArgs) + exitCode = buildMachine(sys.argv[1], verbose=verbose, extraArgs=extraArgs) else: - print("Usage: ./build-machine.py [-q] [-u] machine_name.h [add_name.h]") - print(' Build for the given machine and optional add-on regardless of machine.h') + print("Usage: ./build-machine.py [-q] [-u] machine_name.h") + print(' Build for the given machine regardless of machine.h') print(' -q suppresses most messages') print(' -u uploads to the target after compilation') -sys.exit(exitCode) \ No newline at end of file +sys.exit(exitCode) diff --git a/builder.py b/builder.py index ba3bdb6a..68f9d095 100755 --- a/builder.py +++ b/builder.py @@ -1,24 +1,20 @@ # This script is imported by build-machine.py and build-all.py -# It performs a platformio build with a given base machine file -# and an optional add-on file. The verbose argument controls -# whether the full output is displayed, or filtered to show -# only summary information. extraArgs can be used to perform -# uploading after compilation. +# It performs a platformio build with a given machine file. +# The verbose argument controls whether the full output is +# displayed, or filtered to show only summary information. +# extraArgs can be used to perform uploading after compilation. from __future__ import print_function import subprocess, os env = dict(os.environ) -def buildMachine(baseName, addName=None, verbose=True, extraArgs=None): +def buildMachine(baseName, verbose=True, extraArgs=None): cmd = ['platformio','run'] if extraArgs: cmd.append(extraArgs) displayName = baseName flags = '-DMACHINE_FILENAME=' + baseName - if addName: - displayName += ' + ' + addName - flags += ' -DMACHINE_FILENAME2=' + addName print('Building machine ' + displayName) env['PLATFORMIO_BUILD_FLAGS'] = flags if verbose: @@ -30,4 +26,4 @@ def buildMachine(baseName, addName=None, verbose=True, extraArgs=None): print(line, end='') app.wait() print() - return app.returncode \ No newline at end of file + return app.returncode