Skip to content

Commit

Permalink
Updates from #24560
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiskeithb authored and thinkyhead committed Jul 29, 2022
1 parent 752f3d4 commit 2952f0b
Show file tree
Hide file tree
Showing 23 changed files with 164 additions and 149 deletions.
7 changes: 5 additions & 2 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ This project and everyone participating in it is governed by the [Marlin Code of
We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.

* [Marlin RepRap forum](https://reprap.org/forum/list.php?415)
* [MarlinFirmware on Facebook](https://www.facebook.com/groups/1049718498464482/)
- [Marlin Documentation](https://marlinfw.org) - Official Marlin documentation
- Facebook Group ["Marlin Firmware"](https://www.facebook.com/groups/1049718498464482/)
- RepRap.org [Marlin Forum](https://forums.reprap.org/list.php?415)
- Facebook Group ["Marlin Firmware for 3D Printers"](https://www.facebook.com/groups/3Dtechtalk/)
- [Marlin Configuration](https://www.youtube.com/results?search_query=marlin+configuration) on YouTube

If chat is more your speed, you can join the MarlinFirmware Discord server:

Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@

/**
* Extra G-code to run while executing tool-change commands. Can be used to use an additional
* stepper motor (I axis, see option LINEAR_AXES in Configuration.h) to drive the tool-changer.
* stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer.
*/
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void do_enable(const stepper_flags_t to_enable) {

if ((also_enabled &= ~(shall_enable | was_enabled))) {
SERIAL_CHAR('(');
LOOP_LINEAR_AXES(a) if (TEST(also_enabled, a)) SERIAL_CHAR(axis_codes[a], ' ');
LOOP_LINEAR_AXES(a) if (TEST(also_enabled, a)) SERIAL_CHAR(AXIS_CHAR(a), ' ');
#if HAS_EXTRUDERS
#define _EN_ALSO(N) if (TEST(also_enabled, INDEX_OF_AXIS(E_AXIS, N))) SERIAL_CHAR('E', '0' + N, ' ');
REPEAT(EXTRUDERS, _EN_ALSO)
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/gcode/feature/trinamic/M569.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {

if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, F("I2 Z"), true); }
if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, F("I3 Z"), true); }

#if HAS_I_AXIS
if (TERN0(I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop())) { say_M569(forReplay, FPSTR(SP_I_STR), true); }
#endif
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/gcode/geometry/M206_M428.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
*/
void GcodeSuite::M206() {
if (!parser.seen_any()) return M206_report();

LOOP_LINEAR_AXES(a)
if (parser.seenval(AXIS_CHAR(a))) set_home_offset((AxisEnum)a, parser.value_axis_units((AxisEnum)a));

#if ENABLED(MORGAN_SCARA)
if (parser.seenval('T')) set_home_offset(A_AXIS, parser.value_float()); // Theta
if (parser.seenval('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
Expand Down
27 changes: 2 additions & 25 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
* Number of Primary Linear Axes (e.g., XYZ)
* X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4)
*/
#if HAS_I_AXIS
#if LINEAR_AXES >= 3
#define PRIMARY_LINEAR_AXES 3
#else
#define PRIMARY_LINEAR_AXES LINEAR_AXES
Expand Down Expand Up @@ -961,7 +961,7 @@
#endif

/**
* Set a flag for any type of bed probe, including the paper-test
* Set flags for any form of bed probe
*/
#if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE, MAGLEV4)
#define HAS_BED_PROBE 1
Expand Down Expand Up @@ -1284,29 +1284,6 @@
#define HAS_ETHERNET 1
#endif

// Fallback axis inverting
#ifndef INVERT_X_DIR
#define INVERT_X_DIR false
#endif
#if HAS_Y_AXIS && !defined(INVERT_Y_DIR)
#define INVERT_Y_DIR false
#endif
#if HAS_Z_AXIS && !defined(INVERT_Z_DIR)
#define INVERT_Z_DIR false
#endif
#if HAS_I_AXIS && !defined(INVERT_I_DIR)
#define INVERT_I_DIR false
#endif
#if HAS_J_AXIS && !defined(INVERT_J_DIR)
#define INVERT_J_DIR false
#endif
#if HAS_K_AXIS && !defined(INVERT_K_DIR)
#define INVERT_K_DIR false
#endif
#if HAS_EXTRUDERS && !defined(INVERT_E_DIR)
#define INVERT_E_DIR false
#endif

/**
* This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation.
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ static void createChar_P(const char c, const byte * const ptr) {
#endif

#if ENABLED(LCD_USE_I2C_BUZZER)

void MarlinUI::buzz(const long duration, const uint16_t freq) {
if (!sound_on) return;
lcd.buzz(duration, freq);
if (sound_on) lcd.buzz(duration, freq);
}

#endif

void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARSET_INFO*/) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern xyze_pos_t current_position, // High-level current tool position

// G60/G61 Position Save and Return
#if SAVED_POSITIONS
extern uint8_t saved_slots[(SAVED_POSITIONS + 7) >> 3]; // TODO: Add support for LINEAR_AXES >= 4
extern uint8_t saved_slots[(SAVED_POSITIONS + 7) >> 3]; // TODO: Add support for HAS_I_AXIS
extern xyze_pos_t stored_position[SAVED_POSITIONS];
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -877,14 +877,14 @@
#undef BOARD_STM32F103R
#undef BOARD_ESP32
#undef BOARD_STEVAL
#undef BOARD_BIGTREE_SKR_MINI_E3
#undef BOARD_BIGTREE_SKR_V1_1
#undef BOARD_BIGTREE_SKR_V1_3
#undef BOARD_BIGTREE_SKR_V1_4
#undef BOARD_BIGTREE_SKR_V1_4_TURBO
#undef BOARD_BIGTREE_BTT002_V1_0
#undef BOARD_BIGTREE_SKR_PRO_V1_1
#undef BOARD_BIGTREE_SKR_MINI_V1_1
#undef BOARD_BIGTREE_SKR_MINI_E3
#undef BOARD_BIGTREE_SKR_E3_DIP
#undef BOARD_RUMBA32
#undef BOARD_RUMBA32_AUS3D
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/pins/ramps/pins_RAMPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@
#if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN)
#if NUM_SERVOS < 2 // Use servo connector if possible
#define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM
#ifndef SPINDLE_LASER_PWM_PIN
#define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM
#endif
#define SPINDLE_DIR_PIN 5
#elif HAS_FREE_AUX2_PINS
#define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown!
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_ANET_ET4.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
// Z Probe
//
#if ENABLED(BLTOUCH)
#error "You will need to use 24V to 5V converter and remove one resistor and capacitor from the motherboard. See https://github.com/davidtgbe/Marlin/blob/bugfix-2.0.x/docs/Tutorials/bltouch-en.md for more information. Comment out this line to proceed at your own risk."
#error "You will need to use 24V to 5V converter and remove one resistor and capacitor from the motherboard. See https://bit.ly/3xg9cXO for more information. Comment out this line to proceed at your own risk."
#define SERVO0_PIN PC3
#elif !defined(Z_MIN_PROBE_PIN)
#define Z_MIN_PROBE_PIN PC3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Regular users can open and close their own issues, but only the administrators c
- Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - USA - Project Maintainer &nbsp; [💸 Donate](https://www.thinkyhead.com/donate-to-marlin)
- Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - USA
- Keith Bennett [[@thisiskeithb](https://github.com/thisiskeithb)] - USA &nbsp; [💸 Donate](https://github.com/sponsors/thisiskeithb)
- Peter Ellens [[@ellensp](https://github.com/ellensp)] - New Zealand
- Peter Ellens [[@ellensp](https://github.com/ellensp)] - New Zealand &nbsp; [💸 Donate](https://ko-fi.com/ellensp)
- Victor Oliveira [[@rhapsodyv](https://github.com/rhapsodyv)] - Brazil
- Chris Pepper [[@p3p](https://github.com/p3p)] - UK
- Jason Smith [[@sjasonsmith](https://github.com/sjasonsmith)] - USA
Expand Down
4 changes: 1 addition & 3 deletions buildroot/bin/use_example_configs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot'
which wget >/dev/null && TOOL='wget -q -O wgot'

CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
[[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x

REPO=$BRANCH
REPO=bugfix-2.0.x

if [[ $# > 0 ]]; then
IFS=: read -r PART1 PART2 <<< "$@"
Expand Down
18 changes: 8 additions & 10 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,17 @@ def add_to_feat_cnf(feature, flines):
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
blab("[%s] lib_deps = %s" % (feature, dep), 3)

def load_config():
def load_features():
blab("========== Gather [features] entries...")
items = ProjectConfig().items('features')
for key in items:
for key in ProjectConfig().items('features'):
feature = key[0].upper()
if not feature in FEATURE_CONFIG:
FEATURE_CONFIG[feature] = { 'lib_deps': [] }
add_to_feat_cnf(feature, key[1])

# Add options matching custom_marlin.MY_OPTION to the pile
blab("========== Gather custom_marlin entries...")
all_opts = env.GetProjectOptions()
for n in all_opts:
for n in env.GetProjectOptions():
key = n[0]
mat = re.match(r'custom_marlin\.(.+)', key)
if mat:
Expand Down Expand Up @@ -127,10 +125,10 @@ def force_ignore_unused_libs():
set_env_field('lib_ignore', lib_ignore)

def apply_features_config():
load_config()
load_features()
blab("========== Apply enabled features...")
for feature in FEATURE_CONFIG:
if not env.MarlinFeatureIsEnabled(feature):
if not env.MarlinHas(feature):
continue

feat = FEATURE_CONFIG[feature]
Expand Down Expand Up @@ -212,7 +210,7 @@ def load_marlin_features():
#
# Return True if a matching feature is enabled
#
def MarlinFeatureIsEnabled(env, feature):
def MarlinHas(env, feature):
load_marlin_features()
r = re.compile('^' + feature + '$')
found = list(filter(r.match, env['MARLIN_FEATURES']))
Expand All @@ -225,7 +223,7 @@ def MarlinFeatureIsEnabled(env, feature):
if val in [ '', '1', 'true' ]:
some_on = True
elif val in env['MARLIN_FEATURES']:
some_on = env.MarlinFeatureIsEnabled(val)
some_on = env.MarlinHas(val)

return some_on

Expand All @@ -239,7 +237,7 @@ def MarlinFeatureIsEnabled(env, feature):
#
# Add a method for other PIO scripts to query enabled features
#
env.AddMethod(MarlinFeatureIsEnabled)
env.AddMethod(MarlinHas)

#
# Add dependencies for enabled Marlin features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Import("env")

if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
if env.MarlinHas("POSTMORTEM_DEBUGGING"):
FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple")
patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done")

Expand Down
9 changes: 7 additions & 2 deletions buildroot/share/PlatformIO/scripts/pioutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

# Make sure 'vscode init' is not the current command
def is_pio_build():
from SCons.Script import COMMAND_LINE_TARGETS
return "idedata" not in COMMAND_LINE_TARGETS and "_idedata" not in COMMAND_LINE_TARGETS
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
return not env.IsIntegrationDump()

def get_pio_version():
from platformio import util
return util.pioversion_to_intstr()
5 changes: 4 additions & 1 deletion buildroot/share/PlatformIO/scripts/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def run_preprocessor(env, fn=None):
depcmd = cmd + [ filename ]
cmd = ' '.join(depcmd)
blab(cmd)
define_list = subprocess.check_output(cmd, shell=True).splitlines()
try:
define_list = subprocess.check_output(cmd, shell=True).splitlines()
except:
define_list = {}
preprocessor_cache[filename] = define_list
return define_list

Expand Down
46 changes: 4 additions & 42 deletions buildroot/share/git/mfconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,53 +110,15 @@ if [[ $ACTION == "init" ]]; then
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Commit for comparison" >/dev/null

# Init Cartesian/SCARA/TPARA configurations to default
echo "- Initializing Cartesian/SCARA/TPARA configs to default state..."
echo "- Initializing configs to default state..."

find "$CEXA" -name $BC ! -path */delta/* -print0 \
find "$CEXA" -name $BC -print0 \
| while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done
find "$CEXA" -name $AC ! -path */delta/* -print0 \
find "$CEXA" -name $AC -print0 \
| while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done

# DEBUG: Commit the reset for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Cartesian/SCARA/TPARA configs..." >/dev/null

# Create base Delta configurations
cp "$CDEF"/* "$CEXA/delta/generic"

# DEBUG: Commit the reset for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Generic Delta..." >/dev/null

cp -R "$TEMP/$CEXA/delta/generic"/Conf* "$CEXA/delta/generic"

# DEBUG: Commit Generic Delta changes for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Apply Generic Delta..." >/dev/null

# Reset all Delta configs to the generic version
find "$CEXA/delta" -name $BC ! -path */generic/* -print0 \
| while read -d $'\0' F ; do cp "$CEXA/delta/generic/$BC" "$F" ; done
find "$CEXA/delta" -name $AC ! -path */generic/* -print0 \
| while read -d $'\0' F ; do cp "$CEXA/delta/generic/$AC" "$F" ; done

# DEBUG: Commit the Delta reset for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Delta configs..." >/dev/null

# Reset all SCARA configs to the default cartesian
find "$CEXA/SCARA" -name $BC \
| while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done
find "$CEXA/SCARA" -name $AC \
| while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done

# DEBUG: Commit the SCARA reset for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset SCARA..." >/dev/null

# Reset all TPARA configs to the default cartesian
find "$CEXA/TPARA" -name $BC \
| while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done
find "$CEXA/TPARA" -name $AC \
| while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done

# DEBUG: Commit the TPARA reset for review
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset TPARA..." >/dev/null
((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset configs..." >/dev/null

# Update the %VERSION% in the README.md file
VERS=$( echo $EXPORT | $SED 's/release-//' )
Expand Down
23 changes: 18 additions & 5 deletions buildroot/share/scripts/MarlinBinaryProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,13 @@ def close(self):
token, data = self.await_response(1000)
if token == 'PFT:success':
print("File closed")
return
return True
elif token == 'PFT:ioerror':
print("Client storage device IO error")
return False
elif token == 'PFT:invalid':
print("No open file")
return False

def abort(self):
self.protocol.send(FileTransferProtocol.protocol_id, FileTransferProtocol.Packet.ABORT);
Expand Down Expand Up @@ -417,12 +419,23 @@ def copy(self, filename, dest_filename, compression, dummy):
self.write(data[start:end])
kibs = (( (i+1) * block_size) / 1024) / (millis() + 1 - start_time) * 1000
if (i / blocks) >= dump_pctg:
print("\r{0:2.2f}% {1:4.2f}KiB/s {2} Errors: {3}".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors), end='')
print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors), end='')
dump_pctg += 0.1
print("\r{0:2.2f}% {1:4.2f}KiB/s {2} Errors: {3}".format(100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors)) # no one likes transfers finishing at 99.8%

self.close()
if self.protocol.errors > 0:
# Dump last status (errors may not be visible)
print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3} - Aborting...".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors), end='')
print("") # New line to break the transfer speed line
self.close()
print("Transfer aborted due to protocol errors")
#raise Exception("Transfer aborted due to protocol errors")
return False;
print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format(100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors)) # no one likes transfers finishing at 99.8%

if not self.close():
print("Transfer failed")
return False
print("Transfer complete")
return True


class EchoProtocol(object):
Expand Down

0 comments on commit 2952f0b

Please sign in to comment.