1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-07-31 20:00:19 +02:00

Removed add-on configurations

The new Spindle Class is a much better solution to
the problem that add-on's were intended to address.
This commit is contained in:
Mitch Bradley
2020-04-22 14:51:48 -10:00
parent 84d185e672
commit f27f29ba99
6 changed files with 15 additions and 63 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)
sys.exit(exitCode)

View File

@@ -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
return app.returncode